public void VerifyThatCloseUpdateNotification() { var viewmodel = new PluginManagerViewModel(); viewmodel.CloseCommand.Execute(null); Assert.IsFalse(viewmodel.DialogResult.Result.Value); }
public void Setup() { this.appSettings = new ImeAppSettings(); this.serviceLocator = new Mock <IServiceLocator>(); ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object); this.appSettingService = new Mock <IAppSettingsService <ImeAppSettings> >(); this.appSettingService.Setup(x => x.AppSettings).Returns(this.appSettings); this.assemblyLocationLoader = new Mock <IAssemblyLocationLoader>(); var testDirectory = Path.Combine(Assembly.GetExecutingAssembly().Location, @"../../../../../"); #if DEBUG var frameworkVersion = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).Name; this.assemblyLocationLoader.Setup(x => x.GetLocation()).Returns(Path.GetFullPath(Path.Combine(testDirectory, $@"CDP4IME\bin\Debug\{frameworkVersion}"))); #else this.assemblyLocationLoader.Setup(x => x.GetLocation()).Returns(Path.GetFullPath(testDirectory)); #endif this.serviceLocator.Setup(s => s.GetInstance <IAssemblyLocationLoader>()).Returns(this.assemblyLocationLoader.Object); this.serviceLocator.Setup(s => s.GetInstance <IAppSettingsService <ImeAppSettings> >()).Returns(this.appSettingService.Object); this.viewModel = new PluginManagerViewModel <ImeAppSettings>(this.appSettingService.Object); }
public void VerifyThatPropertiesAreSet() { var viewmodel = new PluginManagerViewModel(); this.serviceLocator.Verify(x => x.GetAllInstances(typeof(IModule))); Assert.AreEqual(1, viewmodel.Plugins.Count); }
/// <summary> /// The execute open plugin manager request. /// </summary> private void ExecuteOpenPluginManagerRequest() { var appSettingsService = ServiceLocator.Current.GetInstance <IAppSettingsService <ImeAppSettings> >(); var pluginManager = new PluginManagerViewModel <ImeAppSettings>(appSettingsService); this.dialogNavigationService.NavigateModal(pluginManager); }
private void Server_Initialized(ITorchServer obj) { Dispatcher.InvokeAsync(() => { _plugins = _server.Managers.GetManager <PluginManager>(); var pluginManager = new PluginManagerViewModel(_plugins); DataContext = pluginManager; }); }
public void VerifyThatSelectedPluginIsSet() { var viewmodel = new PluginManagerViewModel(); viewmodel.SelectedPlugin = viewmodel.Plugins.First(); Assert.AreEqual(viewmodel.Plugins.First(), viewmodel.SelectedPlugin); Assert.IsNotNull(viewmodel.SelectedPlugin.AssemblyName); Assert.IsNotNull(viewmodel.SelectedPlugin.Name); Assert.IsNotNull(viewmodel.SelectedPlugin.Description); Assert.IsNotNull(viewmodel.SelectedPlugin.Company); Assert.IsNotNull(viewmodel.SelectedPlugin.Version); }
/// <summary> /// Invokes the action as a result of a ribbon control being clicked, selected, etc. /// </summary> /// <param name="ribbonControlId"> /// The Id property of the associated RibbonControl /// </param> /// <param name="ribbonControlTag"> /// The Tag property of the associated RibbonControl /// </param> public override async Task OnAction(string ribbonControlId, string ribbonControlTag = "") { switch (ribbonControlId) { case "CDP4_Open": var dataSelection = new DataSourceSelectionViewModel(this.DialogNavigationService); var dataSelectionResult = this.DialogNavigationService.NavigateModal(dataSelection) as DataSourceSelectionResult; if (dataSelectionResult?.OpenModel ?? false) { this.OpenModelDialog(); } break; case "CDP4_Close": await this.session.Close(); break; case "CDP4_ProxySettings": var proxyServerViewModel = new ProxyServerViewModel(); var proxyServerViewModelResult = this.DialogNavigationService.NavigateModal(proxyServerViewModel) as DataSourceSelectionResult; break; case "CDP4_SelectModelToOpen": this.OpenModelDialog(); break; case "CDP4_SelectModelToClose": var sessionsClosing = new List <ISession> { this.session }; var modelClosingDialogViewModel = new ModelClosingDialogViewModel(sessionsClosing); var modelClosingDialogViewModelResult = this.DialogNavigationService.NavigateModal(modelClosingDialogViewModel) as DataSourceSelectionResult; break; case "CDP4_Plugins": var modelPluginDialogViewModel = new PluginManagerViewModel <AddinAppSettings>(this.appSettingService); var modelPluginDialogResult = this.DialogNavigationService.NavigateModal(modelPluginDialogViewModel) as DataSourceSelectionResult; break; default: logger.Debug("The ribbon control with Id {0} and Tag {1} is not handled by the current RibbonPart", ribbonControlId, ribbonControlTag); break; } }
public void BindServer(ITorchServer server) { var pluginManager = new PluginManagerViewModel(server.Plugins); DataContext = pluginManager; }
/// <summary> /// The execute open plugin manager request. /// </summary> private void ExecuteOpenPluginManagerRequest() { var pluginManager = new PluginManagerViewModel(); this.dialogNavigationService.NavigateModal(pluginManager); }