Пример #1
0
        public async Task UpdateDatabaseCredentials(CredentialsSetMessage message)
        {
            await _mediator.Send(new UpdateCredentialsCommand
            {
                KeyFilePath = message.KeyFilePath,
                Password    = message.Password
            });

            var database = await _mediator.Send(new GetDatabaseQuery());

            _notification.Show(database.Name, _resource.GetResourceValue("CompositeKeyUpdated"));
        }
Пример #2
0
        private async Task TryCreateDatabase(CredentialsSetMessage message)
        {
            var database = await _mediator.Send(new GetDatabaseQuery());

            if (database.IsDirty)
            {
                MessengerInstance.Register <DatabaseClosedMessage>(this, async m => await CreateDatabase(m.Parameter as CredentialsSetMessage));
                MessengerInstance.Send(new DatabaseAlreadyOpenedMessage {
                    Parameter = message
                });
            }
            else
            {
                await CreateDatabase(message);
            }
        }
Пример #3
0
        private async Task CreateDatabase(CredentialsSetMessage message)
        {
            await _mediator.Send(new CreateDatabaseCommand
            {
                FilePath         = Token,
                KeyFilePath      = message.KeyFilePath,
                Password         = message.Password,
                Name             = "ModernKeePass",
                Version          = _settings.GetSetting(Constants.Settings.DefaultFileFormat, "4"),
                CreateSampleData = _settings.GetSetting(Constants.Settings.Sample, true)
            });

            var database = await _mediator.Send(new GetDatabaseQuery());

            _navigation.NavigateTo(Constants.Navigation.GroupPage, new NavigationItem {
                Id = database.RootGroupId
            });
        }