ActiveWindowChanged event arguments class.
Inheritance: System.EventArgs
        /// <summary>
        /// Raises the <see cref="FloatingWindowHost.ActiveWindowChanged" /> event.
        /// </summary>
        /// <param name="e">The event data.</param>
        protected virtual void OnActiveWindowChanged(ActiveWindowChangedEventArgs e)
        {
            EventHandler <ActiveWindowChangedEventArgs> handler = ActiveWindowChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// Activates the topmost window and sets focus on it.
        /// </summary>
        public void ActivateTopmostWindow()
        {
            // First, try to activate a modal window, if exists
            var topmostWindow = this.ModalWindow;

            if (topmostWindow == null)
            {
                topmostWindow = GetTopmostWindow();
            }

            SetFocusToActiveWindow(topmostWindow);

            ActiveWindowChangedEventArgs e = new ActiveWindowChangedEventArgs(null, topmostWindow);

            OnActiveWindowChanged(e);
        }
        /// <summary>
        /// Sets the specified floating window topmost, and set Focus on it.
        /// </summary>
        /// <param name="window">FloatingWindow to set topmost.</param>
        /// <exception cref="ArgumentNullException">FloatingWindow is null.</exception>
        public void SetTopmostWindow(FloatingWindow window)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            FloatingWindow topmostWindow = GetTopmostWindow();

            if (topmostWindow == null || window != topmostWindow)
            {
                SetTopmost(window);
                SetFocusToActiveWindow(window);

                if (!window.TopMost && !window.IsModal)
                {
                    ShowTopmostWindows();
                }

                ActiveWindowChangedEventArgs e = new ActiveWindowChangedEventArgs(topmostWindow, window);
                OnActiveWindowChanged(e);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles the ActiveWindowChanged event of the Host control.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SilverFlow.Controls.ActiveWindowChangedEventArgs"/> instance containing the event data.</param>
        private void ActiveWindowChanged(object sender, ActiveWindowChangedEventArgs e)
        {
            if (e.Old == this)
                OnDeactivated(EventArgs.Empty);

            if (e.New == this)
                OnActivated(EventArgs.Empty);
        }