diff --git a/GSS2/ViewModels/AmineContent/AnalysisViewModel.cs b/GSS2/ViewModels/AmineContent/AnalysisViewModel.cs index 539ae81..62ad96e 100644 --- a/GSS2/ViewModels/AmineContent/AnalysisViewModel.cs +++ b/GSS2/ViewModels/AmineContent/AnalysisViewModel.cs @@ -839,6 +839,11 @@ public partial class AnalysisViewModel : ViewModelBase /// [ObservableProperty] public partial bool CanInteract { get; set; } = true; + /// + /// Можно ли снять изображение + /// + [ObservableProperty] public partial bool CanCapture { get; set; } = true; + /// /// Создаётся ли новая запись /// @@ -995,6 +1000,9 @@ public partial class AnalysisViewModel : ViewModelBase ea.PropertyName == nameof(MainSectionIsScrolling) || ea.PropertyName == nameof(InfoSectionIsScrolling)) UpdateCanInteract(); + if (ea.PropertyName == nameof(BrandComboBoxSelectedIndex) || + ea.PropertyName == nameof(SeparatorComboBoxSelectedIndex)) + UpdateCanCapture(); if (ea.PropertyName == nameof(MenuSelectedIndex) || ea.PropertyName == nameof(InfoSectionCurrentIndex)) UpdateCharts?.Invoke(this, EventArgs.Empty); @@ -1082,6 +1090,8 @@ public partial class AnalysisViewModel : ViewModelBase // Вычисляем дополнительные свойства Record.CalculateProperties(); + CanCapture = false; + return; } @@ -1116,6 +1126,9 @@ public partial class AnalysisViewModel : ViewModelBase IsNewRecord = true; // Вычисляем дополнительные свойства Record.CalculateProperties(); + + BrandComboBoxSelectedIndex = -1; + SeparatorComboBoxSelectedIndex = -1; } /// @@ -1206,6 +1219,15 @@ public partial class AnalysisViewModel : ViewModelBase CanInteract &= !InfoSectionIsScrolling; } + /// + /// Обновить значение + /// + private void UpdateCanCapture() + { + CanCapture = BrandComboBoxSelectedIndex >= 0; + CanCapture &= SeparatorComboBoxSelectedIndex >= 0; + } + // Команды управления меню /// /// Открыть меню diff --git a/GSS2/Views/AmineContent/AnalysisView.axaml b/GSS2/Views/AmineContent/AnalysisView.axaml index ecdaf6a..e13c912 100644 --- a/GSS2/Views/AmineContent/AnalysisView.axaml +++ b/GSS2/Views/AmineContent/AnalysisView.axaml @@ -161,6 +161,7 @@ Grid.Row="3" HorizontalAlignment="Stretch" IsEditable="False" + IsEnabled="{Binding CanInteract}" IsVisible="{Binding IsNewRecord}" ItemsSource="{Binding SeparatorComboBoxItems}" PlaceholderText="Тип сепаратора" @@ -201,6 +202,7 @@ Grid.Row="3" HorizontalAlignment="Stretch" IsEditable="False" + IsEnabled="{Binding CanInteract}" IsVisible="{Binding IsNewRecord}" ItemsSource="{Binding BrandComboBoxItems}" PlaceholderText="Марка пробы" @@ -1091,6 +1093,7 @@ Command="{Binding CaptureImageCommand}" Grid.Row="1" HorizontalAlignment="Stretch" + IsEnabled="{Binding CanCapture}" IsVisible="{Binding !ImagesIsCapturing}" >