public void destroyWindow(SceneViewWindow window)
        {
            if (WindowDestroyed != null)
            {
                WindowDestroyed.Invoke(window);
            }
            if (camerasCreated)
            {
                window.destroySceneView();
            }
            if (window == cloneWindow)
            {
                cloneWindow = null;
            }
            else if (mdiWindows.Remove(window as MDISceneViewWindow))
            {
                //On the last window, disable closing it.
                if (mdiWindows.Count == 1)
                {
                    mdiWindows[0].AllowClose = false;
                }
            }
            else
            {
                textureWindows.Remove(window as TextureSceneView);
            }

            if (window == activeWindow)
            {
                ActiveWindow = mdiWindows.FirstOrDefault();
            }

            window.Dispose();
        }
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == _wmShellHook)
            {
                switch ((EnumShellEvents)m.WParam)
                {
                case EnumShellEvents.HSHELL_WINDOWCREATED:
                    if (IsAppWindow(m.LParam))
                    {
                        OnWindowCreated(m.LParam);
                    }

                    break;

                case EnumShellEvents.HSHELL_WINDOWDESTROYED:
                    WindowDestroyed?.Invoke(this, m.LParam);
                    break;

                case EnumShellEvents.HSHELL_WINDOWACTIVATED:
                    WindowActivated?.Invoke(this, m.LParam);
                    break;
                }
            }
            base.WndProc(ref m);
        }
示例#3
0
            protected override void WndProc(ref Message m)
            {
                if (m.Msg == message)
                {
                    var type = (WinAPI.ShellHook)m.WParam;
                    switch (type)
                    {
                    case WinAPI.ShellHook.Activate:
                    case WinAPI.ShellHook.RudeActivate:
                        WindowActivated?.Invoke(GetWindow(m.LParam));
                        break;

                    case WinAPI.ShellHook.Create:
                        WindowCreated?.Invoke(GetWindow(m.LParam));
                        break;

                    case WinAPI.ShellHook.Destroy:
                        WindowDestroyed?.Invoke(GetWindow(m.LParam));
                        break;

                    case WinAPI.ShellHook.Flash:
                        WindowFlashed?.Invoke(GetWindow(m.LParam));
                        break;

                    case WinAPI.ShellHook.Redraw:
                        WindowRedraw?.Invoke(GetWindow(m.LParam));
                        break;
                    }
                }

                base.WndProc(ref m);
            }
示例#4
0
 void WndProc(Message m)
 {
     if (m.Msg == _ShellNotifyMsg)
     {
         if (m.WParam.ToInt32() == User32.HSHELL_WINDOWCREATED)
         {
             WindowCreated?.Invoke(m.LParam);
         }
         else if (m.WParam.ToInt32() == User32.HSHELL_WINDOWDESTROYED)
         {
             WindowDestroyed?.Invoke(m.LParam);
         }
     }
 }
示例#5
0
        protected override void WndProc(ref Message m)
        {
            //Check for shutdown message from windows
            switch (m.Msg)
            {
            case WM_QUERYENDSESSION:
                var closingEvent = new RestartManagerEvent(RestartManagerEventType.Query);
                RestartManagerTriggered?.Invoke(this, closingEvent);
                m.Result = closingEvent.Result;
                Log.Information($"Received WM_QUERYENDSESSION responded {m.Result}");
                break;

            case WM_ENDSESSION:
                RestartManagerTriggered?.Invoke(this, new RestartManagerEvent(RestartManagerEventType.EndSession));
                Log.Information("Received WM_ENDSESSION");
                break;

            case WM_CLOSE:
                RestartManagerTriggered?.Invoke(this, new RestartManagerEvent(RestartManagerEventType.ForceClose));
                Log.Information("Received WM_CLOSE");
                break;

            case WM_DEVICECHANGE:
                DeviceChanged?.Invoke(this, new DeviceChangeEvent());
                break;

            case WM_HOTKEY:
                ProcessHotKeyEvent(m);
                break;
            }

            if (WindowDestroyed != null && m.Msg == _msgNotifyShell)
            {
                // Receive shell messages
                switch ((Interop.ShellEvents)m.WParam.ToInt32())
                {
                case Interop.ShellEvents.HSHELL_WINDOWDESTROYED:
                    var hwnd = User32.NativeMethods.HWND.Cast(m.LParam);
                    var(_, windowText, windowClass) = WindowMonitor.ProcessWindowInformation(hwnd);
                    Task.Factory.StartNew(() =>
                    {
                        WindowDestroyed?.Invoke(this, new WindowDestroyedEvent(hwnd));
                    });
                    break;
                }
            }

            base.WndProc(ref m);
        }
示例#6
0
 private void OnWindowDestroyed()
 {
     WindowDestroyed?.Invoke(this, null);
 }
示例#7
0
 private void InnerForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     windowDestroyEvent.Set();
     WindowDestroyed?.Invoke(this, new EventArgs());
 }
 /// <summary>
 /// Raises the WindowDestroyed event.
 /// </summary>
 /// <param name="window">The window that is being destroyed.</param>
 protected void OnWindowDestroyed(IUltravioletWindow window) =>
 WindowDestroyed?.Invoke(window);
 private static void WindowDestroyedEvent(ShellHook ShellObject, IntPtr hWnd)
 {
     WindowDestroyed?.Invoke(ShellObject, hWnd);
 }
示例#10
0
 private void HandleWindowRemove(WindowsWindow window)
 {
     WindowDestroyed?.Invoke(window);
 }
 /// <summary>
 /// Raises the WindowDestroyed event.
 /// </summary>
 /// <param name="window">The window that is being destroyed.</param>
 private void OnWindowDestroyed(IUltravioletWindow window) =>
 WindowDestroyed?.Invoke(window);
示例#12
0
 private void WindowDestroyedEvent(ShellEventHook shellObject, IntPtr hWnd)
 {
     WindowDestroyed?.Invoke(shellObject, hWnd);
 }