|
|
|
|
@ -7,6 +7,7 @@ using System.Windows; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
using System.Windows.Media; |
|
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
|
using System.Windows.Threading; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using SparkClient.Model.Attributes; |
|
|
|
|
@ -121,7 +122,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable |
|
|
|
|
|
|
|
|
|
private bool _isCancel = false; |
|
|
|
|
|
|
|
|
|
private static Timer _monitorTimer; |
|
|
|
|
private Timer _monitorTimer; |
|
|
|
|
private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); |
|
|
|
|
|
|
|
|
|
public GradingLoadingVM(string diamnondType, string diamondCode) |
|
|
|
|
@ -146,6 +147,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable |
|
|
|
|
500, |
|
|
|
|
Timeout.Infinite); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private async void CheckSpeedCallback(object state) |
|
|
|
|
@ -153,16 +155,22 @@ public class GradingLoadingVM : BaseViewModel,IDisposable |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
GpioStatus gpioStatus = await SOCClientService.Service.GetGpioStatus(); |
|
|
|
|
if (gpioStatus.LensGpioIsOpen() || gpioStatus.DiamondGpioIsOpen()) |
|
|
|
|
Application.Current.Dispatcher.Invoke(() => |
|
|
|
|
{ |
|
|
|
|
new MessageBox().Show(MultilingualHelper.getString("OpenOfTheHatch")); |
|
|
|
|
WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); |
|
|
|
|
_scanner?.Cancel(); |
|
|
|
|
_isCancel = true; |
|
|
|
|
_progressCts.Cancel(); |
|
|
|
|
this.Dispose(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (gpioStatus.LensGpioIsOpen() || gpioStatus.DiamondGpioIsOpen()) |
|
|
|
|
{ |
|
|
|
|
new MessageBox().Show(MultilingualHelper.getString("OpenOfTheHatch")); |
|
|
|
|
WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); |
|
|
|
|
_scanner?.Cancel(); |
|
|
|
|
_isCancel = true; |
|
|
|
|
_progressCts.Cancel(); |
|
|
|
|
this.Dispose(); |
|
|
|
|
_monitorTimer.Dispose(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
_monitorTimer.Change(500, Timeout.Infinite); |
|
|
|
|
}, DispatcherPriority.Normal); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
@ -424,7 +432,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable |
|
|
|
|
{ |
|
|
|
|
SOCClientService.Service.OpenPump(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_monitorTimer.Dispose(); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
Logger.Info($"算法结果Json单独保存至log/result"); |
|
|
|
|
@ -522,6 +530,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable |
|
|
|
|
{ |
|
|
|
|
WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); |
|
|
|
|
_scanner?.Cancel(); |
|
|
|
|
_monitorTimer.Dispose(); |
|
|
|
|
_isCancel = true; |
|
|
|
|
_progressCts.Cancel(); |
|
|
|
|
this.Dispose(); |
|
|
|
|
@ -566,6 +575,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable |
|
|
|
|
[Log] |
|
|
|
|
public void Dispose() |
|
|
|
|
{ |
|
|
|
|
_monitorTimer.Dispose(); |
|
|
|
|
Dispose(true); |
|
|
|
|
GC.SuppressFinalize(this); |
|
|
|
|
} |
|
|
|
|
|