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; } /// <summary> @@ -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"/> </Border> - <Button Grid.Column="2" Grid.Row="0" Width="100" Margin="10 5 " Padding="0" Height="50" + <Button Grid.Column="2" Grid.Row="0" Width="100" Margin="10 5 " Padding="0" Height="50" IsEnabled="{Binding IsUpdateButtonEnabled}" BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding SaveLevelConfigCommand}"> <Border HorizontalAlignment="Center" VerticalAlignment="Center"