From d1046f7898786d98f4667adf7b4a2228998b33dd Mon Sep 17 00:00:00 2001 From: hrpzcf <58855572+hrpzcf@users.noreply.github.com> Date: Sun, 31 Dec 2023 17:32:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E3=80=90=E8=BE=93=E5=87=BA=E6=96=B9=E5=BC=8F=E3=80=91=E5=88=97?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E9=87=8D=E6=96=B0=E6=98=BE=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=96=B9=E5=BC=8F=E5=88=97=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=A1=86=E5=8F=98=E4=B8=BA=E6=9C=AA=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E7=8A=B6=E6=80=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HashCalculator/ViewModels/HashViewModel.cs | 7 ------- HashCalculator/ViewModels/SettingsViewModel.cs | 10 +++++++++- HashCalculator/Views/MainWindow.xaml | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/HashCalculator/ViewModels/HashViewModel.cs b/HashCalculator/ViewModels/HashViewModel.cs index c32507df..a1fcf361 100644 --- a/HashCalculator/ViewModels/HashViewModel.cs +++ b/HashCalculator/ViewModels/HashViewModel.cs @@ -425,13 +425,6 @@ public ICommand ShowHashDetailsWindowCmd } } - public GenericItemModel[] AvailableOutputTypes { get; } = - { - new GenericItemModel("Base64", OutputType.BASE64), - new GenericItemModel("Hex大写", OutputType.BinaryUpper), - new GenericItemModel("Hex小写", OutputType.BinaryLower), - }; - private void MakeSureAlgoModelArrayNotEmpty() { if (!this.AlgoInOutModels?.Any() ?? true) diff --git a/HashCalculator/ViewModels/SettingsViewModel.cs b/HashCalculator/ViewModels/SettingsViewModel.cs index 59d5642d..39786de5 100644 --- a/HashCalculator/ViewModels/SettingsViewModel.cs +++ b/HashCalculator/ViewModels/SettingsViewModel.cs @@ -795,7 +795,15 @@ public ICommand OpenEditContextMenuCmd } [XmlIgnore] - public GenericItemModel[] AvailableOutputTypes { get; } = + public static GenericItemModel[] AvailableOutputTypes { get; } = + { + new GenericItemModel("Base64", OutputType.BASE64), + new GenericItemModel("Hex大写", OutputType.BinaryUpper), + new GenericItemModel("Hex小写", OutputType.BinaryLower), + }; + + [XmlIgnore] + public static GenericItemModel[] AvailableOutputTypesLong { get; } = { new GenericItemModel("Base64 格式", OutputType.BASE64), new GenericItemModel("十六进制大写", OutputType.BinaryUpper), diff --git a/HashCalculator/Views/MainWindow.xaml b/HashCalculator/Views/MainWindow.xaml index 4c6e1902..7443f9dd 100644 --- a/HashCalculator/Views/MainWindow.xaml +++ b/HashCalculator/Views/MainWindow.xaml @@ -92,7 +92,7 @@ Width="110" VerticalAlignment="Center" DisplayMemberPath="Display" - ItemsSource="{Binding Source={x:Static local:Settings.Current}, Path=AvailableOutputTypes}" + ItemsSource="{Binding Path=(local:SettingsViewModel.AvailableOutputTypesLong)}" SelectedValue="{Binding Source={x:Static local:Settings.Current}, Path=SelectedOutputType}" SelectedValuePath="ItemValue" Style="{StaticResource ComboBoxStyle1}" @@ -589,7 +589,7 @@ Margin="2" VerticalAlignment="Center" DisplayMemberPath="Display" - ItemsSource="{Binding AvailableOutputTypes}" + ItemsSource="{Binding Path=(local:SettingsViewModel.AvailableOutputTypes)}" SelectedValue="{Binding SelectedOutputType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="ItemValue" Style="{StaticResource ComboBoxStyle2}"