/// <summary> /// The event-handler that is invoked by the subscription that listens for updates /// on the <see cref="Session"/> that is being represented by the view-model /// </summary> /// <param name="sessionChange"> /// The payload of the event that is being handled /// </param> private void SessionChangeEventHandler(SessionEvent sessionChange) { if (this.FluentRibbonManager == null) { return; } if (!this.FluentRibbonManager.IsActive) { return; } if (sessionChange.Status == SessionStatus.Open) { var session = sessionChange.Session; var siteDirectory = session.RetrieveSiteDirectory(); this.domainOfExpertiseBrowserViewModel = new DomainOfExpertiseBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.modelBrowserViewModel = new ModelBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.naturalLanguageBrowserViewModel = new NaturalLanguageBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.organizationBrowserViewModel = new OrganizationBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.personBrowserViewModel = new PersonBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.roleBrowserViewModel = new RoleBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.siteRdlBrowserViewModel = new SiteRdlBrowserViewModel(session, siteDirectory, this.ThingDialogNavigationService, this.PanelNavigationService, this.DialogNavigationService, this.PluginSettingsService); this.Session = session; } if (sessionChange.Status == SessionStatus.Closed) { this.CloseAll(); this.Session = null; } }
public void VerifyStringProperties() { var vm = new DomainOfExpertiseBrowserViewModel(this.session.Object, this.siteDir, null, null, null, null); Assert.That(vm.Caption, Is.Not.Null.Or.Empty); Assert.That(vm.ToolTip, Is.Not.Null.Or.Empty); }
/// <summary> /// Close all the panels and dispose of them /// </summary> private void CloseAll() { this.PanelNavigationService.Close(this.domainOfExpertiseBrowserViewModel, false); this.domainOfExpertiseBrowserViewModel = null; this.PanelNavigationService.Close(this.modelBrowserViewModel, false); this.modelBrowserViewModel = null; this.PanelNavigationService.Close(this.naturalLanguageBrowserViewModel, false); this.naturalLanguageBrowserViewModel = null; this.PanelNavigationService.Close(this.organizationBrowserViewModel, false); this.organizationBrowserViewModel = null; this.PanelNavigationService.Close(this.personBrowserViewModel, false); this.personBrowserViewModel = null; this.PanelNavigationService.Close(this.roleBrowserViewModel, false); this.roleBrowserViewModel = null; this.PanelNavigationService.Close(this.siteRdlBrowserViewModel, false); this.siteRdlBrowserViewModel = null; }
public void VerifyThatAddRemoveEventsAreCaught() { var domainCount = this.siteDir.Domain.Count; var vm = new DomainOfExpertiseBrowserViewModel(this.session.Object, this.siteDir, null, null, null, null); Assert.AreEqual(domainCount, vm.DomainOfExpertises.Count); var domainOfExpertise = new DomainOfExpertise(Guid.NewGuid(), null, this.uri); this.siteDir.Domain.Add(domainOfExpertise); this.revInfo.SetValue(this.siteDir, 10); CDPMessageBus.Current.SendObjectChangeEvent(this.siteDir, EventKind.Updated); domainCount++; Assert.AreEqual(domainCount, vm.DomainOfExpertises.Count); this.siteDir.Domain.Remove(domainOfExpertise); this.revInfo.SetValue(this.siteDir, 20); domainCount--; CDPMessageBus.Current.SendObjectChangeEvent(this.siteDir, EventKind.Updated); Assert.AreEqual(domainCount, vm.DomainOfExpertises.Count); }