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()); }
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); } }
/// <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);
/// <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);