diff --git a/Language/en_US.xaml b/Language/en_US.xaml index 1ccc0c2..4534ce7 100644 --- a/Language/en_US.xaml +++ b/Language/en_US.xaml @@ -224,4 +224,16 @@ Image rendering error: Simulated Heart and Arrow Preview The simulated heart and arrow diagram is a rendered simulation. Actual results should be verified with a cut-scope. + + NVIDIA graphics driver not found. Some features may not work properly. + NVIDIA driver version is outdated. Please upgrade your graphics driver. (Current: %version, Minimum: 528.33) + + Detecting, please wait... + Stop Detection + Diamond data calculation is in progress. Do you want to stop? + Paused + Continue + Replay + Previous Frame + Next Frame diff --git a/Language/zh_CN.xaml b/Language/zh_CN.xaml index 1fd7b07..4c77196 100644 --- a/Language/zh_CN.xaml +++ b/Language/zh_CN.xaml @@ -225,10 +225,16 @@ 仿真心箭图预览 仿真心箭图为模拟渲染,实际请以切工镜观测为准。 - 未找到Nvidia显卡驱动,部分功能可能无法正常运行。 - Nvidia显卡驱动版本过旧,请尝试升级显卡驱动。(当前:%version,最低:528.33) + 未找到NVIDIA显卡驱动,部分功能可能无法正常运行。 + NVIDIA显卡驱动版本过旧,请尝试升级显卡驱动。(当前:%version,最低:528.33) 正在检测,请稍等 终止检测 + 正在计算钻石数据,是否终止? + 暂停 + 继续 + 重播 + 上一帧 + 下一帧 \ No newline at end of file diff --git a/SparkDB.db b/SparkDB.db index 5022d56..e31dca9 100644 Binary files a/SparkDB.db and b/SparkDB.db differ diff --git a/ViewModel/BaseWindow/BaseControlVM.cs b/ViewModel/BaseWindow/BaseControlVM.cs index 5421205..e40d751 100644 --- a/ViewModel/BaseWindow/BaseControlVM.cs +++ b/ViewModel/BaseWindow/BaseControlVM.cs @@ -12,13 +12,14 @@ public class BaseControlVM : BaseViewModel string _windowTitle; private Visibility _showFunctionButton; + private Visibility _showCloseButton; private string _functionButtonIcon; private Object _viewContent; public string WindowTitle { get { return _windowTitle; } set { _windowTitle = value; OnPropertyChanged("WindowTitle"); } } public Visibility ShowFunctionButton { get { return _showFunctionButton; } set { _showFunctionButton = value; OnPropertyChanged("ShowFunctionButton"); } } - public Visibility ShowCloseButton { get { return _showFunctionButton; } set { _showFunctionButton = value; OnPropertyChanged("ShowFunctionButton"); } } + public Visibility ShowCloseButton { get { return _showCloseButton; } set { _showCloseButton = value; OnPropertyChanged("ShowCloseButton"); } } public string FunctionButtonIcon { get { return _functionButtonIcon; } set { _functionButtonIcon = value; OnPropertyChanged("FunctionButtonIcon"); } } public Object ViewControl { get { return _viewContent; } set { _viewContent = value; OnPropertyChanged("ViewControl"); } } @@ -55,11 +56,11 @@ public class BaseControlVM : BaseViewModel { Content = vm; WindowTitle = windowTitle; - ShowFunctionButton = Visibility.Hidden; + ShowCloseButton = Visibility.Visible; CloseCommand = new RelayCommand(CloseVM); NextCommand = new RelayCommand(NextDiamond); - + ShowFunctionButton = Visibility.Hidden; if (vm.GetType().Equals(typeof(GradingResultVM))) { Application.Current.Dispatcher.Invoke(() => @@ -146,11 +147,14 @@ public class BaseControlVM : BaseViewModel if(Content is GradingResultVM) { bool isSaved = (Content as GradingResultVM).isSaved; - if (isSaved) { + if (isSaved) + { + WindowManager.PreviousVM(); WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); } else { // 部署改造:2 + WindowManager.PreviousVM(); WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); // MessageBox message = new MessageBox(); // MessageBoxResult result = message.ShowAsk(MultilingualHelper.getString("DiamodResultCloseConfirm")); diff --git a/ViewModel/Grading/DiamondSelectVM.cs b/ViewModel/Grading/DiamondSelectVM.cs index 3eef198..1a9d020 100644 --- a/ViewModel/Grading/DiamondSelectVM.cs +++ b/ViewModel/Grading/DiamondSelectVM.cs @@ -147,9 +147,34 @@ public class DiamondSelectVM : BaseViewModel string runModel = ConfigurationHelper.ReadConfigValue("RunModel")??"1"; - if("0".Equals(runModel)) + if ("0".Equals(runModel)) //json模式 - DoStartGrading(param); + + { + var loadingView = new GradingLoadingVM(param.ToString(), DiamondCode); + BaseControlVM vm = new BaseControlVM(loadingView, MultilingualHelper.getString("wait")); + vm.WindowTitle = string.IsNullOrWhiteSpace(DiamondCode) ? vm.WindowTitle : $"{vm.WindowTitle} - {DiamondCode}"; + WindowManager.mainViewModel.Content = vm; + WindowManager.openContent.Add(vm); + //DoStartGrading(param); + int res = await loadingView.Start(11); + if (res > -100 && res < 0) + { + //返回 + loadingView.Dispose(); + WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); + return; + } + else if ( res <= -100) + { + return; + } + else + { + GradingResult(loadingView.Parameter); + loadingView.Dispose(); + } + } else if ("1".Equals(runModel)) { //Image模式 diff --git a/ViewModel/Grading/GradingLoadingVM.cs b/ViewModel/Grading/GradingLoadingVM.cs index dea6658..0b6899d 100644 --- a/ViewModel/Grading/GradingLoadingVM.cs +++ b/ViewModel/Grading/GradingLoadingVM.cs @@ -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 = 100; // 默认播放速度 @@ -138,6 +140,31 @@ public class GradingLoadingVM : BaseViewModel,IDisposable { var progress = RunProgressAsync(_progressCts.Token); + + if (type == 11) + { + 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(stringBuilder.ToString()); + await CompleteProgressQuicklyAsync(); + return 0; + } + else + { + return -1; + } + } + if(type == 0){ _socClientService = new SOCClientService(); var processImage = _socClientService.ProcessImageCollectionAsync(); @@ -321,17 +348,24 @@ public class GradingLoadingVM : BaseViewModel,IDisposable private void Stop(object param) { //询问?停止:忽略 - MessageBox messageBox = new MessageBox(); - MessageBoxResult showAsk = messageBox.ShowAsk("正在计算钻石数据,是否终止?"); - if (showAsk == MessageBoxResult.OK) + try + { + MessageBox messageBox = new MessageBox(); + MessageBoxResult showAsk = messageBox.ShowAsk(MultilingualHelper.getString("GradingLoadingStopAsk")); + if (showAsk == MessageBoxResult.OK) + { + WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); + _scanner?.Cancel(); + _progressCts.Cancel(); + this.Dispose(); + } + + } + catch (Exception ex) { - _scanner?.Cancel(); - _progressCts.Cancel(); - WindowManager.mainViewModel.Content = WindowManager.PreviousVM(); - this.Dispose(); + } - } private async Task RunProgressAsync(CancellationToken token) diff --git a/Views/Dialog/JsonImport.xaml b/Views/Dialog/JsonImport.xaml index 36447ec..5ae7fa5 100644 --- a/Views/Dialog/JsonImport.xaml +++ b/Views/Dialog/JsonImport.xaml @@ -8,7 +8,7 @@ Title="JsonImport" Height="450" Width="800" DataContext="{Binding RelativeSource={RelativeSource Self}}" WindowStyle="None" AllowsTransparency="True" Background="Transparent"> - + diff --git a/Views/Grading/GradingLoading.xaml b/Views/Grading/GradingLoading.xaml index d4f6438..1217c06 100644 --- a/Views/Grading/GradingLoading.xaml +++ b/Views/Grading/GradingLoading.xaml @@ -406,7 +406,7 @@ - + diff --git a/Views/UserControl/ViewportData/Helper/RayHelper.cs b/Views/UserControl/ViewportData/Helper/RayHelper.cs index fae3954..c48ef15 100644 --- a/Views/UserControl/ViewportData/Helper/RayHelper.cs +++ b/Views/UserControl/ViewportData/Helper/RayHelper.cs @@ -16,9 +16,6 @@ public class RayHelper private static string _image_path = AppDomain.CurrentDomain.BaseDirectory + @"Ray\Image\"; //unity渲染模型缓存(运行前清理) private static string _obj_path = AppDomain.CurrentDomain.BaseDirectory + @"Ray\Obj"; - //用于存放unity渲染插件(版本发布独立更新) - private static string _unity_path = AppDomain.CurrentDomain.BaseDirectory + @"Ray\Core\"; - public static void GenerateRender(string modelInfo, string diamondCode) {