Exemplo n.º 1
0
        public void LoadExtension_LaodsExtension()
        {
            var errorCounter = 0;

            // Setup log service to increase the error counter each time a error is logged.
            var logService = new Mock <ILogService>();

            logService.Setup(x => x.WriteAsync(
                                 It.IsAny <string>(),
                                 It.Is <LogLevel>(y => y == LogLevel.Error),
                                 It.IsAny <Exception>()))
            .Callback(() =>
            {
                errorCounter++;
            });

            var container = new UnityContainer();

            var service = new ExtensionService(logService.Object, container);

            service.LoadExtensions(new[]
            {
                "Simplic.Package.Test.Extension.dll"
            }
                                   );

            Assert.Equal(0, errorCounter);
        }
Exemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            exportProvider = initializeMEFTask.GetAwaiter().GetResult();

            var cultureService = exportProvider.GetExportedValue <CultureService>();

            cultureService.Initialize(args);

            // Make sure IDpiService gets created before any MetroWindows
            exportProvider.GetExportedValue <IDpiService>();

            // It's needed very early, and an IAutoLoaded can't be used (it gets called too late for the first 64x64 image request)
            DsImageConverter.imageService = exportProvider.GetExportedValue <IImageService>();

            appWindow        = exportProvider.GetExportedValue <AppWindow>();
            extensionService = exportProvider.GetExportedValue <ExtensionService>();
            dsLoaderService  = exportProvider.GetExportedValue <IDsLoaderService>();

            extensionService.LoadedExtensions = loadedExtensions;
            appWindow.CommandLineArgs         = args;

            var win = appWindow.InitializeMainWindow();

            appWindow.MainWindow.SourceInitialized += MainWindow_SourceInitialized;
            dsLoaderService.OnAppLoaded            += DsLoaderService_OnAppLoaded;
            dsLoaderService.Initialize(appWindow, win, args);
            extensionService.LoadExtensions(Resources.MergedDictionaries);
            win.Show();
        }
Exemplo n.º 3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var win = appWindow.InitializeMainWindow();

            appWindow.MainWindow.SourceInitialized += MainWindow_SourceInitialized;
            dsLoaderService.OnAppLoaded            += DsLoaderService_OnAppLoaded;
            dsLoaderService.Initialize(appWindow, win, args);
            extensionService.LoadExtensions(Resources.MergedDictionaries);
            win.Show();
        }