diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-23 10:30:57 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-23 10:30:57 +0300 |
| commit | 4c1db0cbded45ed962c4402e466409d1c9bb8bbd (patch) | |
| tree | 7322669f10e9a298c5e06fbce7e701c7bbca458b /Software | |
| parent | 6a57fbce8bf9931ecfd03c6e91f2fb25be4e7d9f (diff) | |
| download | Tango-4c1db0cbded45ed962c4402e466409d1c9bb8bbd.tar.gz Tango-4c1db0cbded45ed962c4402e466409d1c9bb8bbd.zip | |
Added IsBusy to base ViewModel.
Diffstat (limited to 'Software')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index d4f26c79d..421e098ce 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -23,7 +23,6 @@ namespace Tango.SharedUI public abstract class ViewModel : ExtendedObject, INotifyDataErrorInfo { private List<KeyValuePair<String, String>> _currentErrors = new List<KeyValuePair<string, string>>(); //Holds the current validation errors. - private bool _isFreeSet; private bool _hasErrors; /// <summary> @@ -35,14 +34,23 @@ namespace Tango.SharedUI set { _hasErrors = value; RaisePropertyChangedAuto(); } } - private bool _isFree; + private bool _isBusy; + /// <summary> + /// Gets or sets a value indicating whether this view model is currently busy doing operations. + /// </summary> + public bool IsBusy + { + get { return _isBusy; } + set { _isBusy = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsFree)); InvalidateRelayCommands(); } + } + /// <summary> /// Gets or sets a value indicating whether this view model is free to perform actions. /// </summary> public bool IsFree { - get { return _isFree; } - set { _isFree = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + get { return !IsBusy; } + set { IsBusy = !value; } } private ObservableCollection<String> _validationErrors; @@ -184,7 +192,7 @@ namespace Tango.SharedUI /// </summary> public ViewModel() : base() { - TangoIOC.Default.GetInstanceWhenAvailable<T>((view) => + TangoIOC.Default.GetInstanceWhenAvailable<T>((view) => { View = view; OnViewAttached(); |
