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(); });
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); });