public DialogResult ShowDialog(IWin32Window parent, QuickSelectorData data, QuickSelectorOptions options) { // bind data this.Options = options; this.DataView = new DataView(data.ItemData); this.DataView.Sort = options.Sort; this.dataGridViewData.DataSource = this.DataView; // configure grid this.nameDataGridViewTextBoxColumn.Visible = this.Options.ShowNameColumn; this.detailDataGridViewTextBoxColumn.Visible = this.Options.ShowDetailColumn; if (this.Options.ShowDetailColumn && !this.Options.ShowNameColumn) { this.detailDataGridViewTextBoxColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; } // update title this.UpdateFilter(); return ShowDialog(parent); }
private void openSessionToolStripMenuItem_Click(object sender, EventArgs e) { QuickSelector q = new QuickSelector(); QuickSelectorData data = new QuickSelectorData(); data.CaseSensitive = SuperPuTTY.Settings.QuickSelectorCaseSensitiveSearch; // TODO foreach (SessionData sd in SuperPuTTY.GetRootFolderData().GetSessionsList(SuperPuTTY.GetRootFolderData())) { data.ItemData.AddItemDataRow( sd.SessionName, sd.SessionName, 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.SessionName, 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(); } }