internal BusyHelper(ObservableObject viewModel, int delayInMs) { _viewModel = viewModel; if (delayInMs <= 0) { StartBusy(); } else { _delayed = true; _delayInMs = delayInMs; Task.Delay(delayInMs).ContinueWith(_ => { StartBusy(); _delayed = false; }, TaskContinuationOptions.ExecuteSynchronously); } void StartBusy() { _tracker = new Guid(); _viewModel.BusyLocks.Add(_tracker); _viewModel.RaisePropertyChanged(nameof(ObservableObject.IsBusy)); _viewModel.RaisePropertyChanged(nameof(ObservableObject.IsNotBusy)); } }
public async void Dispose() { while (_delayed) { await Task.Delay(_delayInMs).ConfigureAwait(false); } _viewModel.BusyLocks.Remove(_tracker); _viewModel.RaisePropertyChanged(nameof(ObservableObject.IsBusy)); _viewModel.RaisePropertyChanged(nameof(ObservableObject.IsNotBusy)); }
public void Dispose() { lock (_lock) { _viewModel.ChangeNotificationsSuppressed = false; foreach (var property in _viewModel.SuppressedChangedProperties) { _viewModel.RaisePropertyChanged(property); } _viewModel.SuppressedChangedProperties.Clear(); } }
public static bool DispatchSet <T>(this ObservableObject observableObject, string propertyName, ref T field, T newValue) { #if PORTABLE throw NotSupported(); #else if (EqualityComparer <T> .Default.Equals(field, newValue)) { return(false); } field = newValue; MainThreadDispatcher.Instance.Execute(() => observableObject.RaisePropertyChanged(propertyName)); return(true); #endif }
public virtual void EntityViewModelPropertyChanged(object sender, EventArgs e) { ObservableObject observableObj = sender as ObservableObject; if (observableObj != null) { observableObj.RaisePropertyChanged(String.Empty); Debug.WriteLine("a domain has changed"); } else { throw new Exception("sender of propertychanged is not of type ObservableObject"); } //This will get called when the property of an object inside the collection changes }