コード例 #1
0
        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)?
        }
コード例 #2
0
        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.
        }
コード例 #3
0
        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;
            }
        }
コード例 #5
0
        private void ForwardActiveAware(IActiveAware activeAware, bool newValue)
        {
            if (activeAware == null)
            {
                return;
            }

            if (activeAware.IsActive != newValue)
            {
                activeAware.IsActive = newValue;
            }
        }
コード例 #6
0
ファイル: PopupModalWindow.xaml.cs プロジェクト: daisy/tobi
        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;
        }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
        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; };
        }
コード例 #10
0
 private void OnAddRegisterForViewIsActiveChangedEvent(IActiveAware activeAware)
 {
     activeAware.IsActiveChanged += SetActivationInRegion;
 }
 private void OnAddRegisterForViewIsActiveChangedEvent(IActiveAware activeAware)
 {
     activeAware.IsActiveChanged += SetActivationInRegion;
 }
コード例 #12
0
 static void invocation(IActiveAware activeAware) => activeAware.Active = true;