diff --git a/Language/zh_CN.xaml b/Language/zh_CN.xaml
index 34bacec..e647f4f 100644
--- a/Language/zh_CN.xaml
+++ b/Language/zh_CN.xaml
@@ -77,6 +77,7 @@
异形钻
正在检测,请等待...
+ 正在生成文件,请稍等...
平均
diff --git a/ViewModel/Grading/DiamondSelectVM.cs b/ViewModel/Grading/DiamondSelectVM.cs
index 9f184fd..c718b58 100644
--- a/ViewModel/Grading/DiamondSelectVM.cs
+++ b/ViewModel/Grading/DiamondSelectVM.cs
@@ -115,84 +115,88 @@ public class DiamondSelectVM : BaseViewModel
///
public async void StartGrading(object param)
{
+ #if DEBUG
DoStartGrading(param);
- //LoadingDialog loading = new LoadingDialog();
- //try
- //{
- // if (param != null)
- // {
- // var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => loading.ShowDialog()));
- // await Task.Run(async () =>
- // {
- // bool isEnd = false;
- // int progress = 0;
- // // 更新进度条的值(需要在UI线程上执行)
- // loading.Dispatcher.Invoke(async () =>
- // {
- // for (int i = 0; i <= 97; i++)
- // {
- // if (isEnd)
- // {
- // break;
- // }
- // // 模拟耗时操作
- // //System.Threading.Thread.Sleep(50); // 休眠50毫秒
- // await Task.Delay(1000);
- // loading.setValue(i);
- // progress = i;
- // }
- // });
+ #else
+ LoadingDialog loading = new LoadingDialog();
+ try
+ {
+ if (param != null)
+ {
+ var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => loading.ShowDialog()));
+ await Task.Run(async () =>
+ {
+ bool isEnd = false;
+ int progress = 0;
+ // 更新进度条的值(需要在UI线程上执行)
+ loading.Dispatcher.Invoke(async () =>
+ {
+ for (int i = 0; i <= 97; i++)
+ {
+ if (isEnd)
+ {
+ break;
+ }
+ // 模拟耗时操作
+ //System.Threading.Thread.Sleep(50); // 休眠50毫秒
+ await Task.Delay(400);
+ loading.setValue(i);
+ progress = i;
+ }
+ });
- // SocResultEntity socResolt = new SocResultEntity();
- // AlgorithmResultEntity parameter = new AlgorithmResultEntity();
- // parameter.Standard = "IGI 2024";
- // string value = param.ToString() ?? "";
- // if (value != null && value.Split(" ").Length == 3)
- // {
- // parameter.Shape = value.Split(" ")[0];
- // parameter.CrownType = value.Split(" ")[1];
- // parameter.PavType = value.Split(" ")[2];
- // }
+ SocResultEntity socResolt = new SocResultEntity();
+ AlgorithmResultEntity parameter = new AlgorithmResultEntity();
+ parameter.Standard = "IGI 2024";
+ string value = param.ToString() ?? "";
+ if (value != null && value.Split(" ").Length == 3)
+ {
+ parameter.Shape = value.Split(" ")[0];
+ parameter.CrownType = value.Split(" ")[1];
+ parameter.PavType = value.Split(" ")[2];
+ }
- // // 启动soc
- // socResolt = await DoSoc();
- // // 启动算法
- // parameter = await DoAlgorithm(socResolt, parameter.Shape, parameter.CrownType);
+ // 启动soc
+ socResolt = await DoSoc();
+ // 启动算法
+ parameter = await DoAlgorithm(socResolt, parameter.Shape, parameter.CrownType);
- // parameter.Standard = "IGI 2024";
- // parameter.Shape = value.Split(" ")[0];
- // parameter.CrownType = value.Split(" ")[1];
- // parameter.PavType = value.Split(" ")[2];
- // parameter.DiamondCode = DiamondCode;
- // isEnd = true;
- // //GradingResult(parameter);
- // await loading.Dispatcher.Invoke(async () =>
- // {
- // for (int i = progress; progress <= 100; i++)
- // {
- // Random random = new Random(); int minValue = 50; int maxValue = 150; // 生成50到150之间的随机整数
- // int randomNumber = random.Next(minValue, maxValue + 1);
- // await Task.Delay(randomNumber);
- // loading.setValue(i);
- // if (loading.ProgressBar.Value == 98)
- // {
- // GradingResult(parameter);
- // }
- // if(loading.ProgressBar.Value >= 100)
- // {
+ parameter.Standard = "IGI 2024";
+ parameter.Shape = value.Split(" ")[0];
+ parameter.CrownType = value.Split(" ")[1];
+ parameter.PavType = value.Split(" ")[2];
+ parameter.DiamondCode = DiamondCode;
+ isEnd = true;
+ //GradingResult(parameter);
+ await loading.Dispatcher.Invoke(async () =>
+ {
+ for (int i = progress; progress <= 100; i++)
+ {
+ Random random = new Random(); int minValue = 20; int maxValue = 100; // 生成50到150之间的随机整数
+ int randomNumber = random.Next(minValue, maxValue + 1);
+ await Task.Delay(randomNumber);
+ loading.setValue(i);
+ if (loading.ProgressBar.Value == 98)
+ {
+ GradingResult(parameter);
+ }
+ if(loading.ProgressBar.Value >= 100)
+ {
- // loading.Close();
- // break;
- // }
- // }
+ loading.Close();
+ break;
+ }
+ }
- // });
- // });
- // }
- //}
- //finally {
+ });
+ });
+ }
+ }
+ finally {
- //}
+ }
+ #endif
+
}
///
/// 开始检测(对soc和算法开始通讯)
diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs
index 992e0f7..3a8fac1 100644
--- a/ViewModel/Grading/GradingResultVM.cs
+++ b/ViewModel/Grading/GradingResultVM.cs
@@ -577,11 +577,11 @@ public class GradingResultVM : BaseViewModel
{
ExportDialog exportDialog = new ExportDialog();
var tcs = new TaskCompletionSource();
- //var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => {
- // exportDialog.Closed += (s, e) => tcs.SetResult(true);
- // exportDialog.ShowDialog();
- //}
- // ));
+ var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => {
+ exportDialog.Closed += (s, e) => tcs.SetResult(true);
+ exportDialog.ShowDialog();
+ }
+ ));
await Task.Run(async () =>
{
@@ -615,10 +615,10 @@ public class GradingResultVM : BaseViewModel
exportDialog.setValue("Success");
});
//DataConver(filePath);
- //exportDialog.Dispatcher.Invoke(() =>
- //{
- // exportDialog.setValue("5/5");
- //});
+ // exportDialog.Dispatcher.Invoke(() =>
+ // {
+ // exportDialog.setValue("Success");
+ // });
});
await Task.Delay(500);
exportDialog.Close();
diff --git a/Views/Dialog/ExportDialog.xaml b/Views/Dialog/ExportDialog.xaml
index 0b1ceab..51c408f 100644
--- a/Views/Dialog/ExportDialog.xaml
+++ b/Views/Dialog/ExportDialog.xaml
@@ -18,7 +18,7 @@
-
+
diff --git a/Views/UserControl/ViewportData/Helper/VideoHelper.cs b/Views/UserControl/ViewportData/Helper/VideoHelper.cs
index 048d438..d670428 100644
--- a/Views/UserControl/ViewportData/Helper/VideoHelper.cs
+++ b/Views/UserControl/ViewportData/Helper/VideoHelper.cs
@@ -102,7 +102,8 @@ public class VideoHelper
string ffmpegPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ffmpeg.exe"); // Assuming ffmpeg.exe is in the same directory as the application
if (!File.Exists(ffmpegPath))
{
- throw new FileNotFoundException("FFmpeg executable not found.", ffmpegPath);
+ // throw new FileNotFoundException("", ffmpegPath);
+ MessageBox.Show("FFmpeg executable not found.", ffmpegPath);
}
string framePattern = Path.Combine(tempDirectory, "frame_%05d.png").Replace("\\", "/"); // Replace backslashes with forward slashes for FFmpeg compatibility