public void ViewSpotifyBaseObject <TSpotifyObject>(TSpotifyObject viewObject) where TSpotifyObject : SpotifyBaseObject, new() { LoggedInWindowTabItem viewTab = null; viewTab = TabItems.FirstOrDefault(x => x.ViewModel is ViewModelViewObject <TSpotifyObject> vm && vm.ViewSource is TSpotifyObject obj && obj.Id == viewObject.Id); if (viewTab == null) { UserControlViewObject content = new UserControlViewObject(); content.RemoveByEvent += ViewContent_CloseByEvent; viewTab = new LoggedInWindowTabItem(true) { Content = content, //Name = viewObject.Name, name will be set inside of the viewmodel<T> ViewModel = new ViewModelViewObject <TSpotifyObject>(this, viewObject) }; TabItems.Add(viewTab); } SelectedTabItem = viewTab; }
private void AddPingTab() { _tabId++; TabItems.Add(new DragablzPingTabItem(LocalizationManager.GetStringByKey("String_Header_Ping"), new PingView(_tabId), _tabId)); SelectedTabIndex = TabItems.Count - 1; }
public void AddTab(TabItemViewModel vm) { if (vm is VideoViewModel) { VideoTabs.Add(vm); } else if (vm is UserViewModel) { UserTabs.Add(vm); } else if (vm is PublicMylistViewModel) { MylistTabs.Add(vm); } else if (vm is CommunityViewModel) { CommunityTabs.Add(vm); } else if (vm is LiveViewModel) { LiveTabs.Add(vm); } else if (vm is PlayListViewModel) { PlayListTabs.Add(vm); } else { TabItems.Add(vm); } }
protected override void OnControlAdded(ControlEventArgs e) { TabItems.CollectionChanged -= TabItems_CollectionChanged; try { base.OnControlAdded(e); Button btn = (Button)e.Control; btn.Click += Tab_Click; btn.BackColor = TabBackColor; btn.ForeColor = TabForeColor; btn.FlatAppearance.BorderColor = TabBorderColor; btn.FlatAppearance.BorderSize = TabBorderSize; TabItems.Add((Button)e.Control); } catch (Exception) { Controls.Remove(e.Control); MessageBox.Show("Invalid control. Only Button is acceptable."); } finally { TabItems.CollectionChanged += TabItems_CollectionChanged; } }
private void OnRegistrationJournalCommandExecute() { TabItem temp = TabItems.Where(x => (string)x.Header == "Журнал регистрации исследований").FirstOrDefault(); if (temp == null) { RegistrationJournalViewModel window = new RegistrationJournalViewModel(); TabItems.Add(CreateTabItem("Журнал регистрации исследований", window)); } else { SelectedTabItem = temp; } //windowsList.Add((RegistrationJournalViewModel)tempWindow); //var tabItem = new TabItem(); //tabItem.Header = "Журнал регистрации исследований"; //ContentControl contentControl = new ContentControl(); //contentControl.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; //contentControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; //Binding b = new Binding(); //b.Source = regJournalWindow; //b.Source = tempWindow; //b.Converter = new ViewModelToViewConverter(); //contentControl.SetBinding(ContentControl.ContentProperty, b); //tabItem.Content = contentControl; //SelectedTabItem = tabItem; //CurrentWindow = (RegistrationJournalViewModel)tempWindow; //CurrentWindow = windowsList[windowsList.Count - 1]; //CurrentWindow = regJournalWindow; //TabItems.Add(tabItem); }
/// <summary> /// Load tabs opened in previous session. /// </summary> private void LoadPreviousSessionTabs() { foreach (var program in Session.Instance.LoadPrograms()) { TabItems.Add(new TabItem(0, program)); } }
private void AddTab(ViewModelBase obj) { System.Windows.Application.Current.Dispatcher.BeginInvoke((Action)(() => { TabItems.Add(obj); })); }
private void AddPingTab() { _tabId++; TabItems.Add(new DragablzPingTabItem(Application.Current.Resources["String_Header_Ping"] as string, new PingView(_tabId), _tabId)); SelectedTabIndex = TabItems.Count - 1; }
/// <summary> /// 打开新页签(带有参数) /// </summary> /// <param name="barBtnItem"></param> private void TabAddItem(BarButtonItem barBtnItem, string parm) { DXTabItem tabItem = new DXTabItem(); tabItem.Header = barBtnItem.Content; tabItem.AllowHide = DefaultBoolean.True; tabItem.IsSelected = true; string ucName = barBtnItem.Tag.ToString(); Assembly curAssembly = Assembly.GetExecutingAssembly(); object[] parameters = new object[] { parm }; UserControl uc = (UserControl)curAssembly.CreateInstance(ucName, true, System.Reflection.BindingFlags.Default, null, parameters, null, null); tabItem.Content = uc; foreach (DXTabItem item in TabItems) { if (item.Header == tabItem.Header) { return; } } TabItems.Add(tabItem); CurrentTabItem = tabItem; }
private void ConnectSession(Models.RemoteDesktop.RemoteDesktopSessionInfo sessionInfo, string Header = null) { // Add global settings... sessionInfo.AdjustScreenAutomatically = SettingsManager.Current.RemoteDesktop_AdjustScreenAutomatically; sessionInfo.UseCurrentViewSize = SettingsManager.Current.RemoteDesktop_UseCurrentViewSize; if (SettingsManager.Current.RemoteDesktop_UseCustomScreenSize) { sessionInfo.DesktopWidth = SettingsManager.Current.RemoteDesktop_CustomScreenWidth; sessionInfo.DesktopHeight = SettingsManager.Current.RemoteDesktop_CustomScreenHeight; } else { sessionInfo.DesktopWidth = SettingsManager.Current.RemoteDesktop_ScreenWidth; sessionInfo.DesktopHeight = SettingsManager.Current.RemoteDesktop_ScreenHeight; } sessionInfo.ColorDepth = SettingsManager.Current.RemoteDesktop_ColorDepth; sessionInfo.Port = SettingsManager.Current.RemoteDesktop_Port; sessionInfo.EnableCredSspSupport = SettingsManager.Current.RemoteDesktop_EnableCredSspSupport; sessionInfo.AuthenticationLevel = SettingsManager.Current.RemoteDesktop_AuthenticationLevel; sessionInfo.RedirectClipboard = SettingsManager.Current.RemoteDesktop_RedirectClipboard; sessionInfo.RedirectDevices = SettingsManager.Current.RemoteDesktop_RedirectDevices; sessionInfo.RedirectDrives = SettingsManager.Current.RemoteDesktop_RedirectDrives; sessionInfo.RedirectPorts = SettingsManager.Current.RemoteDesktop_RedirectPorts; sessionInfo.RedirectSmartCards = SettingsManager.Current.RemoteDesktop_RedirectSmartCards; TabItems.Add(new DragablzRemoteDesktopTabItem(Header ?? sessionInfo.Hostname, new RemoteDesktopControl(sessionInfo))); SelectedTabIndex = TabItems.Count - 1; }
//ログイン後の初期化処理 public void LogedInInit() { User = new NicoNicoUserEntry(); User.UserId = NicoNicoWrapperMain.Session.UserId; User.UserName = NicoNicoUser.LookupUserName(User.UserId); App.ViewModelRoot.Title += "(user:"******")"; TabItems.Add(WebView = new WebViewViewModel()); TabItems.Add(Ranking = new RankingViewModel()); TabItems.Add(Search = new SearchViewModel()); TabItems.Add(new FavoriteViewModel()); TabItems.Add(new NicoRepoViewModel()); TabItems.Add(new MylistViewModel()); TabItems.Add(NotifyLive = new NotifyLiveViewModel()); TabItems.Add(new HistoryViewModel()); TabItems.Add(new OtherViewModel()); TabItems.Add(Config = new ConfigViewModel()); //生放送通知を更新するタイマーを動かす StatusBar.StartRefreshTimer(); //サーバーからアップデートがあるか確認してあったらアップデートダイアログを出す Update.CheckUpdate(); //公式NG機能を初期化 NGCommentInstance = new NicoNicoNGComment(); //NGCommentInstance.GetNGClient(); if (Environment.GetCommandLineArgs().Length > 1) { Task.Run(() => NicoNicoOpener.Open(Environment.GetCommandLineArgs()[1])); } }
public PopUpViewModel() { DisplayName = "Popup"; TabItems.Add(new TabItem1ViewModel()); TabItems.Add(new TabItem2ViewModel()); SelectedTab = TabItems.FirstOrDefault(); }
public void OpenAttributeTable() { if (MapView.Active.GetSelectedLayers().Count() > 0) { foreach (MapMember mapMember in MapView.Active.GetSelectedLayers()) { if (!TableControlContentFactory.IsMapMemberSupported(mapMember)) { continue; } string layerName = mapMember.Name; if (!TabItems.Select(n => n.TableName).Contains(layerName)) { TabItems.Add(new TabItemViewModel(mapMember, this.Content)); TabControlSelectedIndex = TabItems.Count() - 1; } else { int tabIndex = 0; foreach (var item in TabItems) { if (((TabItemViewModel)item).TableName == layerName) { break; } tabIndex++; } TabControlSelectedIndex = tabIndex; } } } SetTabControlVisibility(); }
public override void LoadTabs() { var tabs = new SortedDictionary <int, ITLCGenTabItem>(); var parts = TLCGenPluginManager.Default.ApplicationParts.Concat(TLCGenPluginManager.Default.ApplicationPlugins); int plugindex = 100; foreach (var part in parts) { if ((part.Item1 & TLCGenPluginElems.TabControl) == TLCGenPluginElems.TabControl) { var attr = part.Item2.GetType().GetCustomAttribute <TLCGenTabItemAttribute>(); if (attr != null && attr.Type == _TabType) { if (attr.Index == -1) { tabs.Add(plugindex++, part.Item2 as ITLCGenTabItem); } else { tabs.Add(attr.Index, part.Item2 as ITLCGenTabItem); } } } } foreach (var tab in tabs) { TabItems.Add(tab.Value); } }
//SimpleView에서 버튼 클릭 시 수행 public void ClickMessage(string serial) { Console.WriteLine("SimpleView Click"); //기존에 생성된 탭 탐색 for (int i = 0; i < TabItems.Count; i++) { DXTabItem tmp = TabItems[i]; if (tmp.Header.ToString() != "홈") { if (((tmp.Content as TabView).DataContext as TabViewModel).Dev.Serial == serial) { Selected_tab = tmp; return; } } } //새로운 탭 생성 DXTabItem tabitem = new DXTabItem(); TabView tabview = new TabView(); foreach (TabViewModel vm in Dev_list) { if (vm.Dev.Serial == serial) { tabview.DataContext = vm; tabitem.Content = tabview; tabitem.Header = "디바이스" + vm.Dev.Dev_num.ToString(); } } TabItems.Add(tabitem); Selected_tab = tabitem; }
/// <summary> /// Opens new tab /// </summary> /// <param name="program">Pass existing program or null for new, fresh tab.</param> private void OpenTab(Program program) { if (TabItems.Count >= 15) { return; } TabItem tabToAdd; if (program != null) { tabToAdd = new TabItem(0, program); } else { var matches = 1; for (int i = 0; i < TabItems.Count; i++) { //if there is "Untitled <nr>" tab, repeat loop to pick another number if (TabItems[i].Header.Contains($"Untitled {matches}")) { matches++; i = -1; } } tabToAdd = new TabItem(matches, null); } TabItems.Add(tabToAdd); SelectedTabItem = tabToAdd; selectedTabItem.ProgramEditor.IsIntellisenseEnabled = IntellisenseIsChecked; selectedTabItem.ProgramEditor.DoSyntaxCheck = SyntaxIsChecked; }
public void AddTab(string host = null) { _tabId++; TabItems.Add(new DragablzTabItem(host ?? LocalizationManager.GetStringByKey("String_Header_NewTab"), new DNSLookupView(_tabId, host), _tabId)); SelectedTabIndex = TabItems.Count - 1; }
public void AddItem(TabItemViewModelBase tab, bool select = true) { TabItems.Add(tab); if (select) { SelectedTab = tab; } }
private void FindClientCommandMethod() { var c = new FindClientTabItemViewModel("Поиск клиента"); c.SelectedClientInfoEvent += C_SelectedClientInfoEvent1;; ; TabItems.Add(c); SelectedItem = c; }
private void OnTest1Execute() { // TODO: Handle command logic here var tabItem = new TabItem(); tabItem.Header = "Test"; TabItems.Add(tabItem); }
private void ConnectSession(Models.PuTTY.PuTTYSessionInfo sessionInfo, string Header = null) { // Add PuTTY path here... sessionInfo.PuTTYLocation = SettingsManager.Current.PuTTY_PuTTYLocation; TabItems.Add(new DragablzPuTTYTabItem(Header ?? sessionInfo.HostOrSerialLine, new PuTTYControl(sessionInfo))); SelectedTabIndex = TabItems.Count - 1; }
public void AddTab(string host = null, string ports = null) { _tabId++; TabItems.Add(new DragablzTabItem(string.IsNullOrEmpty(host) ? LocalizationManager.GetStringByKey("String_Header_NewTab") : host, new PortScannerView(_tabId, host, ports), _tabId)); SelectedTabIndex = TabItems.Count - 1; }
private void AddTab() { _tabId++; TabItems.Add(new DragablzTabItem(LocalizationManager.GetStringByKey("String_Header_NewTab"), new HTTPHeadersView(_tabId), _tabId)); SelectedTabIndex = TabItems.Count - 1; }
private void AddTab(string host = null) { _tabId++; TabItems.Add(new DragablzTabItem(LocalizationManager.GetStringByKey("String_Header_NewTab"), new IPScannerView(_tabId, host), _tabId)); SelectedTabIndex = TabItems.Count - 1; }
public void AddTabItem(object rpItem) { if (!TabItems.Contains(rpItem)) { TabItems.Add(rpItem); } SelectedItem = rpItem; }
public MainViewModel(IDataService dataService) { _dataService = dataService; AppContext.DataSvc = dataService; Messenger.Default.Register <NotificationMessage>(this, AppContext.BlockChangeContextMsg, BlockContext); Messenger.Default.Register <NotificationMessage>(this, AppContext.UnBlockChangeContextMsg, UnBlockContext); MessengerInstance.Register <String>(this, AppContext.BlockUIMsg, BlockUI); MessengerInstance.Register <String>(this, AppContext.UnBlockUIMsg, UnBlockUI); MessengerInstance.Register <EmptyPopUpVM>(this, AppContext.ShowPopUpMsg, ShowPopUp); MessengerInstance.Register <Partition>(this, AppContext.PartitionAddedMsg, PartitionAdded); MessengerInstance.Register <Partition>(this, AppContext.PartitionChangedMsg, PartitionChanged); MessengerInstance.Register <NotificationMessage>(this, AppContext.PartitionRemovedMsg, PartitionRemoved); MessengerInstance.Register <ControlSpace>(this, AppContext.CSRemovedMsg, CSRemoved); MessengerInstance.Register <ControlSpace>(this, AppContext.CSAddedMsg, CSAdded); PopUpVM = new EmptyPopUpVM(); _dataService.GetPartitions((data, error) => { if (error != null) { return; } // Report error here Partitions = data; }); _dataService.GetActiveControlSpaces((data, error) => { if (error != null) { return; } // Report error here ControlSpaces = data; }); PartitionsVM = new PartitionsVM(dataService); ControlSpacesVM = new ControlSpacesVM(dataService); ControlDevicesVM = new ControlDevicesVM(dataService); EventDevicesVM = new EventDevicesVM(dataService); LightElementsVM = new LightElementsVM(dataService); LightZonesVM = new LightZonesVM(dataService); ScenesVM = new ScenesVM(dataService); TabItems.Add(PartitionsVM); TabItems.Add(ControlSpacesVM); TabItems.Add(ControlDevicesVM); TabItems.Add(EventDevicesVM); TabItems.Add(LightElementsVM); TabItems.Add(LightZonesVM); TabItems.Add(ScenesVM); }
private void ExecuteAddTab(object state) { TabItem item = new TabItem(); item.TabName = "Artist"; item.TabContent = new Artist.ArtistView(); TabItems.Add(item); _mainWindow.TabControl.SelectedItem = item; }
private void OnDuplicate(object?obj) { if (obj is not DirectoryTabItemViewModel directoryTabItem) { return; } TabItems.Add(new DirectoryTabItemViewModel(_synchronizationHelper, directoryTabItem.CurrentDirectoryFileName, directoryTabItem.Header)); }
public void AddItem() { TabItems.Add(new PUTabItemModel() { CanDelete = CanDeleteIsChecked, Header = "TabItem" + (TabItems.Count + 1), Value = (TabItems.Count + 1), Content = "Page " + (TabItems.Count + 1), }); }
/// <summary> /// 树选择 /// </summary> /// <param name="treeNode"></param> private void SelectedTreeItemChanged(TreeNode treeNode) { var tabItem = TabItems.FirstOrDefault(a => a.Header == treeNode.Name); if (tabItem == null) { tabItem = new TabItemModel(WebUtility.HtmlDecode(treeNode.IconPath), treeNode.Name, treeNode.Source, CloseTabCommand, Visibility.Visible); TabItems.Add(tabItem); } SelectedTabItem = tabItem; }