public static void Choose(IContext context, IList <IAction> actions) { using (var sb = new SearchBox(context, new SimpleActionSource(actions))) { var f = sb.AsForm("Select"); AddCancel(f); f.Visible = false; sb.ItemsActivated += (s, e) => { var selectedActions = sb.SelectedActions.ToList(); f.Close(); foreach (var i in selectedActions) { i.Execute(); } }; f.Shown += (s, e) => { sb.QueryText = String.Empty; }; f.WindowState = FormWindowState.Maximized; f.ShowDialog(); } }
void InitUserInterface() { dockPanel = new DockPanel() { Dock = DockStyle.Fill, DocumentStyle = DocumentStyle.DockingMdi, DocumentTabStripLocation = DocumentTabStripLocation.Top, Theme = new VS2015LightTheme(), TabIndex = 0 }; this.IsMdiContainer = true; this.Controls.Add(dockPanel); this.WindowState = FormWindowState.Maximized; InitializeComponent(); EnableDragAndDropFromInternetExplorer(); hagen.Context.MainMenu = this.MainMenuStrip; hagen.Context.NotifyAction = text => this.Invoke(() => notifyIcon.ShowBalloonTip(10000, "hagen Alert", text, ToolTipIcon.Info)); hagen.Context.TagsSource = () => searchBox.Query.Tags as IReadOnlyCollection <string>; this.IsMdiContainer = true; // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; jobListView = new JobListView() { Text = "Jobs" }; hagen.Context.AddJob = this.jobListView.JobList.Jobs.Add; var pluginProvider = new PluginProvider2(hagen.Context, Paths.BinDir); actionSource = new Composite(pluginProvider.GetActionSources().ToArray()); searchBox = new SearchBox(this.hagen.Context, actionSource) { Text = "Search", }; searchBox.ItemsActivated += new EventHandler(searchBox_ItemsActivated); AddPanel(searchBox); AddPanel(jobListView); DragEnter += new DragEventHandler(Main_DragEnter); DragDrop += new DragEventHandler(Main_DragDrop); this.AllowDrop = true; this.Load += new EventHandler(Main_Load); this.KeyDown += new KeyEventHandler(Main_KeyDown); this.KeyPreview = true; var binding = hotkeyBinder.Bind(Shortcut.Modifiers.Alt | Shortcut.Modifiers.Control, Keys.Space); binding.To(Popup); this.reportsToolStripMenuItem.DropDownItems.AddRange(GetTextReportMenuItems().ToArray()); }