public TabViewModelTests() { var pathServiceMock = new Mock <IPathService>(); var sortingViewModel = new Mock <IFileSystemNodesSortingViewModel>(); _tabViewModel = new TabViewModel(pathServiceMock.Object, sortingViewModel.Object, string.Empty); }
public TabViewModelTests() { _frameNavigationService = Substitute.For <IFrameNavigationService>(); _tabItem = Substitute.For <TabItem <string> >(TestTabItemTitle, TestTabItemKey); _viewModel = new TabViewModel <ViewModelStub, string>(_frameNavigationService, _tabItem); }
public MongoDbAggregateOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.AggregateOperation; DisplayName = "Aggregate"; AggregateOptions = new AggregateOptions(); ExecuteAggregate = new RelayCommand(InnerExecuteAggregate); }
private IDictionary <TabViewModel, IEnumerable <MemberViewModel> > GetMembersByTabs(Object @object, int?classId = null, int?objectId = null) { Dictionary <TabViewModel, IEnumerable <MemberViewModel> > membersByTabs = new Dictionary <TabViewModel, IEnumerable <MemberViewModel> >(); membersByTabs.Add(new TabViewModel() { Name = "General" }, new List <MemberViewModel>()); foreach (Tab tab in this.handler.Storage.GetRepository <ITabRepository>().FilteredByClassId(@object != null ? @object.ClassId : (int)classId)) { membersByTabs.Add(new TabViewModelBuilder(this.handler).Build(tab), new List <MemberViewModel>()); } foreach (Member member in this.handler.Storage.GetRepository <IMemberRepository>().FilteredByClassId(@object != null ? @object.ClassId : (int)classId)) { TabViewModel tab = null; if (member.TabId == null) { tab = membersByTabs.Keys.FirstOrDefault(t => t.Id == 0); } else { tab = membersByTabs.Keys.FirstOrDefault(t => t.Id == (int)member.TabId); } (membersByTabs[tab] as List <MemberViewModel>).Add(new MemberViewModelBuilder(this.handler).Build(member, @object, objectId)); } return(membersByTabs); }
public TabDependentTweetViewModel(TweetViewModel tvm, TabViewModel parent) { if (tvm == null) throw new ArgumentNullException("tvm"); if (parent == null) throw new ArgumentNullException("parent"); this.Parent = parent; this.Tweet = tvm; switch (Setting.Instance.TimelineExperienceProperty.TimelineItemInitStrategy) { case ItemInitStrategy.None: break; case ItemInitStrategy.DefaultColors: _lightningColorCache = Setting.Instance.ColoringProperty.BaseHighlightColor.GetColor(); _foreColorCache = Setting.Instance.ColoringProperty.BaseColor.GetDarkColor(); _backColorCache = Setting.Instance.ColoringProperty.BaseColor.GetLightColor(); _foreBrushCache = new SolidColorBrush(_foreColorCache).CloneFreeze(); _backBrushCache = new SolidColorBrush(_backColorCache).CloneFreeze(); break; case ItemInitStrategy.Full: CommitColorChanged(true); break; } }
public IActionResult SwitchTabs(string tabname) { var tab = new TabViewModel(); switch (tabname) { case "UsersPermissions": tab.ActiveTab = Tab.UsersPermissions; break; case "UsersBlockings": tab.ActiveTab = Tab.UsersBlockings; break; case "PostsBlockings": tab.ActiveTab = Tab.PostsBlockings; break; case "PostBlockingLogs": tab.ActiveTab = Tab.PostBlockingLogs; break; case "UserBlockingLogs": tab.ActiveTab = Tab.UserBlockingLogs; break; case "UserRegistrationLogs": tab.ActiveTab = Tab.UserRegistrationLogs; break; } return(RedirectToAction("Index", tab)); }
public MainViewModel(XmlDatabase database) { if (database == null) throw new ArgumentNullException("database"); _database = database; Tabs = new ObservableCollection<TabViewModel>(); TabsView = (ListCollectionView) CollectionViewSource.GetDefaultView(Tabs); TabsView.SortDescriptions.Add(new SortDescription("Title", ListSortDirection.Ascending)); // Loading applications asynchronously using reactive extensions to reduce initial startup time. // TODO: Does this actually speed things up or is it loading all the sections before add doing // the subscribe?? _database.LoadTabs().ToObservable().Subscribe(tabModel => { TabViewModel tabViewModel = new TabViewModel(tabModel); Tabs.Add(tabViewModel); Configuration.AvailableTabs.Add(tabViewModel.Title); }, () => // OnComplete { Tabs.CollectionChanged += OnTabsChanged; // Expand the default tab when the application starts up. ExpandedTab = Tabs.SingleOrDefault(obj => obj.Title == Configuration.DefaultTab) ?? Tabs.FirstOrDefault(); }); Messenger.Default.Register<ApplicationMessage>(this, OnApplicationMessage); Messenger.Default.Register<TabMessage>(this, OnTabMessage); Messenger.Default.Register<TabToMainMessage>(this, OnTabToMainMessage); }
private void ExecuteTabChangedCommand(object obj) { TabViewModel previousTab = null; foreach (var tab in this.Tabs) { if (((TabViewModel)obj).DisplayTitle == tab.DisplayTitle) { tab.HasFocus = true; tab.Foreground = "White"; if (previousTab != null) { previousTab.RightBorderColor = ""; previousTab.RaisePropChangeOnUIThread("RightBorderColor"); } tab.RightBorderColor = "black"; } else { tab.HasFocus = false; tab.Foreground = "Black"; tab.RightBorderColor = "#FFB8B8B8"; } tab.RaisePropChangeOnUIThread("HasFocus"); tab.RaisePropChangeOnUIThread("Foreground"); tab.RaisePropChangeOnUIThread("RightBorderColor"); previousTab = tab; } this.SelectedTab = obj as TabViewModel; this.NotifyPropertyChanged("SelectedTab"); }
public void CloseTab(ColumnViewModel column, TabViewModel tab) { var ci = _columns.IndexOf(column); var ti = column.Tabs.IndexOf(tab); TabManager.CloseTab(ci, ti); }
public void Enabled_Test() { var model = Mock.Create<ProcessEdit>(); model.IsSystem = false; model.SetPublishedProcessId(1); var utils = new UtilsStub(); var vm = new TabViewModel { Model = model, Utils = utils }; utils.CurrentUserIsReadOnly = false; Assert.IsTrue(vm.Enabled); //Depends on CurrentUserIsReadOnly property. utils.CurrentUserIsReadOnly = true; Assert.IsFalse(vm.Enabled); //restore utils.CurrentUserIsReadOnly = false; Assert.IsTrue(vm.Enabled); //Depends on Model.IsSystem property. model.IsSystem = true; Assert.IsTrue(vm.Enabled); }
public TabViewModelTests() { _autoMocker = new AutoMocker(); _autoMocker .Setup <IPathService, string>(m => m.RightTrimPathSeparators(CurrentDirectory)) .Returns(CurrentDirectory); _autoMocker .Setup <IPathService, string>(m => m.GetFileName(CurrentDirectory)) .Returns(CurrentDirectoryName); _autoMocker .Use(new TabConfiguration { MaxHistorySize = 100 }); _autoMocker.Use(new TabStateModel { Directory = CurrentDirectory, History = new List <string> { PrevDirectory, CurrentDirectory, NextDirectory }, SortingSettings = new SortingSettingsStateModel(), CurrentPositionInHistory = 1 }); _tabViewModel = _autoMocker.CreateInstance <TabViewModel>(); }
private void BuildWindow() { this.tabViewCollection.Clear(); Version version = new Version(JsonConvert.DeserializeObject <VersionEntity>(FileHelper.OpenFile("Version.json")).Version); RequestHelper.Client.LogConnection(Environment.MachineName, version.ToString()); base.Dispatcher.BeginInvoke(new Action(() => { foreach (GroupSet set in launcherSettings.Groups) { ObservableCollection <TabGroupModel> observables = new ObservableCollection <TabGroupModel>(); foreach (CatalogApi.Settings.GroupBox box in set.GroupBoxs) { ObservableCollection <TabItemModel> observables2 = new ObservableCollection <TabItemModel>(); foreach (CatalogApi.Settings.Brand brand in from x in box.Brands orderby x.NameAndFolder select x) { TabItemModel model = new TabItemModel { Group = set.Name, GroupBox = box.Title, BrandName = brand.NameAndFolder, BrandIcon = LoadImage(brand.IconPathImg), ClickCommand = new RelayCommand <CatalogApi.Settings.Brand>(button_onClick), Top = brand.Top, Left = brand.Left, Height = brand.Height, Width = brand.Width, BrandId = brand.BrandId, Brand = brand, ButtonStyle = brand.ButtonStyle }; observables2.Add(model); } TabGroupModel model2 = new TabGroupModel { TabItemCollection = observables2, Title = box.VisibleBorder ? box.Title : string.Empty, Top = box.Top, Left = box.Left, Width = box.Width, Height = box.Height, VisualBorder = box.VisibleBorder ? 2 : 0 }; observables.Add(model2); } TabViewModel item = new TabViewModel { Name = set.Name, Width = launcherSettings.Groups.Max <GroupSet>((Func <GroupSet, int>)(t => t.Width)), Height = launcherSettings.Groups.Max <GroupSet>((Func <GroupSet, int>)(t => t.Height)), TabGroupCollection = observables }; this.tabViewCollection.Add(item); } base.DataContext = this.tabViewCollection; }), new object[0]); }
public static TabMessage Add(TabViewModel addThis) { return new TabMessage() { Action = ActionType.Add, Tab = addThis }; }
public static TabMessage Edit(TabViewModel editThis) { return new TabMessage() { Action = ActionType.Edit, Tab = editThis }; }
public static TabMessage Remove(TabViewModel removeThis) { return new TabMessage() { Action = ActionType.Remove, Tab = removeThis }; }
public static TabMessage Add(TabViewModel addThis) { return(new TabMessage() { Action = ActionType.Add, Tab = addThis }); }
public static TabMessage Remove(TabViewModel removeThis) { return(new TabMessage() { Action = ActionType.Remove, Tab = removeThis }); }
public static TabMessage Edit(TabViewModel editThis) { return(new TabMessage() { Action = ActionType.Edit, Tab = editThis }); }
public static TabMessage MoveDown(TabViewModel moveThis) { return(new TabMessage() { Action = ActionType.MoveDown, Tab = moveThis }); }
private void newTab_Click(object sender, RoutedEventArgs e) { var newTab = new TabViewModel(); //App.DbContext.Tabs.Add(newTab); DataModel.Tabs.Add(newTab); App.DbContext.SaveChanges(); }
/// <summary> /// Closes the specified tab (removes it from the tabset). /// </summary> /// <param name="tab">Tab to close.</param> /// <returns><c>true</c> if the tab was closed, <c>false</c> if not found.</returns> public bool CloseTab(TabViewModel tab) { if (tab != null) { return(Tabs.Remove(tab)); } return(false); }
public ActionResult LoadMusicPaper(TabViewModel msc, string page) { page = Request.Form["PageId"]; int Colon = page.IndexOf(':') + 1; string id = page.Substring(0, page.IndexOf(':')); string pgNum = page.Substring(Colon, ((page.Length - 1) - page.IndexOf(':'))); return(Redirect("/Compositions/LoadMusicPaper?id=" + id + "&page=" + pgNum)); }
public static ApplicationMessage Move(ApplicationViewModel moveThis, TabViewModel moveToThis) { return new ApplicationMessage() { Action = ActionType.Move, Application = moveThis, Tab = moveToThis }; }
public static ApplicationMessage Move(ApplicationViewModel moveThis, TabViewModel moveToThis) { return(new ApplicationMessage() { Action = ActionType.Move, Application = moveThis, Tab = moveToThis }); }
public void ComplexTest1() { TabViewModel tab1VM = null; TabViewModel tab2VM = null; TabContentViewModel tab1ContentVM = null; TabContentViewModel tab2ContentVM = null; ViewInjectionManager.Default.Inject("mainRegion", "tab1", () => tab1VM = new TabViewModel() { RegionName = "tab1ContentRegion" }, typeof(TabView)); ViewInjectionManager.Default.Inject("mainRegion", "tab2", () => tab2VM = new TabViewModel() { RegionName = "tab2ContentRegion" }, typeof(TabView)); ViewInjectionManager.Default.Inject("tab1ContentRegion", "tab1Content", () => tab1ContentVM = new TabContentViewModel(), typeof(TabContentView)); ViewInjectionManager.Default.Inject("tab2ContentRegion", "tab2Content", () => tab2ContentVM = new TabContentViewModel(), typeof(TabContentView)); TabControl tabControl = new TabControl(); ViewInjectionService mainService = new ViewInjectionService() { RegionName = "mainRegion" }; Interaction.GetBehaviors(tabControl).Add(mainService); Window.Content = tabControl; EnqueueShowWindow(); EnqueueCallback(() => { Assert.AreEqual(1, tab1VM.NavigatedCount); Assert.AreEqual(0, tab1ContentVM.NavigatedCount); Assert.IsNull(tab2ContentVM); LayoutTreeHelper.GetVisualChildren(tabControl).OfType <TabContentView>().First(x => x.DataContext == tab1ContentVM); ViewInjectionManager.Default.Navigate("tab2ContentRegion", "tab2Content"); }); EnqueueWindowUpdateLayout(); EnqueueCallback(() => { Assert.AreEqual(1, tab1VM.NavigatedCount); Assert.AreEqual(0, tab1ContentVM.NavigatedCount); Assert.IsNull(tab2ContentVM); ViewInjectionManager.Default.Navigate("mainRegion", "tab2"); ViewInjectionManager.Default.Navigate("tab2ContentRegion", "tab2Content"); }); EnqueueWindowUpdateLayout(); EnqueueCallback(() => { Assert.AreEqual(1, tab1VM.NavigatedCount); Assert.AreEqual(1, tab1VM.NavigatedAwayCount); Assert.AreEqual(1, tab2VM.NavigatedCount); Assert.AreEqual(0, tab1ContentVM.NavigatedCount); Assert.AreEqual(0, tab1ContentVM.NavigatedAwayCount); Assert.AreEqual(1, tab2ContentVM.NavigatedCount); LayoutTreeHelper.GetVisualChildren(tabControl).OfType <TabContentView>().First(x => x.DataContext == tab2ContentVM); }); EnqueueTestComplete(); }
public void AddNewTab(string header, object content) { TabViewModel tab = Services.GetService <TabViewModel>(); tab.Header = header; tab.Content = content; Tabs.Add(tab); SelectedTab = tab; }
public static TabMessage Move(TabViewModel moveThis, TabViewModel moveToThis) { return new TabMessage() { Action = ActionType.Move, Tab = moveThis, TabB = moveToThis }; }
public IActionResult Index() { var tabView = new TabViewModel { Tabs = _tabHandler.Tabs }; return(View(tabView)); }
public static ApplicationMessage Add(ApplicationViewModel addThis, TabViewModel addToThis, bool suppressMessage) { return new ApplicationMessage() { Action = ActionType.Add, Application = addThis, Tab = addToThis, SuppressMessage = suppressMessage }; }
public static ApplicationMessage Add(ApplicationViewModel addThis, TabViewModel addToThis, bool suppressMessage) { return(new ApplicationMessage() { Action = ActionType.Add, Application = addThis, Tab = addToThis, SuppressMessage = suppressMessage }); }
public void BackgroundColor_SetColor_NotifyCalled() { var _uut = new TabViewModel(_fakeSalesController, _fakeNumpad); _uut.PropertyChanged += _fakeNotifyTest.TestINotify; _uut.BackGroundColour = "Green"; _fakeNotifyTest.Received(1).TestINotify(Arg.Any <object>(), Arg.Any <PropertyChangedEventArgs>()); }
private void CloseTab(TabViewModel tabViewModel) { tabViewModel.HandleTabClosing(); switch (tabViewModel) { case SearchTabViewModel searchTabViewModel: searchTabViewModel.NonFictionSearchComplete -= SearchTabNonFictionSearchComplete; searchTabViewModel.FictionSearchComplete -= SearchTabFictionSearchComplete; searchTabViewModel.SciMagSearchComplete -= SearchTabSciMagSearchComplete; break; case NonFictionSearchResultsTabViewModel nonFictionSearchResultsTabViewModel: nonFictionSearchResultsTabViewModel.OpenNonFictionDetailsRequested -= OpenNonFictionDetailsRequested; break; case FictionSearchResultsTabViewModel fictionSearchResultsTabViewModel: fictionSearchResultsTabViewModel.OpenFictionDetailsRequested -= OpenFictionDetailsRequested; break; case SciMagSearchResultsTabViewModel sciMagSearchResultsTabViewModel: sciMagSearchResultsTabViewModel.OpenSciMagDetailsRequested -= OpenSciMagDetailsRequested; break; case NonFictionDetailsTabViewModel nonFictionDetailsTabViewModel: nonFictionDetailsTabViewModel.SelectDownloadRequested -= SelectDownloadRequested; nonFictionDetailsTabViewModel.CloseTabRequested -= NonFictionDetailsCloseTabRequested; break; case FictionDetailsTabViewModel fictionDetailsTabViewModel: fictionDetailsTabViewModel.SelectDownloadRequested -= SelectDownloadRequested; fictionDetailsTabViewModel.CloseTabRequested -= FictionDetailsCloseTabRequested; break; case SciMagDetailsTabViewModel sciMagDetailsTabViewModel: sciMagDetailsTabViewModel.SelectDownloadRequested -= SelectDownloadRequested; sciMagDetailsTabViewModel.CloseTabRequested -= SciMagDetailsCloseTabRequested; break; } int removingTabIndex = TabViewModels.IndexOf(tabViewModel); TabViewModels.Remove(tabViewModel); NotifyPropertyChanged(nameof(IsDefaultSearchTabVisible)); NotifyPropertyChanged(nameof(AreTabsVisible)); NotifyPropertyChanged(nameof(IsNewTabButtonVisible)); if (!TabViewModels.Any()) { SelectedTabViewModel = null; DefaultSearchTabViewModel.Refresh(setFocus: true); } else { int newSelectedTabIndex = TabViewModels.Count > removingTabIndex ? removingTabIndex : TabViewModels.Count - 1; SelectedTabViewModel = TabViewModels[newSelectedTabIndex]; } }
public void AddTabItem(string header, object content) { TabViewModel tab = new TabViewModel(this) { Header = header, Content = content }; Tabs.Add(tab); SelectedTab = tab; }
public ModuleImpl(IWindsorContainer container, IShell shell) { _shell = shell; _container = container; _viewModelsContainer = CreateViewModelsContainer(); _tabViewModel = _viewModelsContainer.Resolve <TabViewModel>(); _shell.TabControl = _tabViewModel; _tabViewModel.Show <TrainingViewModel>(); _tabViewModel.Show <TrainingChartViewModel>(); }
public void RemoveTab(TabViewModel tab) { if (tab != null) { Tabs.Remove(tab); if (Tabs.Count > 0) { SelectedTab = Tabs[0]; } } }
public override ActionResult LayerPanel() { dynamic obj = CodecBaseController.GetJsonObject(Request.InputStream); string name = JsonHelper.CastTo <string>(obj.name); int layer = JsonHelper.CastTo <int>(obj.layer); var layersGroup = new List <PanelViewModel>(); var CodecActionDic = (Dictionary <int, ICodecAction>)Session[ConstantCodecActionDic]; _codecAction = CodecActionDic == null ? null : (CodecActionDic.ContainsKey(layer) ? CodecActionDic[layer] : null); if (_codecAction == null) { return(PartialView("_Layers", layersGroup)); } if (name.Equals(Constants.DECODE_NAME_RECONSTRUCTEDFRAME)) { return(DecodedImage(layer)); } // gets the action with the same name as the argument var action = _codecAction.SubActions.SingleOrDefault(c => c.Name.Equals(name)); if (action == null || action.Result == null) { return(PartialView("_Layers", layersGroup)); } // create layers accroding to the given layer. // This is different with others string idPrefix = name.Replace(' ', '-').Replace('/', '-') + "-input-layer-" + layer; var layerPanel = new PanelViewModel(idPrefix, "Layer " + layer); Tile result = action.Result.FirstOrDefault(); Triplet <string> triplet = result.GetStrings(TileSerializerFactory.GetDefaultSerizlizer()); var tabx = new TabViewModel { Id = idPrefix + "-Y", Title = "Y", Content = triplet.X, Editable = false }; var taby = new TabViewModel { Id = idPrefix + "-Cb", Title = "Cb", Content = triplet.Y, Editable = false }; var tabz = new TabViewModel { Id = idPrefix + "-Cr", Title = "Cr", Content = triplet.Z, Editable = false }; layerPanel.Tabs = new List <TabViewModel> { tabx, taby, tabz }; layersGroup.Add(layerPanel); return(PartialView("_Layers", layersGroup)); }
private void DeleteResultMessageHandler(NotificationMessage <DocumentResultViewModel> message) { if (message.Notification == Constants.ConfirmDeleteResultMessage) { var result = MessageBox.Show("Delete result with id: " + message.Content.Id + "?", "Delete confirm", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { TabViewModel tabVm = ((ResultsViewModel)message.Content.Parent).Owner; Messenger.Default.Send(new NotificationMessage <DocumentResultViewModel>(this, tabVm, message.Content, Constants.DeleteResultMessage)); } } }
public ViewModelLocator() { JoueursViewModel = new JoueursViewModel(); ClubsViewModel = new ClubsViewModel(); SexesViewModel = new SexesViewModel(); TabViewModel = new TabViewModel(); SeriesViewModel = new SeriesViewModel(); ClassementsViewModel = new ClassementsViewModel(); EquipesViewModel = new EquipesViewModel(); MatchsViewModel = new MatchsViewModel(); TableauBordViewModel = new TableauBordViewModel(); }
public void SetCurrentTab(TabViewModel tvm) { if (tvm != null) { this.UserSelectorViewModel.LinkElements = tvm.TabProperty.LinkAccountInfos; } else { this.UserSelectorViewModel.LinkElements = AccountStorage.Accounts; } UpdateAccountImages(); }
public MongoDbFindOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.FindOperation; DisplayName = "Find / Count"; ExecuteFind = new RelayCommand<bool>((explain) => { Skip = 0; InnerExecuteFind(explain); }); DoPaging = new RelayCommand<bool>(InnerExecuteFind); PageBack = new RelayCommand(InnerPageBack); PageForward = new RelayCommand(InnerPageForward); ExecuteCount = new RelayCommand(InnerExecuteCount); }
private void AnalyzeDataExecute(AnalyzeDataMessage message) { try { var result = AnalyzeService.Analyze(message.InputData, message.Type); var newTabName = TabNameService.GetResults(); var resultList = result.Rows.ToCompleteList(); var newTab = new TabViewModel(newTabName, resultList); Main.AddAndSelectTab(newTab); } catch (Exception e) { MessengerInstance.Send(new ShowPopupMessage(Strings.ErrorOccured, e.Message)); } }
internal static void InstallTab() { Application.Current.Dispatcher.Invoke( () => { var mainWindow = Application.Current.MainWindow; _tabGrid = new UniformGrid { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Columns = 1, //MaxHeight = 180 }; var path = Path.Combine("Tab", "Tab.xaml"); var mainControl = UILoader.GetControl<UserControl>(path); ViewModel = new TabViewModel(); mainControl.DataContext = ViewModel; _tabItem = new TabItem { Header = "AutoFollow", //ToolTip = "", Content = _tabGrid }; var tabs = mainWindow.FindName("tabControlMain") as TabControl; if (tabs == null) return; tabs.Items.Add(_tabItem); _tabGrid.Children.Add(mainControl); } ); }
void Move(TabViewModel moveThis, TabViewModel moveToThis) { if (moveThis == null) throw new ArgumentNullException("moveThis"); if (moveToThis == null) throw new ArgumentNullException("moveToThis"); Tabs.Move(Tabs.IndexOf(moveThis), Tabs.IndexOf(moveToThis)); }
void Remove(TabViewModel removeThis) { if (removeThis == null) throw new ArgumentNullException("removeThis"); var result = ServiceManager.GetService<IMessageBoxService>().Show(String.Format( "Are you sure you wish to remove {0}?", removeThis.Title), "Astounding Dock", MessageIcon.Question, MessageOptions.YesNo); if (result != MessageResult.Yes) return; if (removeThis.Title == Configuration.DefaultTab) { ServiceManager.GetService<IMessageBoxService>().Show( "Cannot remove the default section", "Astounding Dock", MessageIcon.Error); return; } if (removeThis.Applications.Count > 0) { var result2 = ServiceManager.GetService<IMessageBoxService>().Show(String.Format( "This tab has {0} applications, remove anyway?", removeThis.Applications.Count), "Astounding Dock", MessageIcon.Question, MessageOptions.YesNo); if (result2 != MessageResult.Yes) return; } Tabs.Remove(removeThis); }
public void RecieveMessage(object message) { if (message is LoadWebViewEventArgs) { //doing this kills the binding to it hence breaks the tabs //wvMain.Source = ((LoadWebViewEventArgs)message).Uri; var vm = (BrowserVM)this.DataContext; var uri = ((LoadWebViewEventArgs)message).Uri; TabViewModel tempTab = new TabViewModel() { DisplayTitle = uri.Host, FaviconUri = "http://" + uri.Host + "//favicon.ico", HasFocus = false, Uri = uri.OriginalString, Id = 999, Uid = Guid.NewGuid().ToString(), PrimaryBackgroundColor = "Black", PrimaryForegroundColor = "White", PrimaryFontFamily = "Segoe UI" }; vm.SelectedTab = tempTab; vm.ExposedNotifyPropertyChanged("SelectedTab"); } else if (message is RequestListOfInstalledExtensionsEventArgs) { var extensions = X.Services.Extensions.ExtensionsService.Instance.GetExtensionsMetadata(); _SendMessageSource?.Raise(this, new ResponseListOfInstalledExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); } else if (message is RequestListOfTopToolbarExtensionsEventArgs) { var extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Top); _SendMessageSource?.Raise(this, new ResponseListOfTopToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); } else if (message is RequestListOfBottomToolbarExtensionsEventArgs) { var extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Bottom); _SendMessageSource?.Raise(this, new ResponseListOfBottomToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); } else if (message is RequestListOfLeftToolbarExtensionsEventArgs) { var extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Left); _SendMessageSource?.Raise(this, new ResponseListOfLeftToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); } else if (message is RequestListOfRightToolbarExtensionsEventArgs) { var extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Right); _SendMessageSource?.Raise(this, new ResponseListOfRightToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); } else if (message is RequestRefreshToolbarExtensionsEventArgs) { var extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Top); _SendMessageSource?.Raise(this, new ResponseListOfTopToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Bottom); _SendMessageSource?.Raise(this, new ResponseListOfBottomToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Left); _SendMessageSource?.Raise(this, new ResponseListOfLeftToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); extensions = X.Services.Extensions.ExtensionsService.Instance.GetToolbarExtensionsMetadata(ExtensionInToolbarPositions.Right); _SendMessageSource?.Raise(this, new ResponseListOfRightToolbarExtensionsEventArgs() { ExtensionsMetadata = extensions, ReceiverType = ExtensionType.UIComponent }); } else if (message is LaunchExtensionEventArgs) { var extGuid = ((LaunchExtensionEventArgs)message).ExtensionUniqueGuid; LaunchExtension(extGuid); } else if (message is CloseExtensionEventArgs) { var extGuid = ((CloseExtensionEventArgs)message).ExtensionUniqueGuid; CloseExtension(extGuid); } }
void Move(ApplicationViewModel toMove, TabViewModel movingTo) { if (toMove == null) throw new ArgumentNullException("toMove"); if (movingTo == null) throw new ArgumentNullException("movingTo"); if (!movingTo.Applications.Contains(toMove)) { var movingFrom = Tabs.Single(sectionElem => sectionElem.Applications.Contains(toMove)); movingFrom.Applications.Remove(toMove); movingTo.Applications.Add(toMove); } }
public MongoDbEvalOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.EvalOperation; DisplayName = "Eval"; ExecuteEval = new RelayCommand(InnerExecuteEval); }
public MongoDbDistinctOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.DistinctOperation; DisplayName = "Distinct"; ExecuteDistinct = new RelayCommand(InnerExecuteDistinct); }
void Add(ApplicationViewModel addThis, TabViewModel addToThis, bool suppressDialog) { if (addThis == null) throw new ArgumentNullException("addThis"); if (addToThis == null) throw new ArgumentNullException("addToThis"); var tab = Tabs.SingleOrDefault(tabElem => tabElem.Applications.Contains(addThis)); if (tab != null) { ServiceManager.GetService<IMessageBoxService>().Show(String.Format( "{0} already added to tab {1}", addThis.Title, tab.Title), "Astounding Dock", MessageIcon.Error); return; } addToThis.Applications.Add(addThis); if (!suppressDialog) { ServiceManager.GetService<IMessageBoxService>().Show(String.Format( "Added application {0} to {1}", addThis.Title, addToThis.Title), "Astounding Dock"); } }
private TabViewModel CreateDefaultTab(string title, string faviconUrl, string url,DateTime lastRefreshDate, bool isPinned = false, int id = 0) { var tempTab = new TabViewModel() {Id = id, DisplayTitle = title, FaviconUri = faviconUrl, HasFocus = false, Uri = url, TabChangedCommand = this.TabChangedCommand, LastRefreshedDate = lastRefreshDate, IsPinned = isPinned }; tempTab.PrimaryFontFamily = DetermineFontFamily(tempTab.DisplayTitle); tempTab.PrimaryBackgroundColor = DeterminePrimaryBackgroundColor(tempTab.DisplayTitle); tempTab.PrimaryForegroundColor = DeterminePrimaryForegroundColor(tempTab.DisplayTitle); tempTab.RightBorderColor = "#FFB8B8B8"; if(id >0) tempTab.ThumbUri = string.Concat(X.Services.Image.Service.Instance.MediumLocation, "\\", tempTab.Uid, ".png") + "?v=" + Guid.NewGuid().ToString(); return tempTab; }
void Add(TabViewModel addThis) { if (addThis == null) throw new ArgumentNullException("addThis"); ServiceManager.GetService<IViewService>().OpenDialog(addThis); if (addThis.Result != MessageResult.Okay) return; // Cancelled add // Check if any other tabs have this title. if (Tabs.Any(sectionElem => sectionElem.Title == addThis.Title)) { ServiceManager.GetService<IMessageBoxService>().Show( "Tab with that title already exists", "Astounding Dock", MessageIcon.Error); // Re-open dialog. Add(addThis); return; } Tabs.Add(addThis); }
public MongoDbCommandOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.CommandOperation; DisplayName = "Run command"; ExecuteCommand = new RelayCommand(InnerExecuteCommand); }
void Add(ApplicationViewModel addThis, TabViewModel addToThis) { Add(addThis, addToThis, false); }
public ExpandedTabMessage(TabViewModel expandThis) { ExpandedThis = expandThis; }
public MongoDbOperationViewModel(TabViewModel owner) { Owner = owner; }
public MongoDbUpdateOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.UpdateOperation; DisplayName = "Update"; ExecuteUpdate = new RelayCommand(InnerExecuteUpdate); }
public static ApplicationMessage Add(ApplicationViewModel addThis, TabViewModel addToThis) { return Add(addThis, addToThis, false); }
public MongoDbReplaceOperationViewModel(TabViewModel owner) : base(owner) { Name = Constants.ReplaceOperation; DisplayName = "Replace"; ExecuteReplace = new RelayCommand(InnerExecuteReplace); }
void Edit(TabViewModel toEdit) { if (toEdit == null) throw new ArgumentNullException("toEdit"); TabViewModel editTab = new TabViewModel(); editTab.UpdateWith(toEdit); ServiceManager.GetService<IViewService>().OpenDialog(editTab); if (editTab.Result != MessageResult.Okay) return; // Cancelled edit if (!editTab.Title.Equals(toEdit.Title, StringComparison.InvariantCultureIgnoreCase)) { // Tab title changed, check if any other tabs have this title. if (Tabs.Any(t => t.Title == editTab.Title)) { ServiceManager.GetService<IMessageBoxService>().Show( "Tab wit that title already exists", "Astounding Dock", MessageIcon.Error); // Re-open dialog. Edit(toEdit); return; } } toEdit.UpdateWith(editTab); Messenger.Default.Send<DatabaseMessage>(DatabaseMessage.Update(toEdit.Model)); // Refresh the view to reapply the sort in case the tab was renamed. // Needs to be done after 'UpdateWith' is called. TabsView.Refresh(); }