diff --git a/PCUT/PCUT/PCUT.csproj b/PCUT/PCUT/PCUT.csproj
index b554cb5..fb351af 100644
--- a/PCUT/PCUT/PCUT.csproj
+++ b/PCUT/PCUT/PCUT.csproj
@@ -247,6 +247,7 @@
UserListPage.xaml
+
diff --git a/PCUT/PCUT/Package.appxmanifest b/PCUT/PCUT/Package.appxmanifest
index 073f08e..2c80a84 100644
--- a/PCUT/PCUT/Package.appxmanifest
+++ b/PCUT/PCUT/Package.appxmanifest
@@ -9,7 +9,7 @@
+ Version="1.3.4.0" />
diff --git a/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml b/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml
index 8122791..cad39d7 100644
--- a/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml
+++ b/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml
@@ -8,6 +8,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Opened="ContentDialog_Opened">
+
+
+
@@ -16,7 +19,8 @@
-
+
+
@@ -61,7 +65,18 @@
Margin="5 0 0 0"/>
-
+
+
+
+
+
diff --git a/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml.cs b/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml.cs
index 4b53ac9..c964ee2 100644
--- a/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml.cs
+++ b/PCUT/PCUT/Pages/DesignCenter/CutFilesDialog.xaml.cs
@@ -11,6 +11,7 @@ using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
+using Windows.ApplicationModel.Core;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
@@ -33,6 +34,7 @@ namespace PCUT.Pages
private readonly string _portName;
private readonly PortSettingViewModel _portSettings;
private readonly DesignCenterViewModel _designCenterViewModel;
+ private CutDialogViewModel ViewModels;
public CutFilesDialog(
string portName,
@@ -44,7 +46,9 @@ namespace PCUT.Pages
_portName = portName;
_portSettings = portSetting;
_designCenterViewModel = designCenterViewModel;
- StartButton.IsEnabled = !(portName is null);
+ //StartButton.IsEnabled = !(portName is null);
+
+ ViewModels = DataContext as CutDialogViewModel;
}
private Task _printTask;
@@ -79,12 +83,13 @@ namespace PCUT.Pages
}
_cancellationTokenSource = new CancellationTokenSource();
- using (var serialPort = new SerialPort(_portName, _portSettings.BaudRate)
- {
- DataBits = _portSettings.Databits,
- Parity = _portSettings.ParityList[_portSettings.SelectedParity],
- StopBits = _portSettings.StopbitsList[_portSettings.SelectedStopbits]
- })
+ ViewModels.PrintCommand = string.Empty;
+ //using (var serialPort = new SerialPort(_portName, _portSettings.BaudRate)
+ //{
+ // DataBits = _portSettings.Databits,
+ // Parity = _portSettings.ParityList[_portSettings.SelectedParity],
+ // StopBits = _portSettings.StopbitsList[_portSettings.SelectedStopbits]
+ //})
{
var errorMessage = string.Empty;
try
@@ -95,15 +100,19 @@ namespace PCUT.Pages
(_svgData.OriginWidth.Value, _svgData.OriginHeight.Value),
(_designCenterViewModel.Width, _designCenterViewModel.Height),
_portSettings.Speed);
- serialPort.Open();
+ //serialPort.Open();
Task waitTask = Task.CompletedTask;
foreach (var (path, waitTime) in data)
{
_cancellationTokenSource.Token.ThrowIfCancellationRequested();
+ _ = CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
+ {
+ ViewModels.PrintCommand += path;
+ });
waitTask.Wait();
try
{
- serialPort.Write(path);
+ //serialPort.Write(path);
}
catch
{
@@ -141,7 +150,7 @@ namespace PCUT.Pages
{
try
{
- serialPort.Close();
+ //serialPort.Close();
Task.Delay(1000).Wait();
}
catch
diff --git a/PCUT/PCUT/ViewModels/CutDialogViewModel.cs b/PCUT/PCUT/ViewModels/CutDialogViewModel.cs
new file mode 100644
index 0000000..540e788
--- /dev/null
+++ b/PCUT/PCUT/ViewModels/CutDialogViewModel.cs
@@ -0,0 +1,22 @@
+using PCUT.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PCUT.ViewModels
+{
+ internal class CutDialogViewModel : NotificationBase
+ {
+ private string _printCommand;
+ public string PrintCommand
+ {
+ get => _printCommand;
+ set
+ {
+ SetProperty(ref _printCommand, value);
+ }
+ }
+ }
+}