@ -1,6 +1,7 @@
using System.Configuration ;
using System.Data ;
using System.IO ;
using System.Text ;
using System.Windows ;
using System.Windows.Input ;
using System.Windows.Media ;
@ -13,6 +14,7 @@ using SparkClient.Model.Helper;
using SparkClient.Model.Services ;
using SparkClient.ViewModel.BaseWindow ;
using SparkClient.ViewModel.Configuration ;
using SparkClient.Views.Dialog ;
using SparkDotNetCore.DiamondScanner ;
using SparkDotNetCore.DiamondScanner.Entity ;
using MessageBox = SparkClient . Views . Dialog . MessageBox ;
@ -66,9 +68,9 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
}
public string ButtonText = > CurrentStatus switch
{
PlayStatus . Playing = > "暂停" ,
PlayStatus . Paused = > "继续" ,
_ = > "重播" // Stopped 状态
PlayStatus . Playing = > MultilingualHelper . getString ( "GradingLoadingPaused" ) ,
PlayStatus . Paused = > MultilingualHelper . getString ( "GradingLoadingContinue" ) ,
_ = > MultilingualHelper . getString ( "GradingLoadingReplay" ) // Stopped 状态
} ;
private CancellationTokenSource _ cts ;
private int _ playDelay = 1 0 0 ; // 默认播放速度
@ -138,6 +140,31 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
{
var progress = RunProgressAsync ( _ progressCts . Token ) ;
if ( type = = 1 1 )
{
JsonImport jsonImport = new JsonImport ( ) ;
bool? a = jsonImport . ShowDialog ( ) ;
if ( a ? ? false )
{
string fileName = jsonImport . FilePath . Text ;
string [ ] lines = File . ReadAllLines ( fileName ) ;
StringBuilder stringBuilder = new StringBuilder ( ) ;
foreach ( var line in lines )
{
stringBuilder . Append ( line ) ;
}
Parameter = JsonConvert . DeserializeObject < AlgorithmResultEntity > ( stringBuilder . ToString ( ) ) ;
await CompleteProgressQuicklyAsync ( ) ;
return 0 ;
}
else
{
return - 1 ;
}
}
if ( type = = 0 ) {
_ socClientService = new SOCClientService ( ) ;
var processImage = _ socClientService . ProcessImageCollectionAsync ( ) ;
@ -321,16 +348,23 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
private void Stop ( object param )
{
//询问?停止:忽略
try
{
MessageBox messageBox = new MessageBox ( ) ;
MessageBoxResult showAsk = messageBox . ShowAsk ( "正在计算钻石数据,是否终止?" ) ;
MessageBoxResult showAsk = messageBox . ShowAsk ( MultilingualHelper . getString ( "GradingLoadingStopAsk" ) ) ;
if ( showAsk = = MessageBoxResult . OK )
{
WindowManager . mainViewModel . Content = WindowManager . PreviousVM ( ) ;
_ scanner ? . Cancel ( ) ;
_ progressCts . Cancel ( ) ;
WindowManager . mainViewModel . Content = WindowManager . PreviousVM ( ) ;
this . Dispose ( ) ;
}
}
catch ( Exception ex )
{
}
}