void sessionWindow_FormClosing(object sender, FormClosingEventArgs e) { if (_previews.ContainsKey((RDCWindow)sender)) { _previews[(RDCWindow)sender].Dispose(); _previews.Remove((RDCWindow)sender); } if (sender == _previousActiveDocument) _previousActiveDocument = null; TaskbarManager.Instance.TabbedThumbnail.RemoveThumbnailPreview((RDCWindow)sender); }
protected void GenerateWindowPreview(RDCWindow sessionWindow) { if (SelectedTab.Content != sessionWindow) return; Bitmap bitmap = TabbedThumbnailScreenCapture.GrabWindowBitmap(sessionWindow.Handle, sessionWindow.Size); TabbedThumbnail preview = TaskbarManager.Instance.TabbedThumbnail.GetThumbnailPreview(sessionWindow); _previews[sessionWindow] = bitmap; preview.SetImage(bitmap); }
protected void MainForm_TabSelected(object sender, TitleBarTabEventArgs e) { if (!_addingWindow && SelectedTabIndex != -1) TaskbarManager.Instance.TabbedThumbnail.SetActiveTab((RDCWindow)SelectedTab.Content); _previousActiveDocument = (RDCWindow)SelectedTab.Content; }
protected void Connect(RDCConnection connection) { _history.AddToHistory(connection); RDCWindow sessionWindow = new RDCWindow(_password); _addingWindow = true; Tabs.Add(new TitleBarTab(this) { Content = sessionWindow }); _addingWindow = false; sessionWindow.FormClosing += sessionWindow_FormClosing; sessionWindow.Connected += sessionWindow_Connected; sessionWindow.Connect(connection); TabbedThumbnail preview = new TabbedThumbnail(Handle, sessionWindow); preview.Title = sessionWindow.Text; preview.Tooltip = sessionWindow.Text; preview.SetWindowIcon(sessionWindow.Icon); preview.TabbedThumbnailActivated += new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailActivated); preview.TabbedThumbnailClosed += new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailClosed); preview.TabbedThumbnailBitmapRequested += new EventHandler<TabbedThumbnailBitmapRequestedEventArgs>(preview_TabbedThumbnailBitmapRequested); preview.PeekOffset = new Vector(sessionWindow.Location.X, sessionWindow.Location.Y); for (Control currentControl = sessionWindow.Parent; currentControl.Parent != null; currentControl = currentControl.Parent) preview.PeekOffset += new Vector(currentControl.Location.X, currentControl.Location.Y); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview); TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(preview); if (_recentConnections.FirstOrDefault((HistoryWindow.HistoricalConnection c) => c.Guid == connection.Guid) == null) { _recentCategory.AddJumpListItems(new JumpListLink(Application.ExecutablePath, sessionWindow.Text) { Arguments = "/openHistory:" + connection.Guid.ToString(), IconReference = new IconReference(Application.ExecutablePath, 0) }); _jumpList.Refresh(); _recentConnections.Enqueue(_history.Connections.First((HistoryWindow.HistoricalConnection c) => c.Guid == connection.Guid)); if (_recentConnections.Count > _jumpList.MaxSlotsInList) _recentConnections.Dequeue(); } }