Пример #1
0
        public void ScanForWindowUpdates()
        {
            Win32Window[] windows = GetDesktopWindowHandlesAndTitles();
            foreach (Win32Window window in windows)
            {
                Win32Window existing = _windows.FirstOrDefault(w => w.Handle == window.Handle);
                if (existing == null)
                {
                    _windows.Add(window);
                    WindowAdded?.Invoke(this, new NativeWindowEventArgs(window));
                }
                else if (!existing.Equals(window))
                {
                    existing.UpdateFrom(window);
                    WindowUpdated?.Invoke(this, new NativeWindowEventArgs(window));
                }
            }
            List <Win32Window> toRemove = new List <Win32Window>();

            foreach (Win32Window window in _windows)
            {
                if (!windows.Any(w => w.Handle == window.Handle))
                {
                    toRemove.Add(window);
                }
            }
            foreach (Win32Window window in toRemove)
            {
                _windows.Remove(window);
                WindowRemoved?.Invoke(this, new NativeWindowEventArgs(window));
            }
        }
Пример #2
0
 /// <summary>
 /// Raises event 'WindowAdded'
 /// </summary>
 protected virtual void OnWindowAdded()
 {
     if (WindowAdded != null)
     {
         WindowAdded.Invoke(this, System.EventArgs.Empty);
     }
 }
Пример #3
0
        public static bool Init(WindowInfo info, List <WindowInfo> childWindows = null)
        {
            if (MainWindow != null)
            {
                return(false);
            }

            MainWindowID = 1;

            GraphicsMode thisMode = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, GraphicsMode.Default.Stencil, info.AntiAliasingFactor);

            MainWindow           = new Window(info.Size.x, info.Size.y, thisMode, WindowTitleText, info.SizeType == WindowInfo.WindowSizeTypes.Fullscreen ? GameWindowFlags.Fullscreen : GameWindowFlags.FixedWindow);
            MainWindow.ContextID = MainWindowID;
            MainWindow.SetupInfo = info;

            CurrentContextID = MainWindow.ContextID;

            MainWindowAAFactor = MainWindow.SetupInfo.AntiAliasingFactor;             // so that prefs can save it when we close, it'll be the last one that actualy worked

            if (RestartData == null)
            {
                WindowAdded?.Invoke(MainWindow, EventArgs.Empty);
            }

            MainWindow.Resize += MainWindow_Resize;

            if (info.SizeType == WindowInfo.WindowSizeTypes.Maximized)
            {
                SetMaximized();
            }

            return(true);
        }
Пример #4
0
        public static void AddWindow(Form form)
        {
            Contract.Requires(form != null);

            windows.Add(form);

            form.TopMost = Program.Settings.StayOnTop;

            WindowAdded?.Invoke(null, new GlobalWindowManagerEventArgs(form));
        }
Пример #5
0
        private void AddWindowToWorkspace(IWindow window, IWorkspace workspace)
        {
            Logger.Debug("AddWindowToWorkspace({0}, {1})", window, workspace);
            workspace.AddWindow(window);
            _windowsToWorkspaces[window] = workspace;

            if (window.IsFocused)
            {
                var monitor = _context.WorkspaceContainer.GetCurrentMonitorForWorkspace(workspace);
                if (monitor != null)
                {
                    _context.MonitorContainer.FocusedMonitor = monitor;
                }
            }
            WindowAdded?.Invoke(window, workspace);
        }
Пример #6
0
 internal void OnWindowAdd(EditorWindow window)
 {
     Windows.Add(window);
     WindowAdded?.Invoke(window);
 }
Пример #7
0
 /// <inheritdoc />
 public virtual void OnWindowAdded(IDockWindow?window)
 {
     WindowAdded?.Invoke(this, new WindowAddedEventArgs(window));
 }