MailWindow: Allow users to double click on avaiable/selected documents
All checks were successful
Test / Run tests (push) Successful in 2m58s
All checks were successful
Test / Run tests (push) Successful in 2m58s
This commit is contained in:
@@ -333,7 +333,35 @@ namespace Elwig.Windows {
|
||||
}
|
||||
}
|
||||
|
||||
private async void DocumentAddButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private void AvaiableDocumentsList_MouseDoubleClick(object sender, MouseEventArgs evt) {
|
||||
if (evt.LeftButton != MouseButtonState.Pressed) return;
|
||||
var src = evt.OriginalSource;
|
||||
if (src is Border b) {
|
||||
src = (b.Child as ContentPresenter)?.Content.ToString();
|
||||
} else if (src is TextBlock t) {
|
||||
src = t.Text;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
AvaiableDocumentsList.SelectedIndex = AvaiableDocumentsList.ItemsSource.Cast<object?>().ToList().IndexOf(src);
|
||||
DocumentAddButton_Click(sender, null);
|
||||
}
|
||||
|
||||
private void SelectedDocumentsList_MouseDoubleClick(object sender, MouseEventArgs evt) {
|
||||
if (evt.LeftButton != MouseButtonState.Pressed) return;
|
||||
var src = evt.OriginalSource;
|
||||
if (src is Border b) {
|
||||
src = (b.Child as ContentPresenter)?.Content.ToString();
|
||||
} else if (src is TextBlock t) {
|
||||
src = t.Text;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
SelectedDocumentsList.SelectedItem = SelectedDocs.FirstOrDefault(d => d.Name == (string?)src);
|
||||
DocumentRemoveButton_Click(sender, null);
|
||||
}
|
||||
|
||||
private async void DocumentAddButton_Click(object sender, RoutedEventArgs? evt) {
|
||||
var idx = AvaiableDocumentsList.SelectedIndex;
|
||||
using var ctx = new AppDbContext();
|
||||
if (AvaiableDocumentsList.SelectedItem is not string s)
|
||||
@@ -353,7 +381,7 @@ namespace Elwig.Windows {
|
||||
await UpdateRecipients(ctx);
|
||||
}
|
||||
|
||||
private async void DocumentRemoveButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void DocumentRemoveButton_Click(object sender, RoutedEventArgs? evt) {
|
||||
DeleteCommand.Execute(null);
|
||||
using var ctx = new AppDbContext();
|
||||
await UpdateRecipients(ctx);
|
||||
|
||||
Reference in New Issue
Block a user