/// <summary> /// Called from <see cref="ConnectionWindow"/> instances when a connection is established. Creates a thumbnail preview for the tab (if one doesn't /// exist already) for Aero Peek and adds the connection to the list of entries on the application's jump list. /// </summary> /// <param name="connectionWindow"></param> /// <param name="connection"></param> public async Task RegisterConnection(ConnectionWindow connectionWindow, IConnection connection) { await History.Instance.AddToHistory(connection); // Add the connection to the jump list if (_recentConnections.FirstOrDefault((HistoricalConnection c) => c.Connection.Guid == connection.Guid) == null) { try { _recentCategory.AddJumpListItems( new JumpListLink(Application.ExecutablePath, connectionWindow.Text) { Arguments = "/openHistory:" + connection.Guid.ToString(), IconReference = new IconReference(Application.ExecutablePath, 0) }); _jumpList.Refresh(); } // Turning off the "show recent documents in the taskbar and start menu" setting in the start menu properties // can cause adding a jump list item to throw an exception, so just ignore the error and continue catch (Exception) { } _recentConnections.Enqueue(History.Instance.Connections.First((HistoricalConnection c) => c.Connection.Guid == connection.Guid)); if (_recentConnections.Count > _jumpList.MaxSlotsInList) { _recentConnections.Dequeue(); } } }
/// <summary> /// Opens a new tab for <paramref name="connection"/>. /// </summary> /// <param name="connection">Connection that we are to open a new tab for.</param> /// <param name="focusNewTab">Flag indicating whether we should focus on the new tab.</param> /// <returns>Tab that was created for <paramref name="connection"/>.</returns> public TitleBarTab Connect(IConnection connection, bool focusNewTab) { ConnectionWindow connectionWindow = new ConnectionWindow(connection); TitleBarTab newTab = new TitleBarTab(this) { Content = connectionWindow }; Tabs.Insert(SelectedTabIndex + 1, newTab); ResizeTabContents(newTab); if (focusNewTab) { SelectedTab = newTab; _previouslyClickedTab = newTab; } connectionWindow.Connect(); return(newTab); }
/// <summary> /// Called from <see cref="ConnectionWindow"/> instances when a connection is established. Creates a thumbnail preview for the tab (if one doesn't /// exist already) for Aero Peek and adds the connection to the list of entries on the application's jump list. /// </summary> /// <param name="connectionWindow"></param> /// <param name="connection"></param> public void RegisterConnection(ConnectionWindow connectionWindow, IConnection connection) { _history.AddToHistory(connection); // Add the connection to the jump list if (_recentConnections.FirstOrDefault((HistoryWindow.HistoricalConnection c) => c.Connection.Guid == connection.Guid) == null) { _recentCategory.AddJumpListItems( new JumpListLink(Application.ExecutablePath, connectionWindow.Text) { Arguments = "/openHistory:" + connection.Guid.ToString(), IconReference = new IconReference(Application.ExecutablePath, 0) }); _jumpList.Refresh(); _recentConnections.Enqueue(_history.Connections.First((HistoryWindow.HistoricalConnection c) => c.Connection.Guid == connection.Guid)); if (_recentConnections.Count > _jumpList.MaxSlotsInList) { _recentConnections.Dequeue(); } } }
/// <summary> /// Called from <see cref="ConnectionWindow"/> instances when a connection is established. Creates a thumbnail preview for the tab (if one doesn't /// exist already) for Aero Peek and adds the connection to the list of entries on the application's jump list. /// </summary> /// <param name="connectionWindow"></param> /// <param name="connection"></param> public void RegisterConnection(ConnectionWindow connectionWindow, IConnection connection) { _history.AddToHistory(connection); // Add the connection to the jump list if (_recentConnections.FirstOrDefault((HistoryWindow.HistoricalConnection c) => c.Connection.Guid == connection.Guid) == null) { _recentCategory.AddJumpListItems( new JumpListLink(Application.ExecutablePath, connectionWindow.Text) { Arguments = "/openHistory:" + connection.Guid.ToString(), IconReference = new IconReference(Application.ExecutablePath, 0) }); _jumpList.Refresh(); _recentConnections.Enqueue(_history.Connections.First((HistoryWindow.HistoricalConnection c) => c.Connection.Guid == connection.Guid)); if (_recentConnections.Count > _jumpList.MaxSlotsInList) _recentConnections.Dequeue(); } }
/// <summary> /// Opens a new tab for <paramref name="connection"/>. /// </summary> /// <param name="connection">Connection that we are to open a new tab for.</param> /// <param name="focusNewTab">Flag indicating whether we should focus on the new tab.</param> /// <returns>Tab that was created for <paramref name="connection"/>.</returns> public TitleBarTab Connect(IConnection connection, bool focusNewTab) { ConnectionWindow connectionWindow = new ConnectionWindow(connection); TitleBarTab newTab = new TitleBarTab(this) { Content = connectionWindow }; Tabs.Insert(SelectedTabIndex + 1, newTab); ResizeTabContents(newTab); if (focusNewTab) { SelectedTab = newTab; _previouslyClickedTab = newTab; } connectionWindow.Connect(); return newTab; }
private void propertiesMenuItem_Click(object sender, EventArgs e) { ConnectionWindow connectionWindow = new ConnectionWindow(_favoritesWindow, _connections[historyTreeView.SelectedNode], _connectionDelegate, _password); connectionWindow.ShowDialog(); }