private HostingTabPageContextMenuStrip() { _workbenchService = ServiceUnity.WorkbenchService; ContextMenuStripCodon contextMenuStripCodon = new ContextMenuStripCodon("HostingTabPageContextMenuStrip"); contextMenuStripCodon.Items.Add(new ToolStripMenuItemCodon("Close", Language.Current.HostingTabPageContextMenuStrip_Close, delegate(object sender, ToolStripItemCodonEventArgs codon) { _workbenchService.CloseView(FormHostingContainer.Instance.ActiveHosting); })); contextMenuStripCodon.Items.Add(new ToolStripMenuItemCodon("CloseAll", Language.Current.HostingTabPageContextMenuStrip_CloseAll, delegate(object sender, ToolStripItemCodonEventArgs codon) { IDockContent[] dockContent = FormHostingContainer.Instance.Hostings.ToArray(); for (int i = 0; i < dockContent.Length; i++) { IView view = dockContent[i] as IView; _workbenchService.CloseView(view); } })); contextMenuStripCodon.Items.Add(new ToolStripMenuItemCodon("CloseAllButThis", Language.Current.HostingTabPageContextMenuStrip_CloseAllButThis, delegate(object sender, ToolStripItemCodonEventArgs codon) { IDockContent[] dockContent = FormHostingContainer.Instance.Hostings.ToArray(); for (int i = 0; i < dockContent.Length; i++) { if (dockContent[i] != FormHostingContainer.Instance.ActiveHosting) { IView view = dockContent[i] as IView; _workbenchService.CloseView(view); } } })); MenuStrip = new ContextMenuStripView(contextMenuStripCodon); }
void close_Click(object sender, EventArgs e) { _workbenchService.CloseView(); }