Example #1
0
        private void DoApplyWindow(IWindow window, bool isUnique, bool overlap)
        {
            _isUnique = isUnique;

            window.CloseWindowEvent   += OnCloseWindow;
            window.DestroyWindowEvent += OnDestroyWindow;

            window.Canvas.sortingOrder = StartCanvasSortingOrder + _openedWindows.Count;

            var overlappedWindow = _openedWindows.LastOrDefault();

            _openedWindows.Add(window);

            if (window.IsActive())
            {
                Debug.LogError("Window must be inactive in initial time.");
            }
            else if (!window.IsActiveOrActivated())
            {
                window.Activate();
            }

            if (overlap && overlappedWindow != null && overlappedWindow.IsActiveOrActivated())
            {
                overlappedWindow.Deactivate();
            }

            WindowOpenedEvent?.Invoke(window);
        }
 public void ActivateParent()
 {
     try
     {
         _targetWindow.Activate();
     }
     catch {}
 }
Example #3
0
        // set the focus to a window of the document
        public IWindow         Activate()
        {
            IWindow documentWindow = null;

            foreach (IWindow window in MdiApplication.GetObject().Windows)
            {
                if (window.Document == this)
                {
                    documentWindow = window;
                    break;
                }
            }
            Debug.Assert(documentWindow != null);
            documentWindow.Activate();
            return(documentWindow);
        }
Example #4
0
        /// <summary>
        /// Restores the window with the given Id
        /// </summary>
        /// <param name="id"></param>
        public void Restore(Guid id)
        {
            this.InvokeAsynchronouslyInBackground
            (
                () =>
            {
                IWindow window = this.desktop.Children.OfType <IWindow>().Where(wc => wc.Id == id).SingleOrDefault();

                if (window != null)
                {
                    window.WindowState = WindowState.Normal;
                    window.Activate();
                }
            }
            );
        }