Кнопка обновления и столбец актуального значения
This commit is contained in:
@@ -17,6 +17,7 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
IsCustom = row.IsCustom;
|
||||
_service = service;
|
||||
ApplySnapshot(row, suppressSave: true);
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
}
|
||||
|
||||
public string Field { get; }
|
||||
@@ -28,10 +29,16 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _isPersistedInUserStore;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _actualValue = string.Empty;
|
||||
|
||||
public string ActualValueDisplay =>
|
||||
string.IsNullOrEmpty(ActualValue) ? "<нет>" : ActualValue;
|
||||
|
||||
public string UserStoreBadge => IsPersistedInUserStore ? "USER" : string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _value = string.Empty;
|
||||
private string _requiredValue = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _comment = string.Empty;
|
||||
@@ -43,30 +50,9 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
RowAppearanceChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public event EventHandler? RowAppearanceChanged;
|
||||
partial void OnActualValueChanged(string value) => OnPropertyChanged(nameof(ActualValueDisplay));
|
||||
|
||||
public void ApplySnapshot(EnvironmentVariableRow row, bool suppressSave = false)
|
||||
{
|
||||
if (suppressSave)
|
||||
{
|
||||
BeginLoad();
|
||||
}
|
||||
|
||||
Value = row.Value;
|
||||
Comment = row.Comment;
|
||||
IsPersistedInUserStore = row.IsPersistedInUserStore;
|
||||
|
||||
if (suppressSave)
|
||||
{
|
||||
EndLoad();
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginLoad() => _isLoading = true;
|
||||
|
||||
public void EndLoad() => _isLoading = false;
|
||||
|
||||
partial void OnValueChanged(string value)
|
||||
partial void OnRequiredValueChanged(string value)
|
||||
{
|
||||
if (_isLoading)
|
||||
{
|
||||
@@ -78,8 +64,38 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
{
|
||||
IsPersistedInUserStore = true;
|
||||
}
|
||||
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
}
|
||||
|
||||
public event EventHandler? RowAppearanceChanged;
|
||||
|
||||
public void ApplySnapshot(EnvironmentVariableRow row, bool suppressSave = false)
|
||||
{
|
||||
if (suppressSave)
|
||||
{
|
||||
BeginLoad();
|
||||
}
|
||||
|
||||
RequiredValue = row.Value;
|
||||
Comment = row.Comment;
|
||||
IsPersistedInUserStore = row.IsPersistedInUserStore;
|
||||
|
||||
if (suppressSave)
|
||||
{
|
||||
EndLoad();
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshActualValue(string? processValue)
|
||||
{
|
||||
ActualValue = processValue ?? string.Empty;
|
||||
}
|
||||
|
||||
public void BeginLoad() => _isLoading = true;
|
||||
|
||||
public void EndLoad() => _isLoading = false;
|
||||
|
||||
partial void OnCommentChanged(string value)
|
||||
{
|
||||
if (_isLoading)
|
||||
@@ -103,8 +119,9 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
_service.DeleteFromUserStore(Field);
|
||||
BeginLoad();
|
||||
IsPersistedInUserStore = false;
|
||||
Value = _service.GetDisplayValue(Field);
|
||||
RequiredValue = _service.GetDisplayValue(Field);
|
||||
EndLoad();
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
}
|
||||
|
||||
public event EventHandler? Removed;
|
||||
|
||||
Reference in New Issue
Block a user