public virtual void Initialize() { // Create the SmartPartInfo object for the default ExplorerView to be put in the ExplorerWorkspace UltraExplorerBarSmartPartInfo explorerInfo = new UltraExplorerBarSmartPartInfo(); explorerInfo.Image = WorkItem.Image; explorerInfo.Title = WorkItem.Title; explorerInfo.Description = WorkItem.Description; // Create the SmartPartInfo object for default TabView to be put in the TabWorkspace UltraTabSmartPartInfo tabInfo = new UltraTabSmartPartInfo(); tabInfo.Image = WorkItem.Image; tabInfo.Title = WorkItem.Title; tabInfo.Description = WorkItem.Description; // Create the SmartPartInfo object for the default SettingsTabView UltraTabSmartPartInfo settingsInfo = new UltraTabSmartPartInfo(); settingsInfo.Image = WorkItem.Image; settingsInfo.Title = WorkItem.Title; settingsInfo.ActivateTab = false; WorkItem.ToolbarsController.Initialize(); if (WorkItem.ExplorerView != null) { // Show the ExplorerView try { WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ExplorerWorkspace].Show(WorkItem.ExplorerView, explorerInfo); currentExplorerView = WorkItem.ExplorerView; } catch (Exception) { } } if (WorkItem.TabView != null) { // Show the TabView WorkItem.RootWorkItem.Workspaces[WorkspaceNames.TabWorkspace].Show(WorkItem.TabView, tabInfo); currentTabView = WorkItem.TabView; } if (WorkItem.SettingsView != null) { // Show the SettingsTabView WorkItem.RootWorkItem.Workspaces[WorkspaceNames.SettingsTabWorkspace].Show(WorkItem.SettingsView, settingsInfo); } if (WorkItem.ToolbarsController != null) { // Get the Toolbars Workspace and set the RibbonTab UltraToolbarsManagerWorkspace toolbarsWorkspace = (UltraToolbarsManagerWorkspace)WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ToolbarsWorkspace]; toolbarsWorkspace.Ribbon.SelectedTab = WorkItem.ToolbarsController.RibbonTab; } // Activate the WorkItem WorkItem.Activate(); }
public LaytonToolbarsController([ServiceDependency] WorkItem workItem) { this.WorkItem = workItem; this.toolbarsWorkspace = workItem.Workspaces[WorkspaceNames.ToolbarsWorkspace] as UltraToolbarsManagerWorkspace; this.tabWorkspace = workItem.Workspaces[WorkspaceNames.TabWorkspace] as UltraTabWorkspace; this.explorerWorkspace = workItem.Workspaces[WorkspaceNames.ExplorerWorkspace] as UltraExplorerBarWorkspace; // listen for the tool click event from the toolbarworkspace this.toolbarsWorkspace.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(toolbarsWorkspace_ToolClick); this.toolbarsWorkspace.AfterRibbonTabSelected += new RibbonTabEventHandler(toolbarsWorkspace_AfterRibbonTabSelected); }
public virtual void ActivateWorkItem() { if (WorkItem.ExplorerView != null && WorkItem.TabView != null && WorkItem.ToolbarsController != null) { // AC: For some reason the explorerbar for the last module loaded, has issues when activating for the first time // it appears that the ActiveSmartPart value for the ExplorerWorkspace is always set to the last module - even though // a different WorkItem's Explorer Workspace view is displayed - the code below works around the issue if (WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ExplorerWorkspace].ActiveSmartPart == WorkItem.ExplorerView) { WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ExplorerWorkspace].Hide(WorkItem.ExplorerView); } // Show the TabView and ExplorerView // First try setting the ExplorerWorkspace/TabWorkspace to use the last shown views for this WorkItem // ...otherwise set the main view to the default ExplorerView/TabView if (currentExplorerView != null) { try { WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ExplorerWorkspace].Show(currentExplorerView); } catch (Exception) { } } else { WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ExplorerWorkspace].Show(WorkItem.ExplorerView); currentExplorerView = WorkItem.ExplorerView; } // Now the TabWorkspace... if (currentTabView != null) { WorkItem.RootWorkItem.Workspaces[WorkspaceNames.TabWorkspace].Show(currentTabView); } else { WorkItem.RootWorkItem.Workspaces[WorkspaceNames.TabWorkspace].Show(WorkItem.TabView); currentTabView = WorkItem.TabView; } // Get the Toolbars Workspace and set the RibbonTab UltraToolbarsManagerWorkspace toolbarsWorkspace = (UltraToolbarsManagerWorkspace)WorkItem.RootWorkItem.Workspaces[WorkspaceNames.ToolbarsWorkspace]; toolbarsWorkspace.Ribbon.SelectedTab = WorkItem.ToolbarsController.RibbonTab; // Activate the WorkItem WorkItem.Activate(); } }