public async Task Init()
        {
            StorageFolder rootFolder = ApplicationData.Current.TemporaryFolder;

            rootFolder = await rootFolder.CreateFolderAsync("Proxies", CreationCollisionOption.OpenIfExists);

            this.proxyProvider = new FileProxyProvider(rootFolder);
            Assert.AreEqual(0, (await rootFolder.GetFilesAsync()).Count, "Test should start with no proxies");

            IDatabaseAccessList accessList = new MockStorageItemAccessList();

            this.promptService = new MockUserPromptingService();
            IFileAccessService fileService = new MockFileService();

            this.viewModelFactory = new CachedFilesViewModelFactory(
                accessList,
                new FileExportService(accessList, fileService),
                this.proxyProvider,
                this.promptService,
                this.promptService,
                fileService
                );
        }
示例#2
0
        /// <summary>
        /// Constructs the ViewModel.
        /// </summary>
        /// <param name="settingsService">Provides access to the app's settings.</param>
        /// <param name="cachedFilesViewModelFactory">ViewModel factory for managing cached files.</param>
        /// <param name="savedCredentialsViewModelFactory">ViewModel factory for managing saved credentials.</param>
        public AppSettingsViewModel(
            IAppSettingsService settingsService,
            ICachedFilesViewModelFactory cachedFilesViewModelFactory,
            ISavedCredentialsViewModelFactory savedCredentialsViewModelFactory
            )
        {
            this.settingsService                  = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
            this.cachedFilesViewModelFactory      = cachedFilesViewModelFactory ?? throw new ArgumentNullException(nameof(cachedFilesViewModelFactory));
            this.savedCredentialsViewModelFactory = savedCredentialsViewModelFactory ?? throw new ArgumentNullException(nameof(savedCredentialsViewModelFactory));

            Themes = new List <ApplicationTheme>
            {
                ApplicationTheme.Dark,
                ApplicationTheme.Light
            };

            this._selectedTheme = settingsService.AppTheme;
            this._clipboardClearTimerEnabled = settingsService.EnableClipboardTimer;
            this._idleLockTimerEnabled       = settingsService.EnableLockTimer;
            this._clipboardClearTimerMax     = (int)settingsService.ClearClipboardOnTimer;
            this._idleLockTimerMax           = (int)settingsService.LockTimer;
            this._motdEnabled       = settingsService.EnableMotd;
            this._copyPasswordOnUrl = settingsService.CopyPasswordOnUrlOpen;
        }