static void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (object item in e.NewItems) { IActiveAware activeAware = item as IActiveAware; if (activeAware != null) { activeAware.IsActive = true; } } } else if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (object item in e.OldItems) { IActiveAware activeAware = item as IActiveAware; if (activeAware != null) { activeAware.IsActive = false; } } } // handle other action values (reset, etc)? }
private static void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (object item in e.NewItems) { IActiveAware activeAware = item as IActiveAware; if (activeAware != null) { activeAware.IsActive = true; } } } else if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (object item in e.OldItems) { IActiveAware activeAware = item as IActiveAware; if (activeAware != null) { activeAware.IsActive = false; } } } // May need to handle other action values (reset, replace). Currently the ViewsCollection class does not raise CollectionChanged with these values. }
private void RegisterIActiveAwareChanged(IActiveAware activeAware) { if (activeAware == null) { return; } activeAware.IsActiveChanged += delegate { this.IsActive = activeAware.IsActive; }; }
private void ForwardActiveAware(IActiveAware activeAware, bool newValue) { if (activeAware == null) return; if (activeAware.IsActive != newValue) { activeAware.IsActive = newValue; } }
private void ForwardActiveAware(IActiveAware activeAware, bool newValue) { if (activeAware == null) { return; } if (activeAware.IsActive != newValue) { activeAware.IsActive = newValue; } }
private PopupModalWindow(IShellView shellView) { ShellView = shellView; //if (this != Application.Current.MainWindow) //{ // Owner = ShellView == null ? Application.Current.MainWindow : ShellView.View.Window; //} //else { Owner = null; } //#if NET_3_5 //#else // NET_4_0 || BOOTSTRAP_NET_4_0 //#endif //DataContext = Owner; EnableEnterKeyDefault = false; PreviewKeyDown += new KeyEventHandler(OnThisKeyDown); ClickedDialogButton = DialogButton.ESC; m_PropertyChangeHandler = new PropertyChangedNotifyBase(); m_PropertyChangeHandler.InitializeDependentProperties(this); ActiveAware = new FocusActiveAwareAdapter(this); ActiveAware.IsActiveChanged += (sender, e) => { if (!ActiveAware.IsActive) { Console.WriteLine("@@@@ popup lost focus"); } else { Console.WriteLine("@@@@ popup gained focus"); } CommandManager.InvalidateRequerySuggested(); }; InitializeComponent(); //RegionManager.SetRegionManager(this, m_Container.Resolve<IRegionManager>()); //RegionManager.UpdateRegions(); initCommands(); m_IsDetailsExpanded = false; }
private void OnTabbedPageCurrentPageChanged(object sender, EventArgs e) { var tabbedPage = (TabbedPage)sender; // Deactivate previously selected page IActiveAware prevActiveAwarePage = tabbedPage.Children.OfType <IActiveAware>() .FirstOrDefault(c => c.IsActive && tabbedPage.CurrentPage != c); if (prevActiveAwarePage != null) { prevActiveAwarePage.IsActive = false; } // Activate selected page if (tabbedPage.CurrentPage is IActiveAware activeAwarePage) { activeAwarePage.IsActive = true; } }
void SetActivationInRegion(object sender, EventArgs e) { IActiveAware activeAware = sender as IActiveAware; if (activeAware == null) { return; } if (activeAware.IsActive && !this.Region.ActiveViews.Contains(activeAware)) { this.Region.Activate(activeAware); } else if (!activeAware.IsActive && this.Region.ActiveViews.Contains(activeAware)) { this.Region.Deactivate(activeAware); } }
private void RegisterIActiveAwareChanged(IActiveAware activeAware) { if (activeAware == null) return; activeAware.IsActiveChanged += delegate { this.IsActive = activeAware.IsActive; }; }
private void OnAddRegisterForViewIsActiveChangedEvent(IActiveAware activeAware) { activeAware.IsActiveChanged += SetActivationInRegion; }
static void invocation(IActiveAware activeAware) => activeAware.Active = true;