From 44801dce5a36dd99b19cf87568695268bbfedd84 Mon Sep 17 00:00:00 2001 From: THINKPAD Date: Fri, 2 Sep 2022 10:22:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=9A=90=E8=97=8F=20RecipeEd?= =?UTF-8?q?itor=20=E5=8F=82=E6=95=B0=E5=80=BC=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=82=E5=8F=82=E6=95=B0=E5=80=BC=E9=9A=90=E8=97=8F=E5=90=8E?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=BA=E2=80=9C***=E2=80=9D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RecipeModel/Params/DoubleParam.cs | 17 +++++ .../RecipeModel/Params/IParam.cs | 15 +++- .../RecipeModel/Params/Param.cs | 19 ++++- .../RecipeModel/Params/StepParam.cs | 21 +++--- .../RecipeModel/Params/StringParam.cs | 20 ++++++ .../RecipeEditorLib/RecipeModel/RecipeStep.cs | 17 +++++ .../RecipeModel/RecipeStepCollection.cs | 15 ++++ .../Converters/ParamValueDisplayConverter.cs | 30 ++++++++ ...RecipeEditorValidationDetailWindow.xaml.cs | 7 +- .../RecipeEditors/RecipeEditorView.xaml | 69 ++++++++++++++++++- .../RecipeEditors/RecipeEditorViewModel.cs | 5 ++ SicUI/SicUI.csproj | 1 + 12 files changed, 213 insertions(+), 23 deletions(-) create mode 100644 SicUI/Models/RecipeEditors/Converters/ParamValueDisplayConverter.cs diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/DoubleParam.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/DoubleParam.cs index 587566a..91405af 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/DoubleParam.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/DoubleParam.cs @@ -42,6 +42,23 @@ /// public string Placeholder { get; } + + public override bool IsHideValue + { + get + { + if (Name == RecipColNo.Time.ToString()) + return false; + + return _isHideValue; + } + set + { + _isHideValue = value; + NotifyOfPropertyChange(nameof(IsHideValue)); + } + } + public int Resolution { get => _resolution; diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/IParam.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/IParam.cs index d298d37..ec2bc11 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/IParam.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/IParam.cs @@ -22,8 +22,14 @@ namespace RecipeEditorLib.RecipeModel.Params /// RecipeStep Parent { get; } + /// + /// 当前参数在表格中的所属行。 + /// DataGridRow RowOwner { get; set; } + /// + /// 当前参数在表格中的所属列。 + /// DataGridColumn ColumnOwner { get; set; } /// @@ -60,6 +66,11 @@ namespace RecipeEditorLib.RecipeModel.Params /// 返回是否高亮显示当前参数。 /// bool IsHighlighted { get; } + + /// + /// 返回是否隐藏参数的值。 + /// + bool IsHideValue { get; set; } #endregion @@ -86,12 +97,12 @@ namespace RecipeEditorLib.RecipeModel.Params /// /// object GetValue(); - + /// /// 高亮显示当前参数。 /// void Highlight(); - + /// /// 取消高亮显示。 /// diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/Param.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/Param.cs index 13f3a6a..41eac59 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/Param.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/Param.cs @@ -20,7 +20,8 @@ namespace RecipeEditorLib.RecipeModel.Params protected bool _isValidated; protected string _validationError; protected bool _isEqualsToPrevious; - private bool _isHighlighted; + protected bool _isHighlighted; + protected bool _isHideValue; #endregion @@ -35,6 +36,7 @@ namespace RecipeEditorLib.RecipeModel.Params _isEqualsToPrevious = true; _visibility = Visibility.Visible; _isHighlighted = false; + _isHideValue = false; } #endregion @@ -162,6 +164,19 @@ namespace RecipeEditorLib.RecipeModel.Params } } + /// + /// 返回是否隐藏参数的值。 + /// + public virtual bool IsHideValue + { + get => _isHideValue; + set + { + _isHideValue = value; + NotifyOfPropertyChange(nameof(IsHideValue)); + } + } + public bool IsColumnSelected { @@ -188,7 +203,7 @@ namespace RecipeEditorLib.RecipeModel.Params public bool EnableTolerance { get; set; } public Visibility StepCheckVisibility { get; set; } - + /// /// 高亮显示当前参数。 /// diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StepParam.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StepParam.cs index 5bb3117..9402263 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StepParam.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StepParam.cs @@ -22,19 +22,14 @@ #region Properties - ///// - ///// 注意StepParam的Value改变时不改变IsSaved属性。 - ///// - //public override string Value - //{ - // get => _value; - // set - // { - // _value = value; - // NotifyOfPropertyChange(nameof(Value)); - // } - //} - + public override bool IsHideValue + { + get => false; + set + { + + } + } public bool IsChecked { diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StringParam.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StringParam.cs index 946d35c..19e01fa 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StringParam.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/Params/StringParam.cs @@ -13,5 +13,25 @@ } #endregion + + #region Properties + + public override bool IsHideValue + { + get + { + if (Name == RecipColNo.Name.ToString()) + return false; + + return _isHideValue; + } + set + { + _isHideValue = value; + NotifyOfPropertyChange(nameof(IsHideValue)); + } + } + + #endregion } } diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStep.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStep.cs index 9a9031a..5a0ed1a 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStep.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStep.cs @@ -2,6 +2,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; +using SciChart.Core.Extensions; namespace RecipeEditorLib.RecipeModel.Params { @@ -15,6 +16,9 @@ namespace RecipeEditorLib.RecipeModel.Params #region Variables + private bool _isHideValue; + + /// /// 当配方步骤的IsSaved属性发生变化时,触发此事件。 /// @@ -85,6 +89,19 @@ namespace RecipeEditorLib.RecipeModel.Params /// public RecipeStep Next { get; private set;} + /// + /// 返回是否隐藏当前步骤的参数值。 + /// + public bool IsHideValue + { + get => _isHideValue; + set + { + _isHideValue = value; + this.ToList().ForEach(x => x.IsHideValue = value); + } + } + #endregion #region Methods diff --git a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs index 2e9ba07..2fae267 100644 --- a/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs +++ b/FrameworkLocal/UIClient/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs @@ -12,6 +12,7 @@ namespace RecipeEditorLib.RecipeModel.Params #region Variables private bool _isSaved; + private bool _isHideValue; #endregion @@ -50,6 +51,20 @@ namespace RecipeEditorLib.RecipeModel.Params public IReadOnlyList SelectedSteps => this.ToList().Where(x => x.StepNoParam != null && x.StepNoParam.IsChecked).ToList(); + + /// + /// 返回是否隐藏所有步骤的参数值。 + /// + public bool IsHideValue + { + get => _isHideValue; + set + { + _isHideValue = value; + this.ToList().ForEach(x => x.IsHideValue = value); + } + } + #endregion #region Methods diff --git a/SicUI/Models/RecipeEditors/Converters/ParamValueDisplayConverter.cs b/SicUI/Models/RecipeEditors/Converters/ParamValueDisplayConverter.cs new file mode 100644 index 0000000..f960dff --- /dev/null +++ b/SicUI/Models/RecipeEditors/Converters/ParamValueDisplayConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Globalization; +using System.Windows.Data; + +namespace SicUI.Models.RecipeEditors +{ + internal class ParamValueDisplayConverter : IMultiValueConverter + { + public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture) + { + // value[0] must be Param.Value + // value[1] must be Param.IsHideValue + if (value == null || value.Length != 2) + return value; + + if (value[1] is bool isHideValue) + { + return isHideValue ? "***" : value[0].ToString(); + } + + return value[0]; + + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/SicUI/Models/RecipeEditors/RecipeEditorValidationDetailWindow.xaml.cs b/SicUI/Models/RecipeEditors/RecipeEditorValidationDetailWindow.xaml.cs index 743cb3d..aa5f84c 100644 --- a/SicUI/Models/RecipeEditors/RecipeEditorValidationDetailWindow.xaml.cs +++ b/SicUI/Models/RecipeEditors/RecipeEditorValidationDetailWindow.xaml.cs @@ -16,18 +16,17 @@ namespace SicUI { InitializeComponent(); - Loaded += OnLoaded; + SourceInitialized += OnSourceInitialized; Closed += OnClosed; } - private void OnLoaded(object sender, RoutedEventArgs e) + private void OnSourceInitialized(object sender, EventArgs e) { var desktopWorkingArea = SystemParameters.WorkArea; Left = desktopWorkingArea.Right - Width; Top = desktopWorkingArea.Bottom - Height; } - - + private void EventSetter_OnHandler(object sender, MouseButtonEventArgs e) { if (!(DataContext is RecipeEditorViewModel vm)) diff --git a/SicUI/Models/RecipeEditors/RecipeEditorView.xaml b/SicUI/Models/RecipeEditors/RecipeEditorView.xaml index 8cba282..56faa2e 100644 --- a/SicUI/Models/RecipeEditors/RecipeEditorView.xaml +++ b/SicUI/Models/RecipeEditors/RecipeEditorView.xaml @@ -11,18 +11,36 @@ xmlns:egc="clr-namespace:ExtendedGrid.Microsoft.Windows.Controls;assembly=MECF.Framework.UI.Client" xmlns:micro="clr-namespace:Caliburn.Micro;assembly=MECF.Framework.UI.Client" xmlns:recipeEditors="clr-namespace:SicUI.Models.RecipeEditors" - xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" d:DesignHeight="900" d:DesignWidth="1500" mc:Ignorable="d"> + + M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7 + ,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 + 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z + + + + M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 + 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 + 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 + 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 + 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 + 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 + 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 + 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z + + + +