diff --git a/App.xaml b/App.xaml
index c815002..4591e2a 100644
--- a/App.xaml
+++ b/App.xaml
@@ -74,10 +74,7 @@
-
-
-
-
+
diff --git a/SparkClient.csproj b/SparkClient.csproj
index d8f855a..aea9449 100644
--- a/SparkClient.csproj
+++ b/SparkClient.csproj
@@ -215,9 +215,6 @@
Code
-
- Code
-
diff --git a/ViewModel/BaseWindow/HomeWindowVM.cs b/ViewModel/BaseWindow/HomeWindowVM.cs
index 861ef88..f9043fb 100644
--- a/ViewModel/BaseWindow/HomeWindowVM.cs
+++ b/ViewModel/BaseWindow/HomeWindowVM.cs
@@ -1,4 +1,5 @@
-using System.Windows.Input;
+using System.Windows;
+using System.Windows.Input;
using SparkClient.Model.Helper;
using SparkClient.Model.Services;
using SparkClient.ViewModel.Configuration;
diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs
index 2c56aeb..3abd661 100644
--- a/ViewModel/Grading/GradingResultVM.cs
+++ b/ViewModel/Grading/GradingResultVM.cs
@@ -15,6 +15,7 @@ using SparkClient.Views.Dialog;
using NPOI.HPSF;
using Application = System.Windows.Application;
using MessageBox = SparkClient.Views.Dialog.MessageBox;
+using System.Windows;
namespace SparkClient.ViewModel.Grading;
public class GradingResultVM : BaseViewModel
@@ -505,11 +506,11 @@ public class GradingResultVM : BaseViewModel
if (string.IsNullOrEmpty(DiamondCode))
{
MessageBox messageBox = new MessageBox();
- messageBox.ShowInput(MultilingualHelper.getString("UpdateDiamondCode"), out string inputStr,
+ MessageBoxResult boxResult = messageBox.ShowInput(MultilingualHelper.getString("UpdateDiamondCode"), out string inputStr,
MultilingualHelper.getString("ok"),
MultilingualHelper.getString("Cancel")
);
- if (inputStr.Length > 0)
+ if (boxResult == MessageBoxResult.OK && inputStr.Length > 0)
{
this.DiamondCode = inputStr;
}
@@ -546,12 +547,12 @@ public class GradingResultVM : BaseViewModel
if (string.IsNullOrEmpty(DiamondCode))
{
MessageBox messageBox = new MessageBox();
- messageBox.ShowInput(MultilingualHelper.getString("UpdateDiamondCode"), out string inputStr,
+ MessageBoxResult boxResult = messageBox.ShowInput(MultilingualHelper.getString("UpdateDiamondCode"), out string inputStr,
MultilingualHelper.getString("ok"),
MultilingualHelper.getString("Cancel")
);
- if (inputStr.Length > 0)
+ if (boxResult == MessageBoxResult.OK && inputStr.Length > 0)
{
this.DiamondCode = inputStr;
}
diff --git a/Views/Dialog/JsonImport.xaml.cs b/Views/Dialog/JsonImport.xaml.cs
index 42478f9..26964b1 100644
--- a/Views/Dialog/JsonImport.xaml.cs
+++ b/Views/Dialog/JsonImport.xaml.cs
@@ -1,6 +1,4 @@
using HandyControl.Controls;
-using Newtonsoft.Json;
-using SparkClient.Model.Helper;
using SparkClient.ViewModel;
using SparkClient.ViewModel.Dialog;
using System.IO;
diff --git a/Views/Dialog/SaveDialog.xaml b/Views/Dialog/SaveDialog.xaml
deleted file mode 100644
index 4f8a1e5..0000000
--- a/Views/Dialog/SaveDialog.xaml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Views/Dialog/SaveDialog.xaml.cs b/Views/Dialog/SaveDialog.xaml.cs
deleted file mode 100644
index 899e71d..0000000
--- a/Views/Dialog/SaveDialog.xaml.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Media;
-
-
-namespace SparkClient.Views.Dialog
-{
- ///
- /// StartDialog.xaml 的交互逻辑
- ///
- public partial class SaveDialog
- {
- public SaveDialog()
- {
- WindowStartupLocation = WindowStartupLocation.CenterScreen;
- InitializeComponent();
- // 动态设置圆角裁剪
- this.Loaded += (s, e) => ApplyCornerRadiusClip();
- this.SizeChanged += (s, e) => ApplyCornerRadiusClip(); // 保证在大小改变时也裁剪
- this.Width = 562;
- this.Height = 222;
- }
- #region 重写窗体操作按钮
- private void Border_Minimize_MouseEnter(object sender, MouseEventArgs e)
- {
- // 鼠标进入时更改背景色
- if (sender is Border border)
- {
- border.Background = new SolidColorBrush(Color.FromArgb(50, 255, 255, 255));
- }
- }
- private void Border_Close_MouseEnter(object sender, MouseEventArgs e)
- {
- // 鼠标进入时更改背景色
- if (sender is Border border)
- {
- border.Background = new SolidColorBrush(Color.FromArgb(50, 255, 0, 0));
- }
- }
- private void Border_MouseLeave(object sender, MouseEventArgs e)
- {
- // 鼠标离开时恢复背景色
- if (sender is Border border)
- {
- border.Background = new SolidColorBrush(Colors.Transparent);
- }
- }
-
- private void Minimize_Click(object sender, MouseButtonEventArgs e)
- {
- this.WindowState = WindowState.Minimized;
- }
-
- private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- try
- {
- this.DragMove();
- }
- catch (InvalidOperationException ex)
- {
-
- }
- }
- }
- #endregion
-
- private void Close_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
- private void Ok_Click(object sender, RoutedEventArgs e)
- {
- if(DiamondCode.Text.Trim().Length>0) { this.Close(); }
- }
- private void ApplyCornerRadiusClip()
- {
- // 使用矩形几何生成圆角裁剪
- this.Border.Clip = new RectangleGeometry
- {
- Rect = new Rect(0, 0, this.Border.ActualWidth, this.Border.ActualHeight),
- RadiusX = this.Border.CornerRadius.TopLeft, // 使用 Border 的 CornerRadius
- RadiusY = this.Border.CornerRadius.TopLeft
- };
- }
- }
-}
diff --git a/Views/Dialog/StartDialog.xaml b/Views/Dialog/StartDialog.xaml
deleted file mode 100644
index c5edef6..0000000
--- a/Views/Dialog/StartDialog.xaml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Views/Dialog/StartDialog.xaml.cs b/Views/Dialog/StartDialog.xaml.cs
deleted file mode 100644
index a83c2d8..0000000
--- a/Views/Dialog/StartDialog.xaml.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using HandyControl.Controls;
-using SparkClient.Model.Helper;
-using SparkClient.ViewModel;
-using SparkClient.ViewModel.Dialog;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Media;
-
-
-namespace SparkClient.Views.Dialog
-{
- ///
- /// StartDialog.xaml 的交互逻辑
- ///
- public partial class StartDialog
- {
- public BaseViewModel ViewModel = null;
- public StartDialog()
- {
- WindowStartupLocation = WindowStartupLocation.CenterScreen;
- InitializeComponent();
- // 动态设置圆角裁剪
- this.Loaded += (s, e) => ApplyCornerRadiusClip();
- this.SizeChanged += (s, e) => ApplyCornerRadiusClip(); // 保证在大小改变时也裁剪
- this.Width = 562;
- this.Height = 222;
- this.ViewModel = new StartDialogVM();
- this.DataContext = this.ViewModel;
- }
- #region 重写窗体操作按钮
- private void Border_Minimize_MouseEnter(object sender, MouseEventArgs e)
- {
- // 鼠标进入时更改背景色
- if (sender is Border border)
- {
- border.Background = new SolidColorBrush(Color.FromArgb(50, 255, 255, 255));
- }
- }
- private void Border_Close_MouseEnter(object sender, MouseEventArgs e)
- {
- // 鼠标进入时更改背景色
- if (sender is Border border)
- {
- border.Background = new SolidColorBrush(Color.FromArgb(50, 255, 0, 0));
- }
- }
- private void Border_MouseLeave(object sender, MouseEventArgs e)
- {
- // 鼠标离开时恢复背景色
- if (sender is Border border)
- {
- border.Background = new SolidColorBrush(Colors.Transparent);
- }
- }
-
- private void Minimize_Click(object sender, MouseButtonEventArgs e)
- {
- this.WindowState = WindowState.Minimized;
- }
-
- private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- try
- {
- this.DragMove();
- }
- catch (InvalidOperationException ex)
- {
-
- }
- }
- }
- #endregion
-
- private void Close_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
- private void Ok_Click(object sender, RoutedEventArgs e)
- {
- if(Id.Text.Trim().Length>0) { this.Close(); }
- }
- private void ApplyCornerRadiusClip()
- {
- // 使用矩形几何生成圆角裁剪
- this.Border.Clip = new RectangleGeometry
- {
- Rect = new Rect(0, 0, this.Border.ActualWidth, this.Border.ActualHeight),
- RadiusX = this.Border.CornerRadius.TopLeft, // 使用 Border 的 CornerRadius
- RadiusY = this.Border.CornerRadius.TopLeft
- };
- }
- }
-}