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>
|
||||
[ObservableProperty] public partial bool CanInteract { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Можно ли снять изображение
|
||||
/// </summary>
|
||||
[ObservableProperty] public partial bool CanCapture { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Создаётся ли новая запись
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1206,6 +1219,15 @@ public partial class AnalysisViewModel : ViewModelBase
|
||||
CanInteract &= !InfoSectionIsScrolling;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обновить значение <see cref="CanCapture"/>
|
||||
/// </summary>
|
||||
private void UpdateCanCapture()
|
||||
{
|
||||
CanCapture = BrandComboBoxSelectedIndex >= 0;
|
||||
CanCapture &= SeparatorComboBoxSelectedIndex >= 0;
|
||||
}
|
||||
|
||||
// Команды управления меню
|
||||
/// <summary>
|
||||
/// Открыть меню
|
||||
|
||||
Reference in New Issue
Block a user