Exemplo n.º 1
0
        /// <inheritdoc/>
        public void AddWindow(IntPtr handle)
        {
            if (Window.IsVisibleWindow(handle) == false)
            {
                return;
            }

            var window = new Window(this.CurrentFrame, handle, this.notificationService);

            try
            {
                window.Manage();
                window.SwitchFrame(this.CurrentFrame);
            }
            catch
            {
                Logger.Instance.Error("WMService: Failed to add existing window. HWnd: " + handle);
                window.Unmanage();
                return;
            }

            this.ManagedWindows.Add(handle, window);
            Logger.Instance
                  .Debug(
                      "WMService: Added window. HWnd = {0}, Name = {1}, Application Name = {2}",
                      window.Handle,
                      window.Name,
                      window.ApplicationName);
        }