Ejemplo n.º 1
0
        public void VerifyThatCloseUpdateNotification()
        {
            var viewmodel = new PluginManagerViewModel();

            viewmodel.CloseCommand.Execute(null);
            Assert.IsFalse(viewmodel.DialogResult.Result.Value);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public void VerifyThatPropertiesAreSet()
        {
            var viewmodel = new PluginManagerViewModel();

            this.serviceLocator.Verify(x => x.GetAllInstances(typeof(IModule)));
            Assert.AreEqual(1, viewmodel.Plugins.Count);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
 private void Server_Initialized(ITorchServer obj)
 {
     Dispatcher.InvokeAsync(() =>
     {
         _plugins          = _server.Managers.GetManager <PluginManager>();
         var pluginManager = new PluginManagerViewModel(_plugins);
         DataContext       = pluginManager;
     });
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        /// <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;
            }
        }
Ejemplo n.º 8
0
        public void BindServer(ITorchServer server)
        {
            var pluginManager = new PluginManagerViewModel(server.Plugins);

            DataContext = pluginManager;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// The execute open plugin manager request.
        /// </summary>
        private void ExecuteOpenPluginManagerRequest()
        {
            var pluginManager = new PluginManagerViewModel();

            this.dialogNavigationService.NavigateModal(pluginManager);
        }