public override void Action() { Tab tab = (Tab)control; ITabPage iTabPage = tab.Pages.Where(x => x.Name.Replace(" ", "").Contains(criteria)).FirstOrDefault(); TabPage tabPage = (TabPage)iTabPage; if (actionType == ActionType.click) { tabPage.Click(); return; } if (actionType == ActionType.doubleClick) { tabPage.DoubleClick(); return; } if (actionType == ActionType.select) { tabPage.Select(); return; } throw new Exception($"Control Doesn't Accept Action Type {actionType}"); }
public void FindControlsInsideTab() { ITabPage springTab = Window.Get <Tab>("seasons").SelectedTab; Assert.AreNotEqual(null, springTab); Window.Get <Button>("springyButton"); }
public void review_TabPages(ITabPage page) { TabPage tabPage = (TabPage)page; Console.WriteLine($""); Console.WriteLine($"Page Name: {page.Name}"); Console.WriteLine($"TabPage Name: {tabPage.Name}"); Console.WriteLine($"Page Id: {page.Id}"); Console.WriteLine($"TabPage Id: {tabPage.Id}"); Console.WriteLine($"Page Location: {page.Location}"); Console.WriteLine($"TabPage Location: {tabPage.Location}"); Console.WriteLine($"TabPage ItemCount: {tabPage.Items.Count}"); var x = tabPage.Items; int track = 0; foreach (var y in x) { Console.WriteLine($"Item #: {track}"); Console.WriteLine($"Item Name: {y.Name}"); Console.WriteLine($"Item Id: {y.Id}"); Console.WriteLine($"Item Location: {y.Location}"); Console.WriteLine($"Item Type: {y.GetType()}"); } }
/// <summary> /// Creates a panel to display a business object /// </summary> /// <returns>Returns the panel info object containing the panel</returns> public IPanelFactoryInfo CreatePanel() { IPanelFactoryInfo factoryInfo; _firstControl = null; if (_uiForm.Count > 1) { IPanel mainPanel = _controlFactory.CreatePanel(_controlFactory); ControlMapperCollection controlMappers = new ControlMapperCollection(); IDictionary <string, IEditableGridControl> formGrids = new Dictionary <string, IEditableGridControl>(); ITabControl tabControl = _controlFactory.CreateTabControl(); BorderLayoutManager mainPanelManager = _controlFactory.CreateBorderLayoutManager(mainPanel); mainPanelManager.AddControl(tabControl, BorderLayoutManager.Position.Centre); foreach (UIFormTab formTab in _uiForm) { IPanelFactoryInfo onePanelInfo = CreateOnePanel(formTab); AddControlMappers(onePanelInfo, controlMappers); AddFormGrids(onePanelInfo, formGrids); ITabPage page = _controlFactory.CreateTabPage(formTab.Name); BorderLayoutManager manager = _controlFactory.CreateBorderLayoutManager(page); manager.AddControl(onePanelInfo.Panel, BorderLayoutManager.Position.Centre); tabControl.TabPages.Add(page); } factoryInfo = new PanelFactoryInfo(mainPanel, controlMappers, _uiDefName, _firstControl); factoryInfo.FormGrids = formGrids; } else { factoryInfo = CreateOnePanel(_uiForm[0]); } SetFormPreferredHeight(factoryInfo); //TODO_Port AttachTriggers(_uiForm, factoryInfo, _currentBusinessObject); return(factoryInfo); }
private void ReloadCurrentCollection() { _tabControl.SelectedIndexChanged -= TabChangedHandler; ClearTabPages(); Dictionary <string, object> list = GetBusinessObjectDisplayValueDictionary(); foreach (KeyValuePair <string, object> pair in list) { BusinessObject businessObject = pair.Value as BusinessObject; if (businessObject != null) { ITabPage page = _controlFactory.CreateTabPage(pair.Key); //page.Text = ; AddTabPage(page, businessObject); } } //foreach (BusinessObject bo in businessObjectCollection) //{ // TabPage page = new TabPage(bo.ToString()); // //page.Text = ; // AddTabPage(page, bo); //} if (_businessObjectCollection.Count > 0) { _tabControl.SelectedIndex = 0; } _tabControl.SelectedIndexChanged += TabChangedHandler; TabChanged(); }
public void Test_WhenUsingCreator_WhenSetBOCol_ShouldCreateTabPageWithControlFromCreator() { //---------------Set up test pack------------------- BusinessObjectControlCreatorDelegate creator; BOColTabControlManager selectorManager = GetselectorManager(out creator); MyBO expectedBO = new MyBO(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> { expectedBO }; //---------------Assert Precondition---------------- Assert.IsNotNull(selectorManager.BusinessObjectControlCreator); Assert.AreEqual(creator, selectorManager.BusinessObjectControlCreator); Assert.AreEqual(0, selectorManager.TabControl.TabPages.Count); //---------------Execute Test ---------------------- selectorManager.BusinessObjectCollection = myBoCol; //---------------Test Result ----------------------- Assert.AreEqual(1, selectorManager.TabControl.TabPages.Count); ITabPage page = selectorManager.TabControl.TabPages[0]; Assert.AreEqual(1, page.Controls.Count); IControlHabanero boControl = page.Controls[0]; Assert.IsInstanceOf(TypeOfBusinessObjectControl(), boControl); IBusinessObjectControl businessObjectControl = (IBusinessObjectControl)boControl; Assert.AreSame(expectedBO, businessObjectControl.BusinessObject); Assert.AreSame(boControl, selectorManager.BusinessObjectControl); }
public string getWindowDetails(Window window) { if (window.Id != "") { if (window.Id == "HomeHealthDesktop") { Tab tab = (Tab)windowTools.GetIUIItemList <Tab>(window)[0]; ITabPage iTabPage = tab.Pages.Where(x => x.IsSelected).FirstOrDefault(); if (iTabPage.Name.Replace(" ", "").Contains("EditCarePlan")) { return($"Id_{window.Id}_EditCarePlan_items_{window.Items.Count}"); } return($"Id_{window.Id}_{iTabPage.Name.Replace(" ","")}_items_{window.Items.Count}"); } return($"Id_{window.Id}_items_{window.Items.Count}"); } if (window.Name != "") { return($"Name_{window.Name.Replace(" ","")}_items_{window.Items.Count}"); } if (window.PrimaryIdentification != "") { return($"Prime_{window.PrimaryIdentification}_items_{window.Items.Count}"); } return($"LOC_{window.Location.X}_{window.Location.Y}_items_{window.Items.Count}"); }
/// <summary> /// Удаляет указанную страницу. /// </summary> public void RemovePage(ITabPage page) { var tabPage = page.GetControl <BaseLayoutItem>(); Control.RemovePage(tabPage); page.SetParent(null); }
/// <summary> /// Удаляет указанную страницу. /// </summary> public void RemovePage(ITabPage page) { var tabPage = page.GetControl <DXTabItem>(); Control.Items.Remove(tabPage); page.SetParent(null); }
public List <IUIItem> getTabItems <T>(ITabPage page) where T : IUIItem, new() { TabPage tabPage = (TabPage)page; List <IUIItem> items = tabPage.Items.Where(x => x.GetType() == typeof(T)).ToList(); return(items); }
/// <summary> /// Adds a tab page to the end of the tab order /// </summary> /// <param name="page">The Tab Page to be added to the Tab Control</param> protected virtual void AddTabPageToEnd(ITabPage page) { TabControl.TabPages.Add(page); IBusinessObjectControl boControl = this.GetBusinessObjectControl(page); FireTabPageAdded(page, boControl); }
// 必须是控件,System.Windows.Forms.Controls public void AddPage(ITabPage page) { if (page is Control) { TabPage tabpage = new TabPage(); tabpage.BorderStyle = BorderStyle.None; tabpage.BackColor = Color.Transparent; tabpage.BackgroundImage = Hydrology.Properties.Resources.状态栏; tabpage.SuspendLayout(); this.Controls.Add(tabpage); tabpage.Controls.Add((Control)page); tabpage.Name = page.Title; if (page.BTabRectClosable) { tabpage.Text = page.Title + S_C_IMAGEHOLDER; } else { tabpage.Text = page.Title; } tabpage.UseVisualStyleBackColor = true; tabpage.TabIndex = m_listPage.Count; tabpage.ResumeLayout(false); page.TabPageIndex = m_listPage.Count; m_listPage.Add(page); //添加到集合,便于管理 //绑定消息 page.TabClosed -= new EventHandler(this.EHTabClosed); page.TabClosed += new EventHandler(this.EHTabClosed); }//end of if }
public void Test_WhenChangeTabIndex_ShouldNotRecreateTheBOControl() { //---------------Set up test pack------------------- BusinessObjectControlCreatorDelegate creator; BOColTabControlManager selectorManager = GetselectorManager(out creator); MyBO firstBO = new MyBO(); MyBO secondBO = new MyBO(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> { firstBO, secondBO }; selectorManager.BusinessObjectCollection = myBoCol; ITabPage firstTabPage = selectorManager.TabControl.TabPages[0]; IBusinessObjectControl firstBOControl = (IBusinessObjectControl)firstTabPage.Controls[0]; ITabPage secondTabPage = selectorManager.TabControl.TabPages[1]; IBusinessObjectControl secondBOControl = (IBusinessObjectControl)secondTabPage.Controls[0]; //---------------Assert Precondition---------------- Assert.AreSame(secondBO, secondBOControl.BusinessObject); Assert.AreSame(firstBOControl, selectorManager.BusinessObjectControl); Assert.AreEqual(2, selectorManager.TabControl.TabPages.Count); Assert.AreEqual(0, selectorManager.TabControl.SelectedIndex); //---------------Execute Test ---------------------- selectorManager.CurrentBusinessObject = secondBO; //---------------Test Result ----------------------- Assert.AreEqual(1, selectorManager.TabControl.SelectedIndex); Assert.AreSame(secondBOControl, secondTabPage.Controls[0]); Assert.AreSame(secondBOControl, selectorManager.BusinessObjectControl); }
public WindowsProjectBrowserService(IServiceProvider services, ITabPage tabPage, ITreeView treeView) : base(services, tabPage, treeView) { this.tree.DragEnter += tree_DragEnter; this.tree.DragOver += tree_DragOver; this.tree.DragDrop += tree_DragDrop; this.tree.DragLeave += tree_DragLeave; this.tree.MouseWheel += tree_MouseWheel; }
void FindControlsInsideTab() { tab.SelectTabPage(1); ITabPage selectedTab = tab.SelectedTab; Assert.NotNull(selectedTab); Assert.NotNull(selectedTab.Get <TextBox>("TextBox")); }
/// <summary> /// measures the header sections /// </summary> /// <param name="start">the tabpage where to start. set NULL to remeasure all</param> public void Reload(Section section, ITabPage start) { if (!this.Owner.Pages.Contains(start)) { start = null; } OnReload(section, start); }
public ProjectBrowserService(IServiceProvider services, ITabPage tabPage, ITreeView treeView) { this.Services = services; this.tabPage = tabPage; this.tree = treeView; this.mpitemToDesigner = new Dictionary <object, TreeNodeDesigner>(); this.tree.AfterSelect += tree_AfterSelect; }
/// <summary> /// Добавляет указанную страницу. /// </summary> public void AddPage(ITabPage page) { var tabPage = page.GetControl <BaseLayoutItem>(); tabPage.Tag = page; Control.AddPage(tabPage); page.SetParent(this); }
public void AddTab(ITabPage tabPage) { TabPages.Add(tabPage); SelectedTabIndex = TabPages.Count - 1; OnPropertyChanged(nameof(SelectedTabIndex)); tabPage.CloseRequested += delegate { RemoveTabPage(tabPage); }; }
/// <summary> /// Returns the business object represented in the specified tab page /// </summary> /// <param name="tabPage">The tab page</param> /// <returns>Returns the business object, or null if not available /// </returns> public IBusinessObject GetBo(ITabPage tabPage) { if (tabPage == null) { return(null); } return(_pageBoTable.ContainsKey(tabPage) ? _pageBoTable[tabPage] : null); }
/// <summary> /// Добавляет указанную страницу. /// </summary> public void AddPage(ITabPage page) { var tabPage = page.GetControl <DXTabItem>(); tabPage.Tag = page; Control.Items.Add(tabPage); page.SetParent(this); }
/// <summary> /// This handler is called when a business object has been removed from /// the collection - it subsequently removes the item from the ListBox /// list as well. /// </summary> /// <param name="sender">The object that notified of the change</param> /// <param name="e">Attached arguments regarding the event</param> private void BusinessObjectRemovedHandler(object sender, BOEventArgs e) { ITabPage page = GetTabPage(e.BusinessObject); TabControl.Controls.Remove(page); IBusinessObjectControl boControl = this.GetBusinessObjectControl(page); FireTabPageRemoved(page, boControl); }
public void RemovePage(ITabPage page) { this.TabPages.RemoveAt(page.TabPageIndex); m_listPage.RemoveAt(page.TabPageIndex); // 更新其它页面的索引吧? for (int i = 0; i < m_listPage.Count; ++i) { m_listPage[i].TabPageIndex = i; } }
/// <summary> /// Returns the business object at the specified row number /// </summary> /// <param name="row">The row number in question</param> /// <returns>Returns the busines object at that row, or null /// if none is found</returns> public IBusinessObject GetBusinessObjectAtRow(int row) { if (IndexOutOfRange(row)) { return(null); } ITabPage page = TabControl.TabPages[row]; return(GetBo(page)); }
private void FireTabPageRemoved(ITabPage tabPage, IBusinessObjectControl boControl) { if (this.TabPageRemoved == null) { return; } TabPageEventArgs eventArgs = new TabPageEventArgs(tabPage, boControl); this.TabPageRemoved(this, eventArgs); }
/// <summary> /// Retrieves the index of the specified tab page in the collection /// </summary> /// <returns>A zero-based index value that represents the position of the specified /// tab page in the collection</returns> public int IndexOf(ITabPage page) { for (int pagePos = 0; pagePos < _tabPages.Count; pagePos++) { if (page == _tabPages[pagePos]) { return(pagePos); } } return(-1); }
/// <summary> /// returns the Business Object control for any particular Tab. /// </summary> /// <param name="selectedTab"></param> /// <returns></returns> protected virtual IBusinessObjectControl GetBusinessObjectControl(ITabPage selectedTab) { if (selectedTab.Controls.Count > 0) { IControlHabanero control = selectedTab.Controls[0]; if (typeof(IBusinessObjectControl).IsInstanceOfType(control)) { return((IBusinessObjectControl)control); } } return(null); }
private void RemoveTabPage(ITabPage tabPage) { if (tabPage.CanClose) { TabPages.Remove(tabPage); if (tabPage is IDisposable disposable) { disposable.Dispose(); } } }
private static void OnTabContentPropertyChanged(BindableObject bindable, object oldValue, object newValue) { TabPage _this = (TabPage)bindable; ITabPage tab = _this.TabContent; var selector = _this.TabControlSelector; if (tab.IsNull() || selector.IsNull()) { return; } selector.ApplyTemplate(_this.cv, tab); }
private void Factory_InitializeTabPage(AddOnFactory factory, string assemblyName, string typeFullName, IHost host) { //Create ITabPage <TMap, TEntry, TXbox> tabPage = factory.CreateInstance <ITabPage <TMap, TEntry, TXbox> >(assemblyName, typeFullName); tabPage.Initialize(host); //Add addOns.Add(tabPage); haloAddOns.Add(tabPage); xboxAddOns.Add(tabPage); tabPages.Add(tabPage); }
protected virtual void OnReload(Section section, ITabPage start) { }
private void FireTabPageRemoved(ITabPage tabPage, IBusinessObjectControl boControl) { if (this.TabPageRemoved == null) return; TabPageEventArgs eventArgs = new TabPageEventArgs(tabPage, boControl); this.TabPageRemoved(this, eventArgs); }
/// <summary> /// returns the Business Object control for any particular Tab. /// </summary> /// <param name="selectedTab"></param> /// <returns></returns> protected virtual IBusinessObjectControl GetBusinessObjectControl(ITabPage selectedTab) { if (selectedTab.Controls.Count > 0) { IControlHabanero control = selectedTab.Controls[0]; if (typeof (IBusinessObjectControl).IsInstanceOfType(control)) { return (IBusinessObjectControl) control; } } return null; }
/// <summary> /// Adds the necessagry indexing for a Business Object and TabPage relationship. /// </summary> /// <param name="bo">The Business Object related to the Tab Page</param> /// <param name="page">The Tab Page related to the Business Object</param> protected virtual void AddBoPageIndexing(IBusinessObject bo, ITabPage page) { _pageBoTable.Add(page, bo); _boPageTable.Add(bo, page); }
/// <summary> /// Adds a tab page to the end of the tab order /// </summary> /// <param name="page">The Tab Page to be added to the Tab Control</param> protected virtual void AddTabPageToEnd(ITabPage page) { _tabControl.TabPages.Add(page); }
/// <summary> /// Returns the business object represented in the specified tab page /// </summary> /// <param name="tabPage">The tab page</param> /// <returns>Returns the business object, or null if not available /// </returns> public IBusinessObject GetBo(ITabPage tabPage) { if (tabPage == null) return null; if (_pageBoTable.ContainsKey(tabPage)) { return _pageBoTable[tabPage]; } else { return null; } }
/// <summary> /// Adds a tab page to represent the given business object /// </summary> /// <param name="page">The TabPage object to add</param> /// <param name="bo">The business ojbect to represent</param> protected virtual void AddTabPage(ITabPage page, IBusinessObject bo) { AddTabPageToEnd(page); AddBoPageIndexing(bo, page); }
/// <summary> /// Retrieves the index of the specified tab page in the collection /// </summary> /// <returns>A zero-based index value that represents the position of the specified /// tab page in the collection</returns> public int IndexOf(ITabPage page) { for (int pagePos = 0; pagePos < _tabPages.Count; pagePos++) { if (page == _tabPages[pagePos]) { return pagePos; } } return -1; }
/// <summary> /// Returns the business object represented in the specified tab page /// </summary> /// <param name="tabPage">The tab page</param> /// <returns>Returns the business object, or null if not available /// </returns> public IBusinessObject GetBo(ITabPage tabPage) { if (tabPage == null) return null; return _pageBoTable.ContainsKey(tabPage) ? _pageBoTable[tabPage] : null; }
/// <summary> /// Adds a tab page to the collection /// </summary> public void Add(ITabPage page) { _tabPages.Add((TabPage)page); }
/// <summary> /// measures the header sections /// </summary> /// <param name="start">the tabpage where to start. set NULL to remeasure all</param> public void Reload(Section section, ITabPage start) { if (!this.Owner.Pages.Contains(start)) start = null; OnReload(section, start); }
/// <summary> /// Adds a tab page to represent the given business object /// </summary> /// <param name="page">The TabPage object to add</param> /// <param name="bo">The business ojbect to represent</param> protected virtual void AddTabPage(ITabPage page, IBusinessObject bo) { // Only load the BusinessObject into the BO control on each tab if the BusinessObjectControlCreator is being used. // The related logic to this is in the TabChanged event where the business object is only loaded into the bo control when a // single BO Control instance is being used. if (BusinessObjectControlCreator != null) { IBusinessObjectControl businessObjectControl = BusinessObjectControlCreator(); businessObjectControl.Dock = DockStyle.Fill; businessObjectControl.BusinessObject = bo; page.Controls.Add(businessObjectControl); } AddTabPageToEnd(page); AddBoPageIndexing(bo, page); }
/// <summary> /// Constructor to initialise a new set of arguments /// </summary> /// <param name="tabPage">The related business object</param> /// <param name="boControl"></param> public TabPageEventArgs(ITabPage tabPage, IBusinessObjectControl boControl) { _tabPage = tabPage; _boControl = boControl; }
public TabPageWithListBoxHelper(ITabPage tab, Window window) { _tab = tab; _window = window; }
protected override void OnReload(HeaderModule.Section section, ITabPage start) { if ((section & HeaderModule.Section.Headers) != 0) { #region remeasure headers bool remeasure = start == null; //manage paths array while (_paths.Count > this.Owner.Pages.Count) { GraphicsPath path = (GraphicsPath)_paths[0]; _paths.RemoveAt(0); path.Dispose(); } while (_paths.Count < this.Owner.Pages.Count) { _paths.Add(new GraphicsPath()); } //remeasure tabs int x = 1, width; using (Graphics gr = this.Owner.CreateGraphics()) { for (int i = 0; i < this.Owner.Pages.Count; i++) { ITabPage page = this.Owner.Pages[i]; GraphicsPath path = (GraphicsPath)_paths[i]; if (start == page) remeasure = true; if (!remeasure) { x = (int)(path.GetBounds().Right) - 10; continue; } #region measure header if (page.Caption == null || page.Caption == "") width = 24; else width = Math.Min(this.MaxHeaderWidth, 24 + (int)gr.MeasureString(page.Caption, _fontactive).Width); path.Reset(); path.AddCurve(//create tab shape new Point[]{new Point(x,19), new Point(x+12,7), new Point(x+19,3)}, 0.7f); path.AddLine(x + 19, 3, x + width - 2, 3); path.AddLine(x + width, 5, x + width, 19); #endregion x += width - 10; } } #endregion } if ((section & HeaderModule.Section.Browser) != 0) { #region tabs button //manage contextmenu while (_mnu.MenuItems.Count > this.Owner.Pages.Count) { MenuItem item = _mnu.MenuItems[0]; _mnu.MenuItems.RemoveAt(0); item.Dispose(); } while (_mnu.MenuItems.Count < this.Owner.Pages.Count) { _mnu.MenuItems.Add(new MenuItem("item", new EventHandler(MenuItem_Click))); } //reset defaultitems foreach (MenuItem item in _mnu.MenuItems) item.DefaultItem = false; //update captions for (int i = 0; i < this.Owner.Pages.Count; i++) { ITabPage page = this.Owner.Pages[i]; _mnu.MenuItems[i].Text = page.Caption; if (page == this.Owner.SelectedPage) _mnu.MenuItems[i].DefaultItem = true; } _tabsstate = _mnu.MenuItems.Count > 0 ? ButtonState.Normal : ButtonState.Inactive; #endregion } if ((section & HeaderModule.Section.CloseButton) != 0) { #region close button ButtonState state = ( this.Owner.SelectedPage != null && this.Owner.SelectedPage.CanClose) ? ButtonState.Normal : ButtonState.Inactive; if (_closestate != state) { _closestate = state; Refresh(Section.CloseButton); } #endregion } }