From 4c1db0cbded45ed962c4402e466409d1c9bb8bbd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 23 Aug 2018 10:30:57 +0300 Subject: Added IsBusy to base ViewModel. --- Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio') 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> _currentErrors = new List>(); //Holds the current validation errors. - private bool _isFreeSet; private bool _hasErrors; /// @@ -35,14 +34,23 @@ namespace Tango.SharedUI set { _hasErrors = value; RaisePropertyChangedAuto(); } } - private bool _isFree; + private bool _isBusy; + /// + /// Gets or sets a value indicating whether this view model is currently busy doing operations. + /// + public bool IsBusy + { + get { return _isBusy; } + set { _isBusy = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsFree)); InvalidateRelayCommands(); } + } + /// /// Gets or sets a value indicating whether this view model is free to perform actions. /// public bool IsFree { - get { return _isFree; } - set { _isFree = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + get { return !IsBusy; } + set { IsBusy = !value; } } private ObservableCollection _validationErrors; @@ -184,7 +192,7 @@ namespace Tango.SharedUI /// public ViewModel() : base() { - TangoIOC.Default.GetInstanceWhenAvailable((view) => + TangoIOC.Default.GetInstanceWhenAvailable((view) => { View = view; OnViewAttached(); -- cgit v1.3.1