예제 #1
0
        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));
            }
        }
예제 #2
0
 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));
 }
예제 #3
0
        public void Dispose()
        {
            lock (_lock)
            {
                _viewModel.ChangeNotificationsSuppressed = false;

                foreach (var property in _viewModel.SuppressedChangedProperties)
                {
                    _viewModel.RaisePropertyChanged(property);
                }

                _viewModel.SuppressedChangedProperties.Clear();
            }
        }
예제 #4
0
        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
        }
예제 #5
0
        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
        }