/// <summary> /// Shows the smart part. /// </summary> /// <typeparam name="TView"></typeparam> /// <param name="id">The id.</param> /// <param name="spi">The spi.</param> /// <returns></returns> public TView ShowSmartPart <TView>(string id, XtraNavBarGroupSmartPartInfo spi) { TView view = default(TView); view = WorkItem.SmartParts.Get <TView>(id); if (view == null) { view = WorkItem.SmartParts.AddNew <TView>(id); } IWorkspace wp = WorkItem.Workspaces.Get(UIExtensionSiteNames.Shell_Workspace_Taskbar); if (wp != null) { wp.Show(view, spi); } return(view); }
private void AddShowNavBarGroups(IWorkspace navbarWorkspace) { SmartParts.AddNew <UserInfoView>("UserInfo"); //named because it will be used in a placeholder var customerView = SmartParts.AddNew <CustomerView>(); var statisticsBarView = SmartParts.AddNew <StatisticsBarView>(SmartPartNames.Statistics); var customerInfo = new XtraNavBarGroupSmartPartInfo { Title = "Customers", LargeImage = Resources.customersLarge, SmallImage = Resources.customersSmall }; var statsInfo = new XtraNavBarGroupSmartPartInfo { Title = "Statistics", LargeImage = Resources.statsLarge, SmallImage = Resources.statsSmall }; navbarWorkspace.Show(customerView, customerInfo); navbarWorkspace.Show(statisticsBarView, statsInfo); }
public void CanShowAndCloseAndHide_XtraNavBarWorkspace() { var navbarWorkspace = new XtraNavBarWorkspace(); var smartPartInfo = new XtraNavBarGroupSmartPartInfo { Title = "Test Title" }; navbarWorkspace.Groups.Count.ShouldEqual(0); // show the workspace navbarWorkspace.Show(_smartPart, smartPartInfo); navbarWorkspace.Groups.Count.ShouldEqual(1); navbarWorkspace.Groups[0].GroupStyle.ShouldEqual(NavBarGroupStyle.ControlContainer); // hide and the group still exists, but not visible navbarWorkspace.Hide(_smartPart); navbarWorkspace.Groups.Count.ShouldEqual(1); navbarWorkspace.Groups[0].Visible.ShouldBeFalse(); // close removes navbarWorkspace.Close(_smartPart); navbarWorkspace.Groups.Count.ShouldEqual(0); }