/// <include file='doc\ControlCommandSet.uex' path='docs/doc[@for="ControlCommandSet.OnMenuTabOrder"]/*' /> /// <devdoc> /// Called to display or destroy the tab order UI. /// </devdoc> private void OnMenuTabOrder(object sender, EventArgs e) { MenuCommand cmd = (MenuCommand)sender; if (cmd.Checked) { Debug.Assert(tabOrder != null, "Tab order and menu enabling are out of sync"); if (tabOrder != null) { tabOrder.Dispose(); tabOrder = null; } cmd.Checked = false; } else { //if we're creating a tab order view, set the focus to the base comp, //this prevents things such as the menu editor service getting screwed up. // ISelectionService selSvc = SelectionService; IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); if (host != null && selSvc != null) { object baseComp = host.RootComponent; if (baseComp != null) { selSvc.SetSelectedComponents(new object[] { baseComp }, SelectionTypes.Replace); } } tabOrder = new TabOrder((IDesignerHost)GetService(typeof(IDesignerHost))); cmd.Checked = true; } }
public override void Dispose() { if (base.MenuService != null) { for (int i = 0; i < this.commandSet.Length; i++) { base.MenuService.RemoveCommand(this.commandSet[i]); this.commandSet[i].Dispose(); } } if (this.tabOrder != null) { this.tabOrder.Dispose(); this.tabOrder = null; } this.statusCommandUI = null; base.Dispose(); }
private void OnMenuTabOrder(object sender, EventArgs e) { MenuCommand command = (MenuCommand) sender; if (command.Checked) { if (this.tabOrder != null) { this.tabOrder.Dispose(); this.tabOrder = null; } command.Checked = false; } else { ISelectionService selectionService = base.SelectionService; IDesignerHost service = (IDesignerHost) this.GetService(typeof(IDesignerHost)); if ((service != null) && (selectionService != null)) { object rootComponent = service.RootComponent; if (rootComponent != null) { selectionService.SetSelectedComponents(new object[] { rootComponent }, SelectionTypes.Replace); } } this.tabOrder = new TabOrder((IDesignerHost) this.GetService(typeof(IDesignerHost))); command.Checked = true; } }