diff --git a/Language/zh_CN.xaml b/Language/zh_CN.xaml index 7c58419..bff7131 100644 --- a/Language/zh_CN.xaml +++ b/Language/zh_CN.xaml @@ -172,4 +172,15 @@ 退 出 系 统 如果忘记密码,请联系我们 + + 保存 + 导出 + DS + 标准 + 形状 + 冠部 + 亭部 + 重量(ct) + 切工等级 + 对称等级 \ No newline at end of file diff --git a/Resource/Document/log.txt b/Resource/Document/log.txt index d0a6a0b..bacd20b 100644 --- a/Resource/Document/log.txt +++ b/Resource/Document/log.txt @@ -24,3 +24,6 @@ [2024-12-18 17:25:38.182] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) [2024-12-19 08:50:34.643] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) [2024-12-19 08:54:45.576] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) +[2024-12-19 22:00:52.183] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) +[2024-12-19 22:01:00.827] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) +[2024-12-19 22:01:33.476] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) diff --git a/SparkClient.sln.DotSettings.user b/SparkClient.sln.DotSettings.user index 7fff9ad..bd477bf 100644 --- a/SparkClient.sln.DotSettings.user +++ b/SparkClient.sln.DotSettings.user @@ -32,6 +32,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded diff --git a/Views/BaseWindow/BaseControl.xaml b/Views/BaseWindow/BaseControl.xaml index 8a72716..e108de6 100644 --- a/Views/BaseWindow/BaseControl.xaml +++ b/Views/BaseWindow/BaseControl.xaml @@ -19,6 +19,14 @@ + + @@ -176,7 +184,7 @@ diff --git a/Views/Dialog/ExportDialog.xaml b/Views/Dialog/ExportDialog.xaml index 51c408f..8d61ef2 100644 --- a/Views/Dialog/ExportDialog.xaml +++ b/Views/Dialog/ExportDialog.xaml @@ -9,7 +9,7 @@ Title="ExportDialog" Height="450" Width="800" WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowState="Maximized"> - + @@ -18,7 +18,8 @@ - + diff --git a/Views/Dialog/LoadingDialog.xaml b/Views/Dialog/LoadingDialog.xaml index 3a84e9a..a38c642 100644 --- a/Views/Dialog/LoadingDialog.xaml +++ b/Views/Dialog/LoadingDialog.xaml @@ -8,7 +8,7 @@ Title="LoadingDialog" Height="450" Width="800" WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowState="Maximized"> - + @@ -16,8 +16,9 @@ - - + + diff --git a/Views/Dialog/LoadingDialog.xaml.cs b/Views/Dialog/LoadingDialog.xaml.cs index bd5746a..e63e01a 100644 --- a/Views/Dialog/LoadingDialog.xaml.cs +++ b/Views/Dialog/LoadingDialog.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -25,6 +26,7 @@ namespace SparkClient.Views.Dialog this.MinWidth = 1000; this.MinHeight = 1000; } + public void setValue(int i) { diff --git a/Views/Dialog/MessageBox.xaml b/Views/Dialog/MessageBox.xaml index 37df742..d2a6179 100644 --- a/Views/Dialog/MessageBox.xaml +++ b/Views/Dialog/MessageBox.xaml @@ -10,6 +10,16 @@ Background="Transparent" ResizeMode="NoResize" Title="MessageBox" Height="Auto" Width="600"> + + + + + + + + + + + + + + + @@ -19,140 +52,488 @@ + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + - - + + + - - - - - - - - - - - - + + + + + + + + - - + + + - - - - - - - - - - - - + + + + + + + + - - + + + - + + + + + + + + - - + + + - + + + + + + + + - - + + + - + + + + + + + + + + - - + + + - + + + + + + + + + + - - + + - - - - - - - - - - - - - - + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + - + + + + @@ -160,205 +541,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -366,33 +551,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Views/Grading/GradingResult.xaml.cs b/Views/Grading/GradingResult.xaml.cs index b9516f0..3d6308b 100644 --- a/Views/Grading/GradingResult.xaml.cs +++ b/Views/Grading/GradingResult.xaml.cs @@ -1,7 +1,9 @@ using System.Windows; using System.Windows.Controls; +using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Imaging; using SparkClient.ViewModel.Grading; using GeometryModel3D = HelixToolkit.Wpf.SharpDX.GeometryModel3D; @@ -11,9 +13,14 @@ public partial class GradingResult { // List triangles = new List(); List mouseAddModels = new List(); + // 用于记录当前所有已存在的Popup + private List _allPopups = new List(); public GradingResult() { InitializeComponent(); + + // 在Window最外层捕获鼠标点击,判断是否点击在Popup之外,如果是则关闭所有Popup + this.PreviewMouseLeftButtonDown += Window_PreviewMouseLeftButtonDown; //DataContext = new GradingResultVM(null); @@ -121,37 +128,37 @@ public partial class GradingResult d.ChangeSym(null); } - private void dataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) - { - detailPopup.IsOpen = false; - // 获取点击的目标元素 - var element = sender as FrameworkElement; - - var cell = FindVisualParent(element); - if (cell == null) return; - - var row = FindVisualParent(cell); - if (row == null) return; - - if (element != null) - { - // 将 firstCell 的边界转换为屏幕坐标系 - var firstCellBounds = cell.PointToScreen(new Point(0, 0)); - - // 计算Popup的位置 - var popupPosition = new Point(firstCellBounds.X + cell.RenderSize.Width, firstCellBounds.Y + cell.RenderSize.Height); - var selectObject = row.Item as DataInfo; - string testItemId = selectObject.TestItemId; - var d = DataContext as GradingResultVM; - RowDetail rowDetail = d.getSelectData(testItemId); - // 设置Popup的位置 - detailPopup.HorizontalOffset = popupPosition.X; - detailPopup.VerticalOffset = popupPosition.Y; - detailPopup.IsOpen = true; - RowDetail.Items.Clear(); - RowDetail.Items.Add(rowDetail); - } - } + // private void dataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) + // { + // detailPopup.IsOpen = false; + // // 获取点击的目标元素 + // var element = sender as FrameworkElement; + // + // var cell = FindVisualParent(element); + // if (cell == null) return; + // + // var row = FindVisualParent(cell); + // if (row == null) return; + // + // if (element != null) + // { + // // 将 firstCell 的边界转换为屏幕坐标系 + // var firstCellBounds = cell.PointToScreen(new Point(0, 0)); + // + // // 计算Popup的位置 + // var popupPosition = new Point(firstCellBounds.X + cell.RenderSize.Width, firstCellBounds.Y + cell.RenderSize.Height); + // var selectObject = row.Item as DataInfo; + // string testItemId = selectObject.TestItemId; + // var d = DataContext as GradingResultVM; + // RowDetail rowDetail = d.getSelectData(testItemId); + // // 设置Popup的位置 + // detailPopup.HorizontalOffset = popupPosition.X; + // detailPopup.VerticalOffset = popupPosition.Y; + // detailPopup.IsOpen = true; + // RowDetail.Items.Clear(); + // RowDetail.Items.Add(rowDetail); + // } + // } // 辅助方法:查找父元素 private T FindVisualParent(DependencyObject child) where T : DependencyObject { @@ -167,13 +174,116 @@ public partial class GradingResult return FindVisualParent(parentObject); } } - private void Window_MouseDown(object sender, MouseButtonEventArgs e) + // private void Window_MouseDown(object sender, MouseButtonEventArgs e) + // { + // detailPopup.IsOpen = false; + // } + // + // private void Window_MouseDown(object sender, RoutedEventArgs e) + // { + // detailPopup.IsOpen = false; + // } + + + private void ClickArea_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + var border = sender as Border; + if (border == null) return; + + var parentGrid = border.Parent as Grid; + if (parentGrid == null) return; + + var popup = parentGrid.FindName("RowPopup") as Popup; + if (popup == null) return; + + // 先关闭所有已显示的 Popup + CloseAllPopups(); + + // 将此Popup记录到集合中,并打开 + if (!_allPopups.Contains(popup)) + { + _allPopups.Add(popup); + } + + // 显示新Popup + popup.IsOpen = true; + popup.Visibility = Visibility.Visible; + } + + private void CloseAllPopups() + { + foreach (var p in _allPopups) + { + p.IsOpen = false; + p.Visibility = Visibility.Collapsed; + } + } + + private void CloseAllPopup_Click(object sender, RoutedEventArgs e) + { + CloseAllPopups(); + } + + private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + // originalSource 是点击处的控件 + var clickedElement = e.OriginalSource as DependencyObject; + + // 遍历所有已知 Popup + bool isClickOnAnyPopup = false; + foreach (var p in _allPopups) + { + // 如果此 Popup 不可见或未打开,就不用检查了 + if (!p.IsOpen) + continue; + + // 判断点击处是否在此 Popup 内 + if (IsDescendantOf(p.Child, clickedElement)) + { + // 找到一个 Popup 包含这个点击 + isClickOnAnyPopup = true; + break; + } + } + + // 如果没点击到任何 Popup,就关闭全部 + if (!isClickOnAnyPopup) + { + CloseAllPopups(); + } + } + private bool IsDescendantOf(DependencyObject parent, DependencyObject clicked) + { + if (parent == null || clicked == null) + return false; + + // 从 clicked 开始不断向上找 VisualTree + var current = clicked; + while (current != null) + { + if (current == parent) + { + return true; + } + current = VisualTreeHelper.GetParent(current); + } + return false; + } + + + private void UIElement_OnMouseLeave(object sender, MouseEventArgs e) { - detailPopup.IsOpen = false; + if (sender is Image image) + { + image.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/UIResource/01-8.png")); + } } - private void Window_MouseDown(object sender, RoutedEventArgs e) + private void UIElement_OnMouseEnter(object sender, MouseEventArgs e) { - detailPopup.IsOpen = false; + if (sender is Image image) + { + image.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/UIResource/01-8-1.png")); + } } } \ No newline at end of file