public void Attach(IWorkbench currentWorkbench) { workbench = (DefaultWorkbench)currentWorkbench; workbench.Controls.Clear(); tabControl.Style = (Crownwood.Magic.Common.VisualStyle)propertyService.GetProperty("NetFocus.DataStructure.Gui.VisualStyle", Crownwood.Magic.Common.VisualStyle.IDE); tabControl.Dock = DockStyle.Fill; tabControl.ShrinkPagesToFit = true; tabControl.ShowArrows = false; tabControl.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiBox; workbench.Controls.Add(tabControl); tabControl.Visible = false; dockManager = new DockingManager(workbench, VisualStyle.IDE); IStatusBarService statusBarService = (IStatusBarService)ServiceManager.Services.GetService(typeof(IStatusBarService)); workbench.Controls.Add(statusBarService.Control); workbench.Menu = null; workbench.AddMenuAndToolbarControls(); dockManager.InnerControl = tabControl; dockManager.OuterControl = statusBarService.Control; foreach (IViewContent content in workbench.ViewContentCollection) { ShowView(content); } contentVisibleHandler = new DockingManager.ContentHandler(RefreshMainMenu); dockManager.ContentHidden += contentVisibleHandler; dockManager.ContentShown += contentVisibleHandler; }
/// <summary> /// Constructs a new <see cref="ToolsetUIModifier"/> instance. /// </summary> /// <param name="addScriptToLine">A method which will be invoked when /// the user tries to add a script to a line of dialogue.</param> /// <param name="AddScriptToConversation">A method which will be invoked when /// the user tries to add a condition to a line of dialogue.</param> /// <param name="createBlockFromBlueprintDelegate">A method which will be invoked when /// a blueprint is to be used to create an instance block in Flip.</param> /// <param name="updateBlockDelegate">A method which will be invoked when /// a blueprint is to be used to create an instance block in Flip.</param> public ToolsetUIModifier(AddScriptToConversation addScriptToLine, AddScriptToConversation addConditionToLine, CreateBlockFromBlueprintDelegate createBlockFromBlueprintDelegate, UpdateBlockWhenTagChangesDelegate updateBlockDelegate) { try { if (addScriptToLine == null) { throw new ArgumentNullException("addScriptToLine"); } if (addConditionToLine == null) { throw new ArgumentNullException("addConditionToLine"); } if (createBlockFromBlueprintDelegate == null) { throw new ArgumentNullException("createBlockFromBlueprintDelegate"); } if (updateBlockDelegate == null) { throw new ArgumentNullException("updateBlockDelegate"); } this.addScriptToLine = addScriptToLine; this.addConditionToLine = addConditionToLine; this.createBlockFromBlueprintDelegate = createBlockFromBlueprintDelegate; this.updateBlockDelegate = updateBlockDelegate; FindFields(); floatingGridHandler = new DockingManager.ContentHandler(HideScriptSlotsOnFloatingGrid); mainGridHandler = new PropertyGrid.SelectedObjectChangedEventHandler(HideScriptSlotsOnMainGrid); } catch (Exception x) { MessageBox.Show("Something went wrong when modifying the toolset UI." + Environment.NewLine + x); throw x; } }