forked from amkovkov/GranuSightSoftware2
feat: disable analysis buttons
capture button enabled when all combobox filled combobox buttons enabled when can interact
This commit is contained in:
@@ -839,6 +839,11 @@ public partial class AnalysisViewModel : ViewModelBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ObservableProperty] public partial bool CanInteract { get; set; } = true;
|
[ObservableProperty] public partial bool CanInteract { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Можно ли снять изображение
|
||||||
|
/// </summary>
|
||||||
|
[ObservableProperty] public partial bool CanCapture { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Создаётся ли новая запись
|
/// Создаётся ли новая запись
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -995,6 +1000,9 @@ public partial class AnalysisViewModel : ViewModelBase
|
|||||||
ea.PropertyName == nameof(MainSectionIsScrolling) ||
|
ea.PropertyName == nameof(MainSectionIsScrolling) ||
|
||||||
ea.PropertyName == nameof(InfoSectionIsScrolling))
|
ea.PropertyName == nameof(InfoSectionIsScrolling))
|
||||||
UpdateCanInteract();
|
UpdateCanInteract();
|
||||||
|
if (ea.PropertyName == nameof(BrandComboBoxSelectedIndex) ||
|
||||||
|
ea.PropertyName == nameof(SeparatorComboBoxSelectedIndex))
|
||||||
|
UpdateCanCapture();
|
||||||
if (ea.PropertyName == nameof(MenuSelectedIndex) ||
|
if (ea.PropertyName == nameof(MenuSelectedIndex) ||
|
||||||
ea.PropertyName == nameof(InfoSectionCurrentIndex))
|
ea.PropertyName == nameof(InfoSectionCurrentIndex))
|
||||||
UpdateCharts?.Invoke(this, EventArgs.Empty);
|
UpdateCharts?.Invoke(this, EventArgs.Empty);
|
||||||
@@ -1082,6 +1090,8 @@ public partial class AnalysisViewModel : ViewModelBase
|
|||||||
// Вычисляем дополнительные свойства
|
// Вычисляем дополнительные свойства
|
||||||
Record.CalculateProperties();
|
Record.CalculateProperties();
|
||||||
|
|
||||||
|
CanCapture = false;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1116,6 +1126,9 @@ public partial class AnalysisViewModel : ViewModelBase
|
|||||||
IsNewRecord = true;
|
IsNewRecord = true;
|
||||||
// Вычисляем дополнительные свойства
|
// Вычисляем дополнительные свойства
|
||||||
Record.CalculateProperties();
|
Record.CalculateProperties();
|
||||||
|
|
||||||
|
BrandComboBoxSelectedIndex = -1;
|
||||||
|
SeparatorComboBoxSelectedIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1206,6 +1219,15 @@ public partial class AnalysisViewModel : ViewModelBase
|
|||||||
CanInteract &= !InfoSectionIsScrolling;
|
CanInteract &= !InfoSectionIsScrolling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обновить значение <see cref="CanCapture"/>
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateCanCapture()
|
||||||
|
{
|
||||||
|
CanCapture = BrandComboBoxSelectedIndex >= 0;
|
||||||
|
CanCapture &= SeparatorComboBoxSelectedIndex >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Команды управления меню
|
// Команды управления меню
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Открыть меню
|
/// Открыть меню
|
||||||
|
|||||||
@@ -161,6 +161,7 @@
|
|||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
IsEditable="False"
|
IsEditable="False"
|
||||||
|
IsEnabled="{Binding CanInteract}"
|
||||||
IsVisible="{Binding IsNewRecord}"
|
IsVisible="{Binding IsNewRecord}"
|
||||||
ItemsSource="{Binding SeparatorComboBoxItems}"
|
ItemsSource="{Binding SeparatorComboBoxItems}"
|
||||||
PlaceholderText="Тип сепаратора"
|
PlaceholderText="Тип сепаратора"
|
||||||
@@ -201,6 +202,7 @@
|
|||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
IsEditable="False"
|
IsEditable="False"
|
||||||
|
IsEnabled="{Binding CanInteract}"
|
||||||
IsVisible="{Binding IsNewRecord}"
|
IsVisible="{Binding IsNewRecord}"
|
||||||
ItemsSource="{Binding BrandComboBoxItems}"
|
ItemsSource="{Binding BrandComboBoxItems}"
|
||||||
PlaceholderText="Марка пробы"
|
PlaceholderText="Марка пробы"
|
||||||
@@ -1091,6 +1093,7 @@
|
|||||||
Command="{Binding CaptureImageCommand}"
|
Command="{Binding CaptureImageCommand}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
|
IsEnabled="{Binding CanCapture}"
|
||||||
IsVisible="{Binding !ImagesIsCapturing}"
|
IsVisible="{Binding !ImagesIsCapturing}"
|
||||||
>
|
>
|
||||||
<TextBlock Text="Получить изображения"/>
|
<TextBlock Text="Получить изображения"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user