public void Test() { List<SessionData> sessions = SessionData.LoadSessionsFromFile("c:/Users/beau/SuperPuTTY/sessions.xml"); QuickSelectorData data = new QuickSelectorData(); foreach (SessionData sd in sessions) { data.ItemData.AddItemDataRow( sd.SessionName, sd.SessionId, sd.Proto == ConnectionProtocol.Cygterm || sd.Proto == ConnectionProtocol.Mintty ? Color.Blue : Color.Black, null); } QuickSelectorOptions opt = new QuickSelectorOptions(); opt.Sort = data.ItemData.DetailColumn.ColumnName; opt.BaseText = "Open Session"; QuickSelector d = new QuickSelector(); d.ShowDialog(null, data, opt); }
private void openSessionToolStripMenuItem_Click(object sender, EventArgs e) { QuickSelector q = new QuickSelector(); QuickSelectorData data = new QuickSelectorData(); data.CaseSensitive = SuperPuTTY.Settings.QuickSelectorCaseSensitiveSearch; foreach (SessionData sd in SuperPuTTY.Sessions) { data.ItemData.AddItemDataRow( sd.SessionName, sd.SessionId, sd.Proto == ConnectionProtocol.Cygterm || sd.Proto == ConnectionProtocol.Mintty ? Color.Blue : Color.Black, null); } QuickSelectorOptions opt = new QuickSelectorOptions(); opt.Sort = data.ItemData.DetailColumn.ColumnName; opt.BaseText = "Open Session"; QuickSelector d = new QuickSelector(); if (d.ShowDialog(this, data, opt) == DialogResult.OK) { SuperPuTTY.OpenPuttySession(d.SelectedItem.Detail); } }
private void switchSessionToolStripMenuItem_Click(object sender, EventArgs e) { QuickSelector q = new QuickSelector(); QuickSelectorData data = new QuickSelectorData(); data.CaseSensitive = SuperPuTTY.Settings.QuickSelectorCaseSensitiveSearch; foreach (ToolWindow content in this.tabSwitcher.Documents) { ctlPuttyPanel panel = content as ctlPuttyPanel; if (content != null) { SessionData sd = panel.Session; data.ItemData.AddItemDataRow( panel.Text, sd.SessionId, sd.Proto == ConnectionProtocol.Cygterm || sd.Proto == ConnectionProtocol.Mintty ? Color.Blue : Color.Black, panel); } } QuickSelectorOptions opt = new QuickSelectorOptions(); opt.Sort = data.ItemData.DetailColumn.ColumnName; opt.BaseText = "Switch Session"; opt.ShowNameColumn = true; QuickSelector d = new QuickSelector(); if (d.ShowDialog(this, data, opt) == DialogResult.OK) { ctlPuttyPanel panel = (ctlPuttyPanel)d.SelectedItem.Tag; panel.Activate(); } }