예제 #1
0
    private static string GetDatabaseConnectionString(IConfiguration configuration,
                                                      IReadonlyDependencyResolver resolver)
    {
        var platformService  = resolver.GetRequiredService <IPlatformService>();
        var databaseName     = configuration["DataAccess:DatabaseName"];
        var connectionString = configuration["DataAccess:ConnectionString"];

        string dbDirectory;

        if (platformService.GetPlatform() == Platform.Linux)
        {
            var environmentService = resolver.GetRequiredService <IEnvironmentService>();

            dbDirectory = $"{environmentService.GetEnvironmentVariable("HOME")}/.config/camelot";
        }
        else
        {
            var assemblyLocation = Assembly.GetEntryAssembly()?.Location;
            dbDirectory = Path.GetDirectoryName(assemblyLocation);
        }

        if (!Directory.Exists(dbDirectory))
        {
            Directory.CreateDirectory(dbDirectory);
        }

        return(string.Format(connectionString, Path.Combine(dbDirectory, databaseName)));
    }
예제 #2
0
 public static void RegisterFileSystemWatcherServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IFileSystemWatcherFactory>(() => new FileSystemWatcherFactory(
                                                                    resolver.GetRequiredService <IPathService>(),
                                                                    resolver.GetRequiredService <FileSystemWatcherConfiguration>()
                                                                    ));
 }
예제 #3
0
        private static string GetLogFileName(LoggingConfiguration config,
                                             IReadonlyDependencyResolver resolver)
        {
            var platformService = resolver.GetRequiredService <IPlatformService>();

            string logDirectory;

            if (platformService.GetPlatform() == Platform.Linux)
            {
                var environmentService = resolver.GetRequiredService <IEnvironmentService>();

                logDirectory = $"{environmentService.GetEnvironmentVariable("HOME")}/.config/camelot/logs";
            }
            else
            {
                logDirectory = Directory.GetCurrentDirectory();
            }

            if (!Directory.Exists(logDirectory))
            {
                Directory.CreateDirectory(logDirectory);
            }

            return(Path.Combine(logDirectory, config.LogFileName));
        }
예제 #4
0
        public static void RegisterDependencies(
            IMutableDependencyResolver services,
            IReadonlyDependencyResolver resolver
            )
        {
            services.RegisterLazySingleton(() => new TrackerContext());
            services.RegisterLazySingleton(
                () => new TrackerRepository(
                    resolver.GetRequiredService <TrackerContext>()
                    )
                );

            // view models
            services.Register(
                () => new TaskListViewModel(
                    resolver.GetRequiredService <TrackerRepository>()
                    )
                );
            services.Register(() => new ActivityListViewModel());
            services.RegisterLazySingleton(
                () => new MainWindowViewModel(
                    resolver.GetRequiredService <TaskListViewModel>(),
                    resolver.GetRequiredService <ActivityListViewModel>()
                    )
                );
        }
예제 #5
0
 public static void Register(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.Register(() => new MainWindowViewModel(resolver.GetRequiredService <IRoutingService>(),
                                                     resolver.GetRequiredService <FirstViewModel>()));
     services.Register(() => new FirstViewModel(resolver.GetRequiredService <IRoutingService>(),
                                                resolver.GetRequiredService <IParserService>()));
     services.Register <IViewFor <FirstViewModel> >(() => new FirstView());
     services.Register <IParserService>(() => new ParserService());
     services.RegisterLazySingleton <IRoutingService>(() => new RoutingService(new RoutingState()));
 }
예제 #6
0
        public static void Register(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
        {
            services.Register(() => AddConfig());
            services.AddGooogle(resolver);
            services.AddDb(resolver);
            services.Register <IDataService <TrackingEntry> >(() => new TrackingEntryService(resolver.GetRequiredService <AppDbContext>()));
            services.Register <IDataService <Project> >(() => new ProjectsService(resolver.GetRequiredService <AppDbContext>()));

            services.Register(() => new TimeTableViewModel(resolver.GetRequiredService <IDataService <TrackingEntry> >(), resolver.GetRequiredService <ISheetsService>()));
            services.Register(() => new ProjectsTableViewModel(resolver.GetRequiredService <IDataService <Project> >()));
            services.Register(() => new SettingsTabViewModel(resolver.GetRequiredService <AppConfig>()));

            services.Register(() => new MainWindowViewModel(resolver.GetRequiredService <ProjectsTableViewModel>(), resolver.GetRequiredService <SettingsTabViewModel>()));
        }
예제 #7
0
        private static void RegisterPlatformSpecificServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
        {
            var platformService = resolver.GetRequiredService <IPlatformService>();
            var platform        = platformService.GetPlatform();

            switch (platform)
            {
            case Platform.Linux:
                RegisterLinuxServices(services, resolver);
                break;

            case Platform.MacOs:
                RegisterMacServices(services, resolver);
                break;

            case Platform.Windows:
                RegisterWindowsServices(services, resolver);
                break;

            case Platform.Unknown:
                throw new InvalidOperationException("Unsupported platform");

            default:
                throw new ArgumentOutOfRangeException(nameof(platform));
            }
        }
예제 #8
0
 private static void RegisterDataAccess(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IUnitOfWorkFactory>(() => new LiteDbUnitOfWorkFactory(
                                                             resolver.GetRequiredService <DatabaseConfiguration>()
                                                             ));
     services.RegisterLazySingleton <IClipboardService>(() => new ClipboardService());
     services.RegisterLazySingleton <IMainWindowProvider>(() => new MainWindowProvider());
 }
예제 #9
0
    private static void RegisterPlatformSpecificViewModels(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
    {
        var platformService = resolver.GetRequiredService <IPlatformService>();
        var platform        = platformService.GetPlatform();

        if (platform is Platform.MacOs)
        {
            RegisterMacViewModels(services, resolver);
        }
    }
예제 #10
0
 private static void RegisterMacServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <ITrashCanService>(() => new MacTrashCanService(
                                                           resolver.GetRequiredService <IDriveService>(),
                                                           resolver.GetRequiredService <IOperationsService>(),
                                                           resolver.GetRequiredService <IPathService>(),
                                                           resolver.GetRequiredService <IFileService>(),
                                                           resolver.GetRequiredService <IEnvironmentService>(),
                                                           resolver.GetRequiredService <IDirectoryService>()
                                                           ));
     services.RegisterLazySingleton <IResourceOpeningService>(() => new MacResourceOpeningService(
                                                                  resolver.GetRequiredService <IProcessService>()
                                                                  ));
     services.RegisterLazySingleton <ITerminalService>(() => new MacTerminalService(
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                           ));
 }
예제 #11
0
        private static void AddDb(this IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
        {
            services.RegisterLazySingleton(() => new AppDbContext());
            if (Design.IsDesignMode)
            {
                return;
            }
            var dbContext = resolver.GetRequiredService <AppDbContext>();

            if (dbContext.Database.GetPendingMigrations().Any())
            {
                dbContext.Database.Migrate();
            }
        }
예제 #12
0
        public static void RegisterLogging(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
        {
            services.RegisterLazySingleton(() =>
            {
                var config      = resolver.GetRequiredService <LoggingConfiguration>();
                var logFilePath = GetLogFileName(config, resolver);
                var logger      = new LoggerConfiguration()
                                  .MinimumLevel.Override("Default", config.DefaultLogLevel)
                                  .MinimumLevel.Override("Microsoft", config.MicrosoftLogLevel)
                                  .WriteTo.Console()
                                  .WriteTo.RollingFile(logFilePath, fileSizeLimitBytes: config.LimitBytes)
                                  .CreateLogger();
                var factory = new SerilogLoggerFactory(logger);

                return(factory.CreateLogger("Default"));
            });
        }
예제 #13
0
        private static async void AddGooogle(this IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
        {
            var config = Design.IsDesignMode ? new AppConfig {
                GoogleEnabled = true
            } : resolver.GetRequiredService <AppConfig>();

            if (config.GoogleEnabled)
            {
                var service = new GoogleSheetsService();

                if (!Design.IsDesignMode)
                {
                    await service.Init();
                }
                services.Register <ISheetsService>(() => service);
            }
        }
예제 #14
0
    private static IFilesPanelViewModel CreateFilesPanelViewModel(
        IReadonlyDependencyResolver resolver,
        string panelKey)
    {
        var observer = resolver.GetRequiredService <IFilePanelDirectoryObserver>();
        var directorySelectorViewModel = new DirectorySelectorViewModel(
            resolver.GetRequiredService <IFavouriteDirectoriesService>(),
            resolver.GetRequiredService <IDirectoryService>(),
            resolver.GetRequiredService <ISuggestionsService>(),
            observer,
            resolver.GetRequiredService <ISuggestedPathViewModelFactory>()
            );
        var filesPanelStateService = new FilesPanelStateService(
            resolver.GetRequiredService <IUnitOfWorkFactory>(),
            panelKey
            );
        var tabsListViewModel = new TabsListViewModel(
            filesPanelStateService,
            resolver.GetRequiredService <IDirectoryService>(),
            resolver.GetRequiredService <ITabViewModelFactory>(),
            resolver.GetRequiredService <IFilesOperationsMediator>(),
            resolver.GetRequiredService <IHomeDirectoryProvider>(),
            observer,
            resolver.GetRequiredService <TabsListConfiguration>()
            );
        var filesPanelViewModel = new FilesPanelViewModel(
            resolver.GetRequiredService <IFileService>(),
            resolver.GetRequiredService <IDirectoryService>(),
            resolver.GetRequiredService <INodesSelectionService>(),
            resolver.GetRequiredService <INodeService>(),
            resolver.GetRequiredService <IFileSystemNodeViewModelFactory>(),
            resolver.GetRequiredService <IFileSystemWatchingService>(),
            resolver.GetRequiredService <IApplicationDispatcher>(),
            resolver.GetRequiredService <IFileSizeFormatter>(),
            resolver.GetRequiredService <IFileSystemNodeViewModelComparerFactory>(),
            resolver.GetRequiredService <IRecursiveSearchService>(),
            observer,
            resolver.GetRequiredService <IPermissionsService>(),
            resolver.GetRequiredService <IDialogService>(),
            resolver.GetRequiredService <ISearchViewModel>(),
            tabsListViewModel,
            resolver.GetRequiredService <IOperationsViewModel>(),
            directorySelectorViewModel,
            resolver.GetRequiredService <IDragAndDropOperationsMediator>(),
            resolver.GetRequiredService <IClipboardOperationsViewModel>()
            );

        return(filesPanelViewModel);
    }
예제 #15
0
 private static void RegisterCommonViewModels(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.Register(() => new TerminalSettingsViewModel(
                           resolver.GetRequiredService <ITerminalService>()
                           ));
     services.Register(() => new GeneralSettingsViewModel(
                           resolver.GetRequiredService <LanguageSettingsViewModel>(),
                           resolver.GetRequiredService <ThemeSettingsViewModel>()
                           ));
     services.Register(() => new LanguageSettingsViewModel(
                           resolver.GetRequiredService <ILocalizationService>(),
                           resolver.GetRequiredService <ILanguageManager>()
                           ));
     services.Register(() => new ThemeSettingsViewModel(
                           resolver.GetRequiredService <IThemeService>(),
                           resolver.GetRequiredService <IThemeViewModelFactory>()
                           ));
     services.Register(() => new SettingsDialogViewModel(
                           resolver.GetRequiredService <GeneralSettingsViewModel>(),
                           resolver.GetRequiredService <TerminalSettingsViewModel>()
                           ));
     services.RegisterLazySingleton(() => new FilePropertiesBehavior(
                                        resolver.GetRequiredService <IDialogService>()
                                        ));
     services.RegisterLazySingleton(() => new DirectoryPropertiesBehavior(
                                        resolver.GetRequiredService <IDialogService>()
                                        ));
     services.Register(() => new AboutDialogViewModel(
                           resolver.GetRequiredService <IApplicationVersionProvider>(),
                           resolver.GetRequiredService <IResourceOpeningService>(),
                           resolver.GetRequiredService <AboutDialogConfiguration>()
                           ));
     services.Register(() => new CreateArchiveDialogViewModel(
                           resolver.GetRequiredService <INodeService>(),
                           resolver.GetRequiredService <IArchiveTypeViewModelFactory>(),
                           resolver.GetRequiredService <ISystemDialogService>(),
                           resolver.GetRequiredService <ICreateArchiveStateService>()
                           ));
     services.Register(() => new DirectoryInformationDialogViewModel(
                           resolver.GetRequiredService <IDirectoryService>(),
                           resolver.GetRequiredService <IFileService>(),
                           resolver.GetRequiredService <IApplicationDispatcher>(),
                           resolver.GetRequiredService <MainNodeInfoTabViewModel>()
                           ));
     services.Register(() => new FileInformationDialogViewModel(
                           resolver.GetRequiredService <IFileService>(),
                           resolver.GetRequiredService <MainNodeInfoTabViewModel>()
                           ));
     services.Register(() => new AccessDeniedDialogViewModel());
     services.Register(() => new OverwriteOptionsDialogViewModel(
                           resolver.GetRequiredService <IFileService>(),
                           resolver.GetRequiredService <IFileSystemNodeViewModelFactory>(),
                           resolver.GetRequiredService <IFileNameGenerationService>(),
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register(() => new CreateDirectoryDialogViewModel(
                           resolver.GetRequiredService <INodeService>(),
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register(() => new CreateFileDialogViewModel(
                           resolver.GetRequiredService <INodeService>(),
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register(() => new RenameNodeDialogViewModel(
                           resolver.GetRequiredService <INodeService>(),
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.RegisterLazySingleton <IOperationsStateViewModel>(() => new OperationsStatesListViewModel(
                                                                    resolver.GetRequiredService <IOperationsStateService>(),
                                                                    resolver.GetRequiredService <IOperationStateViewModelFactory>(),
                                                                    resolver.GetRequiredService <IApplicationDispatcher>(),
                                                                    resolver.GetRequiredService <IDialogService>(),
                                                                    resolver.GetRequiredService <OperationsStatesConfiguration>()
                                                                    ));
     services.Register(() => new RemoveNodesConfirmationDialogViewModel(
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register <IOperationsViewModel>(() => new OperationsViewModel(
                                                  resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                  resolver.GetRequiredService <IOperationsService>(),
                                                  resolver.GetRequiredService <INodesSelectionService>(),
                                                  resolver.GetRequiredService <IDialogService>(),
                                                  resolver.GetRequiredService <IDirectoryService>(),
                                                  resolver.GetRequiredService <ITrashCanService>()
                                                  ));
     services.RegisterLazySingleton <IMenuViewModel>(() => new MenuViewModel(
                                                         resolver.GetRequiredService <IApplicationCloser>(),
                                                         resolver.GetRequiredService <IDialogService>()
                                                         ));
     services.Register(() => new OpenWithDialogViewModel(
                           resolver.GetRequiredService <IApplicationService>(),
                           resolver.GetRequiredService <OpenWithDialogConfiguration>()
                           ));
     services.Register <ISearchViewModel>(() => new SearchViewModel(
                                              resolver.GetRequiredService <IRegexService>(),
                                              resolver.GetRequiredService <IResourceProvider>(),
                                              resolver.GetRequiredService <IApplicationDispatcher>(),
                                              resolver.GetRequiredService <SearchViewModelConfiguration>()
                                              ));
     services.RegisterLazySingleton <IDrivesListViewModel>(() => new DrivesListViewModel(
                                                               resolver.GetRequiredService <IMountedDriveService>(),
                                                               resolver.GetRequiredService <IUnmountedDriveService>(),
                                                               resolver.GetRequiredService <IDrivesUpdateService>(),
                                                               resolver.GetRequiredService <IDriveViewModelFactory>(),
                                                               resolver.GetRequiredService <IApplicationDispatcher>()
                                                               ));
     services.RegisterLazySingleton <ITopOperationsViewModel>(() => new TopOperationsViewModel(
                                                                  resolver.GetRequiredService <ITerminalService>(),
                                                                  resolver.GetRequiredService <IDirectoryService>(),
                                                                  resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                  resolver.GetRequiredService <IDialogService>(),
                                                                  resolver.GetRequiredService <IPathService>(),
                                                                  resolver.GetRequiredService <IArchiveService>(),
                                                                  resolver.GetRequiredService <INodesSelectionService>(),
                                                                  resolver.GetRequiredService <ISystemDialogService>()
                                                                  ));
     services.RegisterLazySingleton <IOperationStateViewModelFactory>(() => new OperationStateViewModelFactory(
                                                                          resolver.GetRequiredService <IPathService>()
                                                                          ));
     services.RegisterLazySingleton <IMainWindowViewModel>(() => new MainWindowViewModel(
                                                               resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                               resolver.GetRequiredService <IOperationsViewModel>(),
                                                               CreateFilesPanelViewModel(resolver, "Left"),
                                                               CreateFilesPanelViewModel(resolver, "Right"),
                                                               resolver.GetRequiredService <IMenuViewModel>(),
                                                               resolver.GetRequiredService <IOperationsStateViewModel>(),
                                                               resolver.GetRequiredService <ITopOperationsViewModel>(),
                                                               resolver.GetRequiredService <IDrivesListViewModel>(),
                                                               resolver.GetRequiredService <IFavouriteDirectoriesListViewModel>()
                                                               ));
 }
예제 #16
0
 private static void RegisterCommonServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IArchiveProcessorFactory>(() => new ArchiveProcessorFactory(
                                                                   resolver.GetRequiredService <IFileService>(),
                                                                   resolver.GetRequiredService <IDirectoryService>(),
                                                                   resolver.GetRequiredService <IFileNameGenerationService>(),
                                                                   resolver.GetRequiredService <IPathService>()
                                                                   ));
     services.Register <ICreateArchiveStateService>(() => new CreateArchiveStateService(
                                                        resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                        ));
     services.RegisterLazySingleton <IArchiveTypeMapper>(() => new ArchiveTypeMapper(
                                                             resolver.GetRequiredService <IPathService>(),
                                                             resolver.GetRequiredService <ArchiveTypeMapperConfiguration>()
                                                             ));
     services.RegisterLazySingleton <IArchiveService>(() => new ArchiveService(
                                                          resolver.GetRequiredService <IArchiveTypeMapper>(),
                                                          resolver.GetRequiredService <IPathService>(),
                                                          resolver.GetRequiredService <IOperationsService>(),
                                                          resolver.GetRequiredService <IFileNameGenerationService>()
                                                          ));
     services.RegisterLazySingleton <IFileService>(() => new FileService(
                                                       resolver.GetRequiredService <IPathService>(),
                                                       resolver.GetRequiredService <IEnvironmentFileService>(),
                                                       resolver.GetRequiredService <ILogger>()
                                                       ));
     services.RegisterLazySingleton <IDateTimeProvider>(() => new DateTimeProvider());
     services.RegisterLazySingleton <IDrivesUpdateService>(() => new DrivesUpdateService(
                                                               resolver.GetRequiredService <IMountedDriveService>(),
                                                               resolver.GetRequiredService <IUnmountedDriveService>(),
                                                               resolver.GetRequiredService <DriveServiceConfiguration>()
                                                               ));
     services.RegisterLazySingleton <IOperationsFactory>(() => new OperationsFactory(
                                                             resolver.GetRequiredService <IDirectoryService>(),
                                                             resolver.GetRequiredService <IFileService>(),
                                                             resolver.GetRequiredService <IPathService>(),
                                                             resolver.GetRequiredService <IFileNameGenerationService>(),
                                                             resolver.GetRequiredService <ILogger>(),
                                                             resolver.GetRequiredService <IArchiveProcessorFactory>()
                                                             ));
     services.RegisterLazySingleton <INodesSelectionService>(() => new NodesSelectionService());
     services.RegisterLazySingleton <IOperationsService>(() => new OperationsService(
                                                             resolver.GetRequiredService <IOperationsFactory>(),
                                                             resolver.GetRequiredService <IDirectoryService>(),
                                                             resolver.GetRequiredService <IResourceOpeningService>(),
                                                             resolver.GetRequiredService <IFileService>(),
                                                             resolver.GetRequiredService <IPathService>(),
                                                             resolver.GetRequiredService <IOperationsStateService>()
                                                             ));
     services.RegisterLazySingleton <IDirectoryService>(() => new DirectoryService(
                                                            resolver.GetRequiredService <IPathService>(),
                                                            resolver.GetRequiredService <IEnvironmentDirectoryService>(),
                                                            resolver.GetRequiredService <IEnvironmentFileService>(),
                                                            resolver.GetRequiredService <ILogger>()
                                                            ));
     services.Register <IFileSystemWatchingService>(() => new FileSystemWatchingService(
                                                        resolver.GetRequiredService <IFileSystemWatcherFactory>()
                                                        ));
     services.RegisterLazySingleton(() => new FileOpeningBehavior(
                                        resolver.GetRequiredService <IResourceOpeningService>()
                                        ));
     services.RegisterLazySingleton(() => new DirectoryOpeningBehavior(
                                        resolver.GetRequiredService <IDirectoryService>(),
                                        resolver.GetRequiredService <IResourceOpeningService>()
                                        ));
     services.RegisterLazySingleton <ILocalizationService>(() => new LocalizationService(
                                                               resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                               ));
     services.RegisterLazySingleton <IThemeService>(() => new ThemeService(
                                                        resolver.GetRequiredService <IUnitOfWorkFactory>(),
                                                        resolver.GetRequiredService <DefaultThemeConfiguration>()
                                                        ));
     services.RegisterLazySingleton <IFileSizeFormatter>(() => new FileSizeFormatter());
     services.RegisterLazySingleton <IPathService>(() => new PathService(
                                                       resolver.GetRequiredService <IEnvironmentPathService>()
                                                       ));
     services.RegisterLazySingleton <IDialogService>(() => new DialogService(
                                                         resolver.GetRequiredService <IMainWindowProvider>()
                                                         ));
     services.RegisterLazySingleton <ISystemDialogService>(() => new SystemDialogService(
                                                               resolver.GetRequiredService <IMainWindowProvider>()
                                                               ));
     services.RegisterLazySingleton <IResourceProvider>(() => new ResourceProvider());
     services.RegisterLazySingleton <ILanguageManager>(() => new LanguageManager());
     services.RegisterLazySingleton <IClipboardOperationsService>(() => new ClipboardOperationsService(
                                                                      resolver.GetRequiredService <IClipboardService>(),
                                                                      resolver.GetRequiredService <IOperationsService>(),
                                                                      resolver.GetRequiredService <IEnvironmentService>()
                                                                      ));
     services.RegisterLazySingleton <IOperationsStateService>(() => new OperationsStateService());
     services.RegisterLazySingleton <IFileNameGenerationService>(() => new FileNameGenerationService(
                                                                     resolver.GetRequiredService <IFileService>(),
                                                                     resolver.GetRequiredService <IDirectoryService>(),
                                                                     resolver.GetRequiredService <IPathService>()
                                                                     ));
     services.RegisterLazySingleton <IOpenWithApplicationService>(() => new OpenWithApplicationService(
                                                                      resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                                      ));
 }
예제 #17
0
 private static void RegisterWindowsServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IWindowsRemovedFileMetadataBuilderFactory>(() => new WindowsRemovedFileMetadataBuilderFactory());
     services.RegisterLazySingleton <IWindowsTrashCanNodeNameGenerator>(() => new WindowsTrashCanNodeNameGenerator());
     services.RegisterLazySingleton <IHomeDirectoryProvider>(() => new WindowsHomeDirectoryProvider(
                                                                 resolver.GetRequiredService <IEnvironmentService>()
                                                                 ));
     services.RegisterLazySingleton <IUnmountedDriveService>(() => new WindowsUnmountedDriveService());
     services.RegisterLazySingleton <ITrashCanService>(() => new WindowsTrashCanService(
                                                           resolver.GetRequiredService <IMountedDriveService>(),
                                                           resolver.GetRequiredService <IOperationsService>(),
                                                           resolver.GetRequiredService <IPathService>(),
                                                           resolver.GetRequiredService <IFileService>(),
                                                           resolver.GetRequiredService <IDateTimeProvider>(),
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IWindowsRemovedFileMetadataBuilderFactory>(),
                                                           resolver.GetRequiredService <IWindowsTrashCanNodeNameGenerator>()
                                                           ));
     services.RegisterLazySingleton <IResourceOpeningService>(() => new ResourceOpeningServiceOpenWith(
                                                                  new WindowsResourceOpeningService(
                                                                      resolver.GetRequiredService <IProcessService>()
                                                                      ),
                                                                  resolver.GetRequiredService <IOpenWithApplicationService>(),
                                                                  resolver.GetRequiredService <IPathService>()
                                                                  ));
     services.RegisterLazySingleton <ITerminalService>(() => new WindowsTerminalService(
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                           ));
     services.RegisterLazySingleton <IApplicationService>(() => new WindowsApplicationService(
                                                              resolver.GetRequiredService <IEnvironmentService>(),
                                                              resolver.GetRequiredService <IRegexService>(),
                                                              resolver.GetRequiredService <IApplicationInfoProvider>(),
                                                              resolver.GetRequiredService <IRegistryService>()
                                                              ));
     services.RegisterLazySingleton <IApplicationInfoProvider>(() => new WindowsApplicationInfoProvider());
     services.RegisterLazySingleton <IRegistryService>(() => new WindowsRegistryService());
     services.RegisterLazySingleton <IMountedDriveService>(() => new WindowsMountedDriveService(
                                                               resolver.GetRequiredService <IEnvironmentDriveService>(),
                                                               resolver.GetRequiredService <IProcessService>()
                                                               ));
 }
예제 #18
0
 private static void RegisterMacServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IUnmountedDriveService>(() => new MacUnmountedDriveService(
                                                                 resolver.GetRequiredService <IProcessService>(),
                                                                 resolver.GetRequiredService <IEnvironmentService>(),
                                                                 resolver.GetRequiredService <MacUnmountedDrivesConfiguration>()
                                                                 ));
     services.RegisterLazySingleton <ITrashCanService>(() => new MacTrashCanService(
                                                           resolver.GetRequiredService <IMountedDriveService>(),
                                                           resolver.GetRequiredService <IOperationsService>(),
                                                           resolver.GetRequiredService <IPathService>(),
                                                           resolver.GetRequiredService <IFileService>(),
                                                           resolver.GetRequiredService <IEnvironmentService>(),
                                                           resolver.GetRequiredService <IDirectoryService>(),
                                                           resolver.GetRequiredService <IHomeDirectoryProvider>()
                                                           ));
     services.RegisterLazySingleton <IResourceOpeningService>(() => new ResourceOpeningServiceOpenWith(
                                                                  new MacResourceOpeningService(resolver.GetRequiredService <IProcessService>()),
                                                                  resolver.GetRequiredService <IOpenWithApplicationService>(),
                                                                  resolver.GetRequiredService <IPathService>()
                                                                  ));
     services.RegisterLazySingleton <IHomeDirectoryProvider>(() => new UnixHomeDirectoryProvider(
                                                                 resolver.GetRequiredService <IEnvironmentService>()
                                                                 ));
     services.RegisterLazySingleton <ITerminalService>(() => new MacTerminalService(
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                           ));
     services.Register <IApplicationsListLoader>(() => new MacApplicationsListLoader(
                                                     resolver.GetRequiredService <IDirectoryService>()
                                                     ));
     services.Register <IApplicationsAssociationsLoader>(() => new MacApplicationsAssociationsLoader(
                                                             resolver.GetRequiredService <IProcessService>(),
                                                             resolver.GetRequiredService <UtiToExtensionsMappingConfiguration>()
                                                             ));
     services.RegisterLazySingleton <IApplicationService>(() => new MacApplicationService(
                                                              resolver.GetRequiredService <IApplicationsListLoader>(),
                                                              resolver.GetRequiredService <IApplicationsAssociationsLoader>()
                                                              ));
     services.RegisterLazySingleton <IMountedDriveService>(() => new MacMountedDriveService(
                                                               resolver.GetRequiredService <IEnvironmentDriveService>(),
                                                               resolver.GetRequiredService <IProcessService>()
                                                               ));
 }
예제 #19
0
 private static void RegisterLinuxServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <ILinuxRemovedFileMetadataBuilderFactory>(() => new LinuxRemovedFileMetadataBuilderFactory());
     services.RegisterLazySingleton <IUnmountedDriveService>(() => new LinuxUnmountedDriveService(
                                                                 resolver.GetRequiredService <IProcessService>(),
                                                                 resolver.GetRequiredService <IEnvironmentService>(),
                                                                 resolver.GetRequiredService <LinuxUnmountedDrivesConfiguration>()
                                                                 ));
     services.RegisterLazySingleton <ITrashCanService>(() => new LinuxTrashCanService(
                                                           resolver.GetRequiredService <IMountedDriveService>(),
                                                           resolver.GetRequiredService <IOperationsService>(),
                                                           resolver.GetRequiredService <IPathService>(),
                                                           resolver.GetRequiredService <IFileService>(),
                                                           resolver.GetRequiredService <IEnvironmentService>(),
                                                           resolver.GetRequiredService <IDirectoryService>(),
                                                           resolver.GetRequiredService <IDateTimeProvider>(),
                                                           resolver.GetRequiredService <ILinuxRemovedFileMetadataBuilderFactory>(),
                                                           resolver.GetRequiredService <IHomeDirectoryProvider>()
                                                           ));
     services.RegisterLazySingleton <IHomeDirectoryProvider>(() => new UnixHomeDirectoryProvider(
                                                                 resolver.GetRequiredService <IEnvironmentService>()
                                                                 ));
     services.RegisterLazySingleton <IDriveNameService>(() => new DriveNameService(
                                                            resolver.GetRequiredService <IProcessService>(),
                                                            resolver.GetRequiredService <IEnvironmentService>()
                                                            ));
     services.RegisterLazySingleton <IDesktopEnvironmentService>(() => new DesktopEnvironmentService(
                                                                     resolver.GetRequiredService <IEnvironmentService>()
                                                                     ));
     services.RegisterLazySingleton <IShellCommandWrappingService>(() => new ShellCommandWrappingService());
     services.RegisterLazySingleton <IResourceOpeningService>(() => new ResourceOpeningServiceOpenWith(
                                                                  new LinuxResourceOpeningService(
                                                                      resolver.GetRequiredService <IProcessService>(),
                                                                      resolver.GetRequiredService <IShellCommandWrappingService>(),
                                                                      resolver.GetRequiredService <IDesktopEnvironmentService>()),
                                                                  resolver.GetRequiredService <IOpenWithApplicationService>(),
                                                                  resolver.GetRequiredService <IPathService>()
                                                                  ));
     services.RegisterLazySingleton <ITerminalService>(() => new LinuxTerminalService(
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IUnitOfWorkFactory>(),
                                                           resolver.GetRequiredService <IDesktopEnvironmentService>(),
                                                           resolver.GetRequiredService <IShellCommandWrappingService>()
                                                           ));
     services.RegisterLazySingleton <IMimeTypesReader>(() => new MimeTypesReader());
     services.RegisterLazySingleton <IIniReader>(() => new IniReader());
     services.RegisterLazySingleton <IApplicationService>(() => new LinuxApplicationService(
                                                              resolver.GetRequiredService <IFileService>(),
                                                              resolver.GetRequiredService <IDirectoryService>(),
                                                              resolver.GetRequiredService <IHomeDirectoryProvider>(),
                                                              resolver.GetRequiredService <IIniReader>(),
                                                              resolver.GetRequiredService <IRegexService>(),
                                                              resolver.GetRequiredService <IMimeTypesReader>(),
                                                              resolver.GetRequiredService <IPathService>()
                                                              ));
     services.RegisterLazySingleton <IMountedDriveService>(() => new LinuxMountedDriveService(
                                                               resolver.GetRequiredService <IEnvironmentDriveService>(),
                                                               resolver.GetRequiredService <IProcessService>(),
                                                               resolver.GetRequiredService <IDriveNameService>(),
                                                               resolver.GetRequiredService <ILogger>()
                                                               ));
 }
예제 #20
0
        private static async Task InitializeApplicationsList(IReadonlyDependencyResolver resolver)
        {
            var applicationService = resolver.GetRequiredService <IApplicationService>();

            await applicationService.GetInstalledApplicationsAsync();
        }
예제 #21
0
        private static IFilesPanelViewModel CreateFilesPanelViewModel(
            IReadonlyDependencyResolver resolver,
            string panelKey)
        {
            var filesPanelStateService = new FilesPanelStateService(
                resolver.GetRequiredService <IUnitOfWorkFactory>(),
                panelKey
                );
            var tabsListViewModel = new TabsListViewModel(
                filesPanelStateService,
                resolver.GetRequiredService <IDirectoryService>(),
                resolver.GetRequiredService <ITabViewModelFactory>(),
                resolver.GetRequiredService <FilePanelConfiguration>()
                );
            var filesPanelViewModel = new FilesPanelViewModel(
                resolver.GetRequiredService <IFileService>(),
                resolver.GetRequiredService <IDirectoryService>(),
                resolver.GetRequiredService <INodesSelectionService>(),
                resolver.GetRequiredService <IFileSystemNodeViewModelFactory>(),
                resolver.GetRequiredService <IFileSystemWatchingService>(),
                resolver.GetRequiredService <IApplicationDispatcher>(),
                resolver.GetRequiredService <IFileSizeFormatter>(),
                resolver.GetRequiredService <IClipboardOperationsService>(),
                resolver.GetRequiredService <IFileSystemNodeViewModelComparerFactory>(),
                resolver.GetRequiredService <ISearchViewModel>(),
                tabsListViewModel
                );

            return(filesPanelViewModel);
        }
예제 #22
0
 private static void RegisterViewModels(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IFilesOperationsMediator>(() => new FilesOperationsMediator(
                                                                   resolver.GetRequiredService <IDirectoryService>()
                                                                   ));
     services.RegisterLazySingleton <IFileSystemNodeViewModelComparerFactory>(() => new FileSystemNodeViewModelComparerFactory());
     services.Register(() => new TerminalSettingsViewModel(
                           resolver.GetRequiredService <ITerminalService>()
                           ));
     services.Register(() => new GeneralSettingsViewModel(
                           resolver.GetRequiredService <LanguageSettingsViewModel>()
                           ));
     services.Register(() => new LanguageSettingsViewModel(
                           resolver.GetRequiredService <ILocalizationService>(),
                           resolver.GetRequiredService <ILanguageManager>()
                           ));
     services.Register(() => new SettingsDialogViewModel(
                           resolver.GetRequiredService <GeneralSettingsViewModel>(),
                           resolver.GetRequiredService <TerminalSettingsViewModel>()
                           ));
     services.RegisterLazySingleton <ITabViewModelFactory>(() => new TabViewModelFactory(
                                                               resolver.GetRequiredService <IPathService>()
                                                               ));
     services.RegisterLazySingleton(() => new FilePropertiesBehavior(
                                        resolver.GetRequiredService <IDialogService>()
                                        ));
     services.RegisterLazySingleton(() => new DirectoryPropertiesBehavior(
                                        resolver.GetRequiredService <IDialogService>()
                                        ));
     services.RegisterLazySingleton <IFileSystemNodeViewModelFactory>(() => new FileSystemNodeViewModelFactory(
                                                                          resolver.GetRequiredService <FileOpeningBehavior>(),
                                                                          resolver.GetRequiredService <DirectoryOpeningBehavior>(),
                                                                          resolver.GetRequiredService <IFileSizeFormatter>(),
                                                                          resolver.GetRequiredService <IPathService>(),
                                                                          resolver.GetRequiredService <IOperationsService>(),
                                                                          resolver.GetRequiredService <IClipboardOperationsService>(),
                                                                          resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                          resolver.GetRequiredService <FilePropertiesBehavior>(),
                                                                          resolver.GetRequiredService <DirectoryPropertiesBehavior>(),
                                                                          resolver.GetRequiredService <IDialogService>(),
                                                                          resolver.GetRequiredService <ITrashCanService>()
                                                                          ));
     services.Register(() => new AboutDialogViewModel(
                           resolver.GetRequiredService <IApplicationVersionProvider>(),
                           resolver.GetRequiredService <IResourceOpeningService>(),
                           resolver.GetRequiredService <AboutDialogConfiguration>()
                           ));
     services.RegisterLazySingleton <IBitmapFactory>(() => new BitmapFactory());
     services.Register(() => new MainNodeInfoTabViewModel(
                           resolver.GetRequiredService <IFileSizeFormatter>(),
                           resolver.GetRequiredService <IPathService>(),
                           resolver.GetRequiredService <IBitmapFactory>(),
                           resolver.GetRequiredService <ImagePreviewConfiguration>()
                           ));
     services.Register(() => new DirectoryInformationDialogViewModel(
                           resolver.GetRequiredService <IDirectoryService>(),
                           resolver.GetRequiredService <IApplicationDispatcher>(),
                           resolver.GetRequiredService <MainNodeInfoTabViewModel>()
                           ));
     services.Register(() => new FileInformationDialogViewModel(
                           resolver.GetRequiredService <IFileService>(),
                           resolver.GetRequiredService <MainNodeInfoTabViewModel>()
                           ));
     services.Register(() => new OverwriteOptionsDialogViewModel(
                           resolver.GetRequiredService <IFileService>(),
                           resolver.GetRequiredService <IFileSystemNodeViewModelFactory>(),
                           resolver.GetRequiredService <IFileNameGenerationService>(),
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register(() => new CreateDirectoryDialogViewModel(
                           resolver.GetRequiredService <IDirectoryService>(),
                           resolver.GetRequiredService <IFileService>(),
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register <IOperationsStateViewModel>(() => new OperationsStatesListViewModel(
                                                       resolver.GetRequiredService <IOperationsStateService>(),
                                                       resolver.GetRequiredService <IOperationStateViewModelFactory>(),
                                                       resolver.GetRequiredService <IApplicationDispatcher>(),
                                                       resolver.GetRequiredService <IDialogService>()
                                                       ));
     services.Register(() => new RemoveNodesConfirmationDialogViewModel(
                           resolver.GetRequiredService <IPathService>()
                           ));
     services.Register <IOperationStateViewModelFactory>(() => new OperationStateViewModelFactory(
                                                             resolver.GetRequiredService <IPathService>()
                                                             ));
     services.Register <IOperationsViewModel>(() => new OperationsViewModel(
                                                  resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                  resolver.GetRequiredService <IOperationsService>(),
                                                  resolver.GetRequiredService <INodesSelectionService>(),
                                                  resolver.GetRequiredService <IDialogService>(),
                                                  resolver.GetRequiredService <IDirectoryService>(),
                                                  resolver.GetRequiredService <ITrashCanService>()
                                                  ));
     services.Register <IMenuViewModel>(() => new MenuViewModel(
                                            resolver.GetRequiredService <IApplicationCloser>(),
                                            resolver.GetRequiredService <IDialogService>()
                                            ));
     services.Register <ISearchViewModel>(() => new SearchViewModel(
                                              resolver.GetRequiredService <SearchViewModelConfiguration>()
                                              ));
     services.Register <ITopOperationsViewModel>(() => new TopOperationsViewModel(
                                                     resolver.GetRequiredService <ITerminalService>(),
                                                     resolver.GetRequiredService <IDirectoryService>(),
                                                     resolver.GetRequiredService <IFilesOperationsMediator>()
                                                     ));
     services.RegisterLazySingleton(() => new MainWindowViewModel(
                                        resolver.GetRequiredService <IFilesOperationsMediator>(),
                                        resolver.GetRequiredService <IOperationsViewModel>(),
                                        CreateFilesPanelViewModel(resolver, "Left"),
                                        CreateFilesPanelViewModel(resolver, "Right"),
                                        resolver.GetRequiredService <IMenuViewModel>(),
                                        resolver.GetRequiredService <IOperationsStateViewModel>(),
                                        resolver.GetRequiredService <ITopOperationsViewModel>()
                                        ));
 }
예제 #23
0
 private static void RegisterMacViewModels(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton(() => new MacDirectoryOpeningBehavior(
                                        resolver.GetRequiredService <FileOpeningBehavior>(),
                                        resolver.GetRequiredService <DirectoryOpeningBehavior>()
                                        ));
     services.RegisterLazySingleton <IFileSystemNodeViewModelFactory>(() => new FileSystemNodeViewModelFactory(
                                                                          resolver.GetRequiredService <FileOpeningBehavior>(),
                                                                          resolver.GetRequiredService <MacDirectoryOpeningBehavior>(),
                                                                          resolver.GetRequiredService <IFileSizeFormatter>(),
                                                                          resolver.GetRequiredService <IPathService>(),
                                                                          resolver.GetRequiredService <IOperationsService>(),
                                                                          resolver.GetRequiredService <IClipboardOperationsService>(),
                                                                          resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                          resolver.GetRequiredService <FilePropertiesBehavior>(),
                                                                          resolver.GetRequiredService <DirectoryPropertiesBehavior>(),
                                                                          resolver.GetRequiredService <IDialogService>(),
                                                                          resolver.GetRequiredService <ITrashCanService>(),
                                                                          resolver.GetRequiredService <IFileService>(),
                                                                          resolver.GetRequiredService <IDirectoryService>(),
                                                                          resolver.GetRequiredService <IArchiveService>(),
                                                                          resolver.GetRequiredService <ISystemDialogService>(),
                                                                          resolver.GetRequiredService <IOpenWithApplicationService>()
                                                                          ));
 }
예제 #24
0
 private static void RegisterServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IFilesOperationsMediator>(() => new FilesOperationsMediator(
                                                                   resolver.GetRequiredService <IDirectoryService>()
                                                                   ));
     services.Register <IFilePanelDirectoryObserver>(() => new FilePanelDirectoryObserver(
                                                         resolver.GetRequiredService <IPathService>()
                                                         ));
     services.RegisterLazySingleton <IFileSystemNodeFacade>(() => new FileSystemNodeFacade(
                                                                resolver.GetRequiredService <IOperationsService>(),
                                                                resolver.GetRequiredService <IClipboardOperationsService>(),
                                                                resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                resolver.GetRequiredService <IDialogService>(),
                                                                resolver.GetRequiredService <ITrashCanService>(),
                                                                resolver.GetRequiredService <IArchiveService>(),
                                                                resolver.GetRequiredService <ISystemDialogService>(),
                                                                resolver.GetRequiredService <IOpenWithApplicationService>(),
                                                                resolver.GetRequiredService <IPathService>()
                                                                ));
     services.RegisterLazySingleton <IDragAndDropOperationsMediator>(() => new DragAndDropOperationsMediator(
                                                                         resolver.GetRequiredService <IOperationsService>(),
                                                                         resolver.GetRequiredService <IDirectoryService>(),
                                                                         resolver.GetRequiredService <IPathService>()
                                                                         ));
     services.RegisterLazySingleton <IClipboardOperationsViewModel>(() => new ClipboardOperationsViewModel(
                                                                        resolver.GetRequiredService <IClipboardOperationsService>(),
                                                                        resolver.GetRequiredService <INodesSelectionService>(),
                                                                        resolver.GetRequiredService <IDirectoryService>()
                                                                        ));
 }
예제 #25
0
 private static void RegisterLinuxServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <ILinuxRemovedFileMetadataBuilderFactory>(() => new LinuxRemovedFileMetadataBuilderFactory());
     services.RegisterLazySingleton <ITrashCanService>(() => new LinuxTrashCanService(
                                                           resolver.GetRequiredService <IDriveService>(),
                                                           resolver.GetRequiredService <IOperationsService>(),
                                                           resolver.GetRequiredService <IPathService>(),
                                                           resolver.GetRequiredService <IFileService>(),
                                                           resolver.GetRequiredService <IEnvironmentService>(),
                                                           resolver.GetRequiredService <IDirectoryService>(),
                                                           resolver.GetRequiredService <IDateTimeProvider>(),
                                                           resolver.GetRequiredService <ILinuxRemovedFileMetadataBuilderFactory>()
                                                           ));
     services.RegisterLazySingleton <IDesktopEnvironmentService>(() => new DesktopEnvironmentService(
                                                                     resolver.GetRequiredService <IEnvironmentService>()
                                                                     ));
     services.RegisterLazySingleton <IShellCommandWrappingService>(() => new ShellCommandWrappingService());
     services.RegisterLazySingleton <IResourceOpeningService>(() => new LinuxResourceOpeningService(
                                                                  resolver.GetRequiredService <IProcessService>(),
                                                                  resolver.GetRequiredService <IShellCommandWrappingService>(),
                                                                  resolver.GetRequiredService <IDesktopEnvironmentService>()
                                                                  ));
     services.RegisterLazySingleton <ITerminalService>(() => new LinuxTerminalService(
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IUnitOfWorkFactory>(),
                                                           resolver.GetRequiredService <IDesktopEnvironmentService>(),
                                                           resolver.GetRequiredService <IShellCommandWrappingService>()
                                                           ));
 }
예제 #26
0
 private static void RegisterServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IFileService>(() => new FileService(
                                                       resolver.GetRequiredService <IPathService>(),
                                                       resolver.GetRequiredService <IEnvironmentFileService>()
                                                       ));
     services.RegisterLazySingleton <IDateTimeProvider>(() => new DateTimeProvider());
     services.RegisterLazySingleton <IDriveService>(() => new DriveService(
                                                        resolver.GetRequiredService <IEnvironmentDriveService>()
                                                        ));
     services.Register <IOperationsFactory>(() => new OperationsFactory(
                                                resolver.GetRequiredService <ITaskPool>(),
                                                resolver.GetRequiredService <IDirectoryService>(),
                                                resolver.GetRequiredService <IFileService>(),
                                                resolver.GetRequiredService <IPathService>(),
                                                resolver.GetRequiredService <IFileNameGenerationService>()
                                                ));
     services.RegisterLazySingleton <INodesSelectionService>(() => new NodesSelectionService());
     services.RegisterLazySingleton <IOperationsService>(() => new OperationsService(
                                                             resolver.GetRequiredService <IOperationsFactory>(),
                                                             resolver.GetRequiredService <IDirectoryService>(),
                                                             resolver.GetRequiredService <IResourceOpeningService>(),
                                                             resolver.GetRequiredService <IFileService>(),
                                                             resolver.GetRequiredService <IPathService>(),
                                                             resolver.GetRequiredService <IOperationsStateService>()
                                                             ));
     services.RegisterLazySingleton <IDirectoryService>(() => new DirectoryService(
                                                            resolver.GetRequiredService <IPathService>(),
                                                            resolver.GetRequiredService <IEnvironmentDirectoryService>(),
                                                            resolver.GetRequiredService <IEnvironmentFileService>()
                                                            ));
     services.Register <IFileSystemWatchingService>(() => new FileSystemWatchingService(
                                                        resolver.GetRequiredService <IFileSystemWatcherFactory>()
                                                        ));
     services.RegisterLazySingleton(() => new FileOpeningBehavior(
                                        resolver.GetRequiredService <IResourceOpeningService>()
                                        ));
     services.RegisterLazySingleton(() => new DirectoryOpeningBehavior(
                                        resolver.GetRequiredService <IDirectoryService>()
                                        ));
     services.RegisterLazySingleton <ILocalizationService>(() => new LocalizationService(
                                                               resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                               ));
     services.RegisterLazySingleton <IFileSizeFormatter>(() => new FileSizeFormatter());
     services.RegisterLazySingleton <IPathService>(() => new PathService(
                                                       resolver.GetRequiredService <IEnvironmentPathService>()
                                                       ));
     services.RegisterLazySingleton <IDialogService>(() => new DialogService(
                                                         resolver.GetRequiredService <IMainWindowProvider>()
                                                         ));
     services.RegisterLazySingleton <ILanguageManager>(() => new LanguageManager());
     services.RegisterLazySingleton <IClipboardOperationsService>(() => new ClipboardOperationsService(
                                                                      resolver.GetRequiredService <IClipboardService>(),
                                                                      resolver.GetRequiredService <IOperationsService>(),
                                                                      resolver.GetRequiredService <IEnvironmentService>()
                                                                      ));
     services.RegisterLazySingleton <IOperationsStateService>(() => new OperationsStateService());
     services.RegisterLazySingleton <IFileNameGenerationService>(() => new FileNameGenerationService(
                                                                     resolver.GetRequiredService <IFileService>(),
                                                                     resolver.GetRequiredService <IDirectoryService>(),
                                                                     resolver.GetRequiredService <IPathService>()
                                                                     ));
 }
예제 #27
0
 private static void RegisterMacViewModels(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton(() => new MacDirectoryOpeningBehavior(
                                        resolver.GetRequiredService <FileOpeningBehavior>(),
                                        resolver.GetRequiredService <DirectoryOpeningBehavior>()
                                        ));
     services.RegisterLazySingleton <IFileSystemNodeViewModelFactory>(() => new FileSystemNodeViewModelFactory(
                                                                          resolver.GetRequiredService <FileOpeningBehavior>(),
                                                                          resolver.GetRequiredService <MacDirectoryOpeningBehavior>(),
                                                                          resolver.GetRequiredService <IFileSizeFormatter>(),
                                                                          resolver.GetRequiredService <IPathService>(),
                                                                          resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                          resolver.GetRequiredService <FilePropertiesBehavior>(),
                                                                          resolver.GetRequiredService <DirectoryPropertiesBehavior>(),
                                                                          resolver.GetRequiredService <IFileService>(),
                                                                          resolver.GetRequiredService <IDirectoryService>(),
                                                                          resolver.GetRequiredService <IFileSystemNodeFacade>(),
                                                                          resolver.GetRequiredService <IFileTypeMapper>()
                                                                          ));
 }
예제 #28
0
 private static void RegisterTaskPool(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <ITaskPool>(() => new TaskPool.Implementations.TaskPool(
                                                    resolver.GetRequiredService <IEnvironmentService>()
                                                    ));
 }
예제 #29
0
 private static void RegisterFactories(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IFileSystemNodeViewModelComparerFactory>(() => new FileSystemNodeViewModelComparerFactory());
     services.RegisterLazySingleton <ITabViewModelFactory>(() => new TabViewModelFactory(
                                                               resolver.GetRequiredService <IPathService>(),
                                                               resolver.GetRequiredService <TabConfiguration>()
                                                               ));
     services.RegisterLazySingleton <ISuggestedPathViewModelFactory>(() => new SuggestedPathViewModelFactory(
                                                                         resolver.GetRequiredService <IPathService>()
                                                                         ));
     services.RegisterLazySingleton <IThemeViewModelFactory>(() => new ThemeViewModelFactory(
                                                                 resolver.GetRequiredService <IResourceProvider>(),
                                                                 resolver.GetRequiredService <ThemesNamesConfiguration>()
                                                                 ));
     services.Register <IArchiveTypeViewModelFactory>(() => new ArchiveTypeViewModelFactory(
                                                          resolver.GetRequiredService <ArchiveTypeViewModelFactoryConfiguration>()
                                                          ));
     services.RegisterLazySingleton <IFileSystemNodeViewModelFactory>(() => new FileSystemNodeViewModelFactory(
                                                                          resolver.GetRequiredService <FileOpeningBehavior>(),
                                                                          resolver.GetRequiredService <DirectoryOpeningBehavior>(),
                                                                          resolver.GetRequiredService <IFileSizeFormatter>(),
                                                                          resolver.GetRequiredService <IPathService>(),
                                                                          resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                          resolver.GetRequiredService <FilePropertiesBehavior>(),
                                                                          resolver.GetRequiredService <DirectoryPropertiesBehavior>(),
                                                                          resolver.GetRequiredService <IFileService>(),
                                                                          resolver.GetRequiredService <IDirectoryService>(),
                                                                          resolver.GetRequiredService <IFileSystemNodeFacade>(),
                                                                          resolver.GetRequiredService <IFileTypeMapper>()
                                                                          ));
     services.RegisterLazySingleton <IBitmapFactory>(() => new BitmapFactory());
     services.Register(() => new MainNodeInfoTabViewModel(
                           resolver.GetRequiredService <IFileSizeFormatter>(),
                           resolver.GetRequiredService <IPathService>(),
                           resolver.GetRequiredService <IBitmapFactory>(),
                           resolver.GetRequiredService <IFileTypeMapper>(),
                           resolver.GetRequiredService <ImagePreviewConfiguration>()
                           ));
     services.RegisterLazySingleton <IDriveViewModelFactory>(() => new DriveViewModelFactory(
                                                                 resolver.GetRequiredService <IFileSizeFormatter>(),
                                                                 resolver.GetRequiredService <IPathService>(),
                                                                 resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                 resolver.GetRequiredService <IUnmountedDriveService>(),
                                                                 resolver.GetRequiredService <IMountedDriveService>(),
                                                                 resolver.GetRequiredService <IPlatformService>()
                                                                 ));
     services.RegisterLazySingleton <IFavouriteDirectoryViewModelFactory>(() => new FavouriteDirectoryViewModelFactory(
                                                                              resolver.GetRequiredService <IFilesOperationsMediator>(),
                                                                              resolver.GetRequiredService <IDirectoryService>(),
                                                                              resolver.GetRequiredService <IFavouriteDirectoriesService>()
                                                                              ));
     services.RegisterLazySingleton <IFavouriteDirectoriesListViewModel>(() => new FavouriteDirectoriesListViewModel(
                                                                             resolver.GetRequiredService <IFavouriteDirectoryViewModelFactory>(),
                                                                             resolver.GetRequiredService <IFavouriteDirectoriesService>()
                                                                             ));
 }
예제 #30
0
 private static void RegisterWindowsServices(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
 {
     services.RegisterLazySingleton <IWindowsRemovedFileMetadataBuilderFactory>(() => new WindowsRemovedFileMetadataBuilderFactory());
     services.RegisterLazySingleton <IWindowsTrashCanNodeNameGenerator>(() => new WindowsTrashCanNodeNameGenerator());
     services.RegisterLazySingleton <ITrashCanService>(() => new WindowsTrashCanService(
                                                           resolver.GetRequiredService <IDriveService>(),
                                                           resolver.GetRequiredService <IOperationsService>(),
                                                           resolver.GetRequiredService <IPathService>(),
                                                           resolver.GetRequiredService <IFileService>(),
                                                           resolver.GetRequiredService <IDateTimeProvider>(),
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IWindowsRemovedFileMetadataBuilderFactory>(),
                                                           resolver.GetRequiredService <IWindowsTrashCanNodeNameGenerator>()
                                                           ));
     services.RegisterLazySingleton <IResourceOpeningService>(() => new WindowsResourceOpeningService(
                                                                  resolver.GetRequiredService <IProcessService>()
                                                                  ));
     services.RegisterLazySingleton <ITerminalService>(() => new WindowsTerminalService(
                                                           resolver.GetRequiredService <IProcessService>(),
                                                           resolver.GetRequiredService <IUnitOfWorkFactory>()
                                                           ));
 }