WPF реализация
This commit is contained in:
@@ -21,6 +21,7 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
_service = service;
|
||||
_onCustomRemoved = onCustomRemoved;
|
||||
ApplySnapshot(row, suppressSave: true);
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
}
|
||||
|
||||
public string Field { get; }
|
||||
@@ -34,6 +35,12 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _useUserStore;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _actualValue = string.Empty;
|
||||
|
||||
public string ActualValueDisplay =>
|
||||
string.IsNullOrEmpty(ActualValue) ? "<нет>" : ActualValue;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _requiredValue = string.Empty;
|
||||
|
||||
@@ -60,6 +67,7 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
if (value)
|
||||
{
|
||||
_service.SaveValue(Field, RequiredValue);
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,8 +82,11 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
BeginLoad();
|
||||
RequiredValue = _service.GetDisplayValue(Field);
|
||||
EndLoad();
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
}
|
||||
|
||||
partial void OnActualValueChanged(string value) => OnPropertyChanged(nameof(ActualValueDisplay));
|
||||
|
||||
partial void OnRequiredValueChanged(string value)
|
||||
{
|
||||
if (_isLoading || !UseUserStore)
|
||||
@@ -84,6 +95,7 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
}
|
||||
|
||||
_service.SaveValue(Field, value);
|
||||
RefreshActualValue(_service.GetProcessValue(Field));
|
||||
}
|
||||
|
||||
public event EventHandler? RowAppearanceChanged;
|
||||
@@ -105,6 +117,11 @@ public sealed partial class EnvironmentVariableRowViewModel : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshActualValue(string? processValue)
|
||||
{
|
||||
ActualValue = processValue ?? string.Empty;
|
||||
}
|
||||
|
||||
public void BeginLoad() => _isLoading = true;
|
||||
|
||||
public void EndLoad() => _isLoading = false;
|
||||
|
||||
Reference in New Issue
Block a user