Ejemplo n.º 1
0
        async void AddSecretButtonOnClick(object sender, RoutedEventArgs e) =>
        await DisableUserInteractionsWhile(async() =>
        {
            var secret = await AddSecretBox.CreateSecretAsync();

            if (secret == null)
            {
                return;
            }

            _secrets.Add(secret);

            await GetRepository(_passphrase).SaveAsync(_secrets);

            EntryListView.Items.Refresh();
        });
Ejemplo n.º 2
0
        async void EditSecretButtonOnClick(object sender, RoutedEventArgs e) =>
        await DisableUserInteractionsWhile(async() =>
        {
            var secret = EntryListView.SelectedItems.Cast <Secret>().Single();

            await AddSecretBox.EditSecretAsync(secret);

            await GetRepository(_passphrase).SaveAsync(_secrets);

            FieldsListView.SelectionChanged  -= FieldsListViewOnSelectionChanged;
            SecretsListView.SelectionChanged -= SecretsListViewOnSelectionChanged;
            EntryListView.Items.Refresh();
            FieldsListView.Items.Refresh();
            SecretsListView.Items.Refresh();
            FieldsListView.SelectedItem       = null;
            SecretsListView.SelectedItem      = null;
            FieldsListView.SelectionChanged  += FieldsListViewOnSelectionChanged;
            SecretsListView.SelectionChanged += SecretsListViewOnSelectionChanged;

            SetState(State.NothingSelected);
        });