public void MoveFocusedWindowToWorkspace(int index) { Logger.Debug("MoveFocusedWindowToWorkspace({0})", index); var window = FocusedWorkspace.FocusedWindow; var targetWorkspace = _context.WorkspaceContainer.GetWorkspaceAtIndex(FocusedWorkspace, index); if (window != null && targetWorkspace != null) { var windows = FocusedWorkspace.Windows.Where(w => w.CanLayout); // get next window var nextWindow = windows.SkipWhile(x => x != window).Skip(1).FirstOrDefault(); if (nextWindow == null) { // get previous window nextWindow = windows.TakeWhile(x => x != window).LastOrDefault(); } FocusedWorkspace.RemoveWindow(window); targetWorkspace.AddWindow(window); _windowsToWorkspaces[window] = targetWorkspace; WindowMoved?.Invoke(window, FocusedWorkspace, targetWorkspace); nextWindow?.Focus(); } }
void fireWindowMovedEvent(WindowEvent e) { if (WindowMoved != null) { try { WindowMoved.Invoke(this, new WindowEventForwarder(e)); } catch { } } }
private void OnWindowMoved() { var relativeRect = RelativeToWindow.GetBounds(); var myRect = Window.GetBounds(); myRect.X -= relativeRect.X; myRect.Y -= relativeRect.Y; WindowMoved?.Invoke(this, new WindowLocationUpdatedEventArgs(Window.GetIsVisible(), myRect)); //WindowMoved?.Invoke(this, new WindowLocationUpdatedEventArgs(Window.GetIsVisible(), Window.TransformTo(RelativeToWindow, Window.GetBounds()))); }