Ejemplo n.º 1
0
        public IObservable <bool> GetActivationForView(ReactiveUI.IActivatable view)
        {
            BehaviorSubject <bool> activation;

            if (ActivationMap.TryGetValue(view, out activation))
            {
                return(activation);
            }
            activation = new BehaviorSubject <bool>(false);
            ActivationMap.Add(view, activation);
            return(activation.DistinctUntilChanged());
        }
Ejemplo n.º 2
0
        private void NotifyActivationForView(ReactiveUI.IActivatable view, bool activated)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }
            BehaviorSubject <bool> activation;

            if (ActivationMap.TryGetValue(view, out activation))
            {
                activation.OnNext(activated);
            }
            else
            {
                activation = new BehaviorSubject <bool>(activated);
                ActivationMap.Add(view, activation);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Notifies that the given view was de-activated. This can be used so that views that utilize <see cref="ViewForMixins.WhenActivated(ISupportsActivation,Func{IEnumerable{IDisposable}})"/> will dispose registrations as expected.
 /// </summary>
 /// <param name="view"></param>
 protected void NotifyViewDeActivated(ReactiveUI.IActivatable view) => NotifyActivationForView(view, false);
Ejemplo n.º 4
0
 /// <summary>
 /// Notifies that the given view was activated. This can be used so that views that utilize <see cref="ViewForMixins.WhenActivated(ISupportsActivation,Func{IEnumerable{IDisposable}})"/> will work as expected.
 /// </summary>
 /// <param name="view">The view that the activation should be notified for.</param>
 protected void NotifyViewActivated(ReactiveUI.IActivatable view) => NotifyActivationForView(view, true);