From 1b221173ea8f6648db49fb499eee5cefaf12ba8e Mon Sep 17 00:00:00 2001 From: sunhonglei Date: Fri, 10 Jan 2025 12:53:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=AE=9A=E7=BA=A7=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=94=BB=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ViewModel/Configuration/LevelConfigVM.cs | 9 ++++++++- Views/Configuration/LevelConfigPage.xaml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ViewModel/Configuration/LevelConfigVM.cs b/ViewModel/Configuration/LevelConfigVM.cs index 0aa326d..1e56e33 100644 --- a/ViewModel/Configuration/LevelConfigVM.cs +++ b/ViewModel/Configuration/LevelConfigVM.cs @@ -41,6 +41,8 @@ public class LevelConfigVM : BaseViewModel public bool InstitutesEnabled { get { return _institutesEnabled; } set { _institutesEnabled = value; OnPropertyChanged("InstitutesEnabled"); } } private bool _shapesEnabled = true; public bool ShapesEnabled { get { return _shapesEnabled; } set { _shapesEnabled = value; OnPropertyChanged("ShapesEnabled"); } } + private bool _isUpdateButtonEnabled; + public bool IsUpdateButtonEnabled { get { return _isUpdateButtonEnabled; } set { _isUpdateButtonEnabled = value; OnPropertyChanged("IsUpdateButtonEnabled"); } } JsonEntity jsonEntity = new JsonEntity(); @@ -61,6 +63,7 @@ public class LevelConfigVM : BaseViewModel SaveLevelConfigCommand = new RelayCommand(SaveLevelConfig); InitLevelConfig(null); InitData(); + IsUpdateButtonEnabled = false; } /// @@ -482,6 +485,7 @@ public class LevelConfigVM : BaseViewModel { InstitutesEnabled = false; ShapesEnabled = false; + IsUpdateButtonEnabled = true; Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.Filter = "Text files (*.enc)|*.enc|All files (*.*)|*.*"; jsonEntity = null; @@ -499,6 +503,9 @@ public class LevelConfigVM : BaseViewModel { InstitutesEnabled = true; ShapesEnabled = true; + IsUpdateButtonEnabled = false; + InitData(); + ChangeShapeModel(""); return; } if (jsonEntity != null) @@ -571,7 +578,7 @@ public class LevelConfigVM : BaseViewModel public void ChangeShapeModel(object param) { if (ShapeId!= null && ShapeId != string.Empty) { - setInstitutes(ShapeId); + InstituteId = setInstitutes(ShapeId); } } diff --git a/Views/Configuration/LevelConfigPage.xaml b/Views/Configuration/LevelConfigPage.xaml index 5859b74..9cb51c1 100644 --- a/Views/Configuration/LevelConfigPage.xaml +++ b/Views/Configuration/LevelConfigPage.xaml @@ -104,7 +104,7 @@ SelectionChanged="ChangeShapes" FontSize="16" Background="Transparent" BorderThickness="0" IsEnabled="{Binding ShapesEnabled,Mode=TwoWay}" BorderBrush="Black"/> -