add log cut
This commit is contained in:
parent
1e425a3e7e
commit
d11ec2a31d
|
@ -33,6 +33,7 @@
|
|||
|
||||
public const string Upload = "api/files/upload";
|
||||
public const string Download = "api/files/{0}";
|
||||
public const string Cut = "api/files/{0}/cut";
|
||||
|
||||
public const string CdrFiles = "api/cdr-files";
|
||||
public const string CdrFileById = "api/cdr-files/{0}";
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace PCUT.Pages
|
|||
_portName = portName;
|
||||
_portSettings = portSetting;
|
||||
_designCenterViewModel = designCenterViewModel;
|
||||
//StartButton.IsEnabled = !(portName is null);
|
||||
StartButton.IsEnabled = !(portName is null);
|
||||
|
||||
ViewModels = DataContext as CutDialogViewModel;
|
||||
}
|
||||
|
@ -84,12 +84,13 @@ namespace PCUT.Pages
|
|||
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
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]
|
||||
//})
|
||||
_ = ViewModels.CutFileAsync(_designCenterViewModel.FileId);
|
||||
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
|
||||
|
@ -100,7 +101,7 @@ 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)
|
||||
{
|
||||
|
@ -112,7 +113,7 @@ namespace PCUT.Pages
|
|||
waitTask.Wait();
|
||||
try
|
||||
{
|
||||
//serialPort.Write(path);
|
||||
serialPort.Write(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -150,7 +151,7 @@ namespace PCUT.Pages
|
|||
{
|
||||
try
|
||||
{
|
||||
//serialPort.Close();
|
||||
serialPort.Close();
|
||||
Task.Delay(1000).Wait();
|
||||
}
|
||||
catch
|
||||
|
|
|
@ -4,6 +4,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Http.Core;
|
||||
using Http.Core.Extensions;
|
||||
using static Http.Core.Constants.HttpConstants;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -18,5 +21,19 @@ namespace PCUT.ViewModels
|
|||
SetProperty(ref _printCommand, value);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CutFileAsync(string fileId)
|
||||
{
|
||||
using (var httpClient = HttpClientFactory.CreateClient(ClientNames.ApiClient))
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = await httpClient.GetAsync(Api.Cut.FormatRoute(fileId));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue