/// <summary> /// Constructs the RootViewModel with the specified parameters. /// </summary> /// <param name="activationMode">How the app was launched.</param> /// <param name="openedFile">The file the app was opened to (or null).</param> /// <param name="passwordGenViewModel">The ViewModel for the password generation flyout.</param> /// <param name="helpViewModel">The ViewModel for the help flyout.</param> /// <param name="appSettingsViewModel">The ViewModel for the settings flyout.</param> /// <param name="clipboardViewModel">a ViewModel over a clipboard clear timer.</param> /// <param name="taskNotificationService">A service used to control the UI for blocking operations.</param> /// <param name="clipboardService">A service for accessing the clipboard.</param> /// <param name="settingsService">A service for accessing app settings.</param> /// <param name="idleTimer">A timer used for computing idle timer.</param> public RootViewModel( ActivationMode activationMode, ITestableFile openedFile, IPasswordGenViewModel passwordGenViewModel, IHelpViewModel helpViewModel, IAppSettingsViewModel appSettingsViewModel, IClipboardClearTimerViewModel clipboardViewModel, ITaskNotificationService taskNotificationService, ISensitiveClipboardService clipboardService, IAppSettingsService settingsService ) { ActivationMode = activationMode; CandidateFile = openedFile; PasswordGenViewModel = passwordGenViewModel ?? throw new ArgumentNullException(nameof(passwordGenViewModel)); HelpViewModel = helpViewModel ?? throw new ArgumentNullException(nameof(helpViewModel)); AppSettingsViewModel = appSettingsViewModel ?? throw new ArgumentNullException(nameof(appSettingsViewModel)); TaskNotificationService = taskNotificationService ?? throw new ArgumentNullException(nameof(taskNotificationService)); ClipboardClearViewModel = clipboardViewModel ?? throw new ArgumentNullException(nameof(clipboardViewModel)); this.clipboardService = clipboardService ?? throw new ArgumentNullException(nameof(clipboardService)); this.settingsService = settingsService; }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="syncContext">Synchronization context used for marshalling to the UI thread.</param> /// <param name="file">The candidate document file.</param> /// <param name="isSampleFile">Whether the file is a PassKeep sample.</param> /// <param name="futureAccessList">A database access list for persisting permission to the database.</param> /// <param name="reader">The IKdbxReader implementation used for parsing document files.</param> /// <param name="proxyProvider">Generates file proxies that the app controls.</param> /// <param name="candidateFactory">Factory used to generate new candidate files as needed.</param> /// <param name="keyChangeVmFactory">Factory used to generate the objects used to modify the master key of the database.</param> /// <param name="taskNotificationService">A service used to notify the UI of blocking operations.</param> /// <param name="identityService">The service used to verify the user's consent for saving credentials.</param> /// <param name="credentialProvider">The provider used to store/load saved credentials.</param> /// <param name="credentialViewModelFactory">A factory used to generate <see cref="ISavedCredentialsViewModel"/> instances.</param> public DatabaseUnlockViewModel( ISyncContext syncContext, IDatabaseCandidate file, bool isSampleFile, IDatabaseAccessList futureAccessList, IKdbxReader reader, IFileProxyProvider proxyProvider, IDatabaseCandidateFactory candidateFactory, IMasterKeyChangeViewModelFactory keyChangeVmFactory, ITaskNotificationService taskNotificationService, IIdentityVerificationService identityService, ICredentialStorageProvider credentialProvider, ISavedCredentialsViewModelFactory credentialViewModelFactory ) { this.syncContext = syncContext ?? throw new ArgumentNullException(nameof(syncContext)); this.futureAccessList = futureAccessList; this.kdbxReader = reader ?? throw new ArgumentNullException(nameof(reader)); this.proxyProvider = proxyProvider ?? throw new ArgumentNullException(nameof(proxyProvider)); this.candidateFactory = candidateFactory ?? throw new ArgumentNullException(nameof(candidateFactory)); this.keyChangeVmFactory = keyChangeVmFactory ?? throw new ArgumentNullException(nameof(keyChangeVmFactory)); this.taskNotificationService = taskNotificationService ?? throw new ArgumentNullException(nameof(taskNotificationService)); this.identityService = identityService ?? throw new ArgumentNullException(nameof(identityService)); this.credentialProvider = credentialProvider ?? throw new ArgumentNullException(nameof(credentialProvider)); this.credentialViewModelFactory = credentialViewModelFactory ?? throw new ArgumentNullException(nameof(credentialViewModelFactory)); SaveCredentials = false; IdentityVerifiability = UserConsentVerifierAvailability.Available; UnlockCommand = new AsyncActionCommand(CanUnlock, DoUnlockAsync); UseSavedCredentialsCommand = new AsyncActionCommand( () => UnlockCommand.CanExecute(null) && HasSavedCredentials, DoUnlockWithSavedCredentials ); IsSampleFile = isSampleFile; RememberDatabase = true; this.initialConstruction = UpdateCandidateFileAsync(file); }
public DatabaseCreationViewModel( ISyncContext syncContext, ITestableFile file, IDatabaseSettingsViewModelFactory settingsVmFactory, IMasterKeyChangeViewModelFactory keyChangeVmFactory, IKdbxWriterFactory writerFactory, IDatabaseAccessList futureAccessList, ITaskNotificationService taskNotificationService, IDatabaseCandidateFactory candidateFactory, IFileAccessService fileAccessService ) : base(fileAccessService) { this.syncContext = syncContext ?? throw new ArgumentNullException(nameof(syncContext)); File = file ?? throw new ArgumentNullException(nameof(file)); Settings = settingsVmFactory?.Assemble() ?? throw new ArgumentNullException(nameof(settingsVmFactory)); this.keyChangeVmFactory = keyChangeVmFactory ?? throw new ArgumentNullException(nameof(keyChangeVmFactory)); this.writerFactory = writerFactory ?? throw new ArgumentNullException(nameof(writerFactory)); this.futureAccessList = futureAccessList ?? throw new ArgumentNullException(nameof(futureAccessList)); this.taskNotificationService = taskNotificationService ?? throw new ArgumentNullException(nameof(taskNotificationService)); this.candidateFactory = candidateFactory ?? throw new ArgumentNullException(nameof(candidateFactory)); CreateEmpty = true; Remember = true; }
public void Init() { this.serviceUnderTest = new TaskNotificationService(); }