internal void SetItems() { Items = new TabItemCollection(); Profile_page page1 = new Profile_page(); // Questions_Select_layout page2 = new Questions_Select_layout(); Learning_Demo page3 = new Learning_Demo(); Side_Learn_type_one page4 = new Side_Learn_type_one(); Present_page page2 = new Present_page(); Items.Add(new SfTabItem { Content = page1.Content, Title = "Profile" }); Items.Add(new SfTabItem { Content = page2.Content, Title = "Context" }); Items.Add(new SfTabItem { Content = page3.Content, Title = "Test" }); Items.Add(new SfTabItem { Content = page4.Content, Title = "Settings" }); }
private void CreateTabView() { SfTabView tabView = new SfTabView(); var TabItems = new TabItemCollection(); TabItems.Add(new SfTabItem() { Title = "Tab 1", Content = new Datagrid() }); TabItems.Add(new SfTabItem() { Title = "Tab 2", Content = new TreeView() }); TabItems.Add(new SfTabItem() { Title = "Tab 3", Content = new TabContent() }); TabItems.Add(new SfTabItem() { Title = "Tab 4", Content = new StackLayout { BackgroundColor = Color.LightGreen } }); TabItems.Add(new SfTabItem() { Title = "Tab 5", Content = new StackLayout { BackgroundColor = Color.LightSkyBlue } }); tabView.Items = TabItems; stack.Children.Add(tabView); }
public MainViewModel(IMaskingCreationViewModelFactory maskingCreationViewModelFactory, IEnumerable <ITabBehavior> tabBehaviors) { foreach (var tabBehavior in tabBehaviors) { TabItemCollection.Add(maskingCreationViewModelFactory.Create(tabBehavior)); } SelectedTabItem = TabItemCollection.FirstOrDefault(); }
public void ShowItem(ITabItem item) { //bool isnew = false; LayoutDocument ldoc = null; if (item is FuncBlockViewModel) { FuncBlockViewModel fbvmodel = (FuncBlockViewModel)item; fbvmodel.CodeTextBox.Focus(); } if (item.IsFloat) { LayoutFloatingWindowControl fwctrl = item.FloatControl; fwctrl.Focus(); return; } if (!TabItemCollection.Contains(item)) { TabItemCollection.Add(item); item.FloatClosed += OnTabFloatClosed; ldoc = new LayoutDocument(); ldoc.Title = item.TabHeader; if (item is LadderDiagramViewModel) { IEnumerable <MainTabDiagramItem> fit = DiagramCollection.Where( (MainTabDiagramItem _mtditem) => { return(_mtditem.LDVM_ladder == item); }); MainTabDiagramItem mtditem = null; if (fit.Count() == 0) { mtditem = new MainTabDiagramItem((IProgram)item, ViewMode); DiagramCollection.Add(mtditem); } else { mtditem = fit.First(); } ldoc.Content = mtditem; } else { ldoc.Content = item; } ldoc.IsActiveChanged += OnActiveChanged; Children.Add(ldoc); _lDocDict.Add(item, ldoc); //isnew = true; } else { ldoc = _lDocDict[item]; } int ldocid = Children.IndexOf(ldoc); SelectedItem = item; SelectedContentIndex = ldocid; }
internal void SetItems() { Items = new TabItemCollection(); TabViewItemPage1 page1 = new TabViewItemPage1(); TabViewItemPage2 page2 = new TabViewItemPage2(); TabViewItemPage3 page3 = new TabViewItemPage3(); TabViewItemPage4 page4 = new TabViewItemPage4(); Items.Add(new SfTabItem { Content = page1.Content, Title = "Page1" }); Items.Add(new SfTabItem { Content = page2.Content, Title = "Page2" }); Items.Add(new SfTabItem { Content = page3.Content, Title = "Page3" }); Items.Add(new SfTabItem { Content = page4.Content, Title = "Page4" }); }
public void AddNewTabEmpty(object obj) { if (TabItemCollection.Where(x => x.NewTabButtonVisibility == true).Count() == 0) { TabItem newTab = new TabItem(Model, resolver); newTab.SearchBar.Title = (string)System.Windows.Application.Current.FindResource(NewTabMessage); HideAllHompageContainerItems(); NewTabButtonVisibility = true; TabItemCollection.Add(newTab); } ShowAddNewTabIfNeeded(); }
internal void SetTabItems() { TabItems = new TabItemCollection(); SymptomsPage page1 = new SymptomsPage(); PreventionPage page2 = new PreventionPage(); TabItems.Add(new SfTabItem { Content = page1.Content, Title = "Sintomas", TitleFontSize = 20, SelectionColor = Color.FromHex("#3F94B5"), TitleFontColor = Color.FromHex("#99A6C0"), }); TabItems.Add(new SfTabItem { Content = page2.Content, Title = "Prevenção", TitleFontSize = 20, SelectionColor = Color.FromHex("#3F94B5"), TitleFontColor = Color.FromHex("#99A6C0"), }); }
protected override void OnChildrenCollectionChanged() { base.OnChildrenCollectionChanged(); foreach (ITabItem tab in TabItemCollection) { if (tab.IsFloat) { continue; } if (!_lDocDict.ContainsKey(tab)) { continue; } LayoutDocument ldoc = _lDocDict[tab]; if (!Children.Contains(ldoc)) { CloseItem(tab); return; } } foreach (var child in Children) { ITabItem tab = null; if (child.Content is MainTabDiagramItem) { tab = ((MainTabDiagramItem)(child.Content)).LDVM_ladder; } else if (child.Content is ITabItem) { tab = (ITabItem)(child.Content); } if (tab != null && !TabItemCollection.Contains(tab)) { TabItemCollection.Add(tab); _lDocDict.Add(tab, (LayoutDocument)child); } if (child.IconSource == null && child.Content is MainTabDiagramItem) { child.ImageSource = IconManager.RoutineImage; } else if (child.IconSource == null && child.Content is FuncBlockViewModel) { child.ImageSource = IconManager.FuncImage; } else if (child.IconSource == null && child.Content is ModbusTableViewModel) { child.ImageSource = IconManager.ModbusImage; } } }
public void ShowAddNewTabIfNeeded() { int count = TabItemCollection.Where(x => x.NewTabButtonVisibility == true).Count(); if (count == 0) { if (TabItemCollection.Count < MAX_TAB_COUNT) { TabItem item = new TabItem(Model, resolver); TabItemCollection.Add(item); } } if (TabItemCollection.Count > MAX_TAB_COUNT) { var tab = TabItemCollection.FirstOrDefault(x => x.NewTabButtonVisibility); TabItemCollection.Remove(tab); } }
public void OpenInCurrentTabClick(object obj) { if (obj != null) { var favorite = PBData.GetFavorites().Where(x => x.Url == obj.ToString()).FirstOrDefault(); if (favorite != null && this.SelectedTabItem != null) { this.SelectedTabItem.ShowOrHideFavoriteListClick(null); this.SelectedTabItem.WebBrowser.Navigate(favorite.Url); } else if (favorite != null) { TabItem defaultItem = new TabItem(this, resolver); defaultItem.SearchBar.Address = favorite.Url; TabItemCollection.Add(defaultItem); } } else { this.SelectedTabItem.ShowOrHideFavoriteListClick(null); } }
public MainViewModel() { TabItems = new TabItemCollection(); StatusUser = "******"; StatusNetWork = "IP:" + GetIp(); CurrentTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("zh-cn")); Version = "主程序版本:" + Assembly.GetExecutingAssembly().GetName().Version; //Application.ResourceAssembly.GetName().Version; InputData(); TreeNodes = GetChildNodes(Guid.Parse("D7AFCF4C-4DE4-4319-9C22-672569B4860F"), Nodes);// Nodes是我已经获得的一组节点 CloseTabCommand = new RelayCommand <string>(o => CloseTab(o), o => CanCloseTab(o)); SelectedTreeItemChangedCommand = new RelayCommand <TreeNode>(o => SelectedTreeItemChanged(o), o => CanSelectedTreeItemChanged(o)); var tabItem = new TabItemModel(WebUtility.HtmlDecode(""), "主页", "/Pages/Home.xaml", CloseTabCommand, Visibility.Collapsed); TabItems.Add(tabItem); SelectedTabItem = tabItem; //_timer = new DispatcherTimer(); //_timer.Tick += OnTimerTick; //_timer.Interval = new TimeSpan(0, 0, 1); //_timer.Start(); }
void InitializeTabView() { TabItemCollection collection = new TabItemCollection(); tabView = new SfTabView(); tabView.TabHeaderBackgroundColor = UIColor.Clear; tabView.BackgroundColor = UIColor.FromRGB(48, 146, 246); //UIColor.White;//UIColor.FromRGB(48, 146, 246); tabView.TabHeaderBackgroundColor = UIColor.FromRGB(48, 146, 246); //UIColor.White;//UIColor.FromRGB(48, 146, 246); tabView.Frame = new CGRect(0, 0, this.Frame.Width, this.Frame.Height); SfTabItem furnitureTab = new SfTabItem(); furnitureTab.Title = "Furniture"; furnitureTab.IconFont = "A"; furnitureTab.Content = InitializeTabContent("Furniture", 5); furnitureTab.TitleFontColor = UIColor.White; furnitureTab.FontIconFontColor = UIColor.White; furnitureTab.SelectionColor = UIColor.White; furnitureTab.FontIconFont = UIFont.FromName("TabIcons", 20); collection.Add(furnitureTab); SfTabItem clothingTab = new SfTabItem(); clothingTab.IconFont = "C"; clothingTab.Title = "Clothing"; clothingTab.Content = InitializeTabContent("Clothing", 5); clothingTab.TitleFontColor = UIColor.White; clothingTab.FontIconFontColor = UIColor.White; clothingTab.SelectionColor = UIColor.White; clothingTab.FontIconFont = UIFont.FromName("TabIcons", 20); collection.Add(clothingTab); SfTabItem shoesTab = new SfTabItem(); shoesTab.IconFont = "F"; shoesTab.Title = "Shoes"; shoesTab.Content = InitializeTabContent("Shoes", 5); shoesTab.TitleFontColor = UIColor.White; shoesTab.FontIconFontColor = UIColor.White; shoesTab.SelectionColor = UIColor.White; shoesTab.FontIconFont = UIFont.FromName("TabIcons", 20); collection.Add(shoesTab); SfTabItem fruitsTab = new SfTabItem(); fruitsTab.IconFont = "H"; fruitsTab.Title = "Fruits"; fruitsTab.Content = InitializeTabContent("Fruits", 5); fruitsTab.TitleFontColor = UIColor.White; fruitsTab.FontIconFontColor = UIColor.White; fruitsTab.SelectionColor = UIColor.White; fruitsTab.FontIconFont = UIFont.FromName("TabIcons", 20); collection.Add(fruitsTab); SfTabItem toysTab = new SfTabItem(); toysTab.Title = "Toys"; toysTab.IconFont = "K"; toysTab.Content = InitializeTabContent("Toys", 5); toysTab.TitleFontColor = UIColor.White; toysTab.FontIconFontColor = UIColor.White; toysTab.SelectionColor = UIColor.White; toysTab.FontIconFont = UIFont.FromName("TabIcons", 20); collection.Add(toysTab); tabView.Items = collection; Add(tabView); tabView.SelectionIndicatorSettings.Color = UIColor.White; tabView.TabHeight = 60; if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { tabView.TabWidth = 150; } }
private void ItemOpenHomepageItemClick(object obj) { try { //SecureBrowserItem s = (SecureBrowserItem)HomepageItems.FirstOrDefault(x => x.Id == _itemId); if (obj != null) { string _itemId = obj as string; foreach (SecureBrowserItem s in HomepageItems) { if (s.Id == _itemId) { if (s != null) { if (this.SelectedTabItem != null) { string uri = null; SecureItem item = PBData.GetSecureItemById(_itemId); if (item != null) { uri = item.Site.Uri; } else { Site siteItem = PBData.GetSiteById(_itemId); uri = siteItem.Uri; } if (uri != null) { this.SelectedTabItem.ShowOrHideHomepageClick(null); resolver.GetInstanceOf <IInAppAnalytics>().Get <Events.InAppBrowser, bool>().Log(true); if (item != null) { _pbExtSecureBrowserBridge.OneClickLogin(_itemId, true, TabItemCollection.ToList().FindIndex(p => p.TabId == SelectedTabItem.TabId)); } else { this.SelectedTabItem.WebBrowser.Navigate(uri); } } } else { SecureItem item = PBData.GetSecureItemById(_itemId); if (item != null) { TabItem defaultItem = new TabItem(this, resolver); String siteUri = item.Site.Uri; defaultItem.SearchBar.Address = siteUri; TabItemCollection.Add(defaultItem); } } } } } } } catch (Exception ex) { logger.Error(ex.Message); } }