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:
@@ -69,7 +69,7 @@
|
||||
Grid.Column="0" Margin="10,8,10,10"/>
|
||||
<ListBox x:Name="AvaiableDocumentsList"
|
||||
Grid.Column="0" Margin="10,30,10,10"
|
||||
SelectionChanged="AvaiableDocumentsList_SelectionChanged"/>
|
||||
SelectionChanged="AvaiableDocumentsList_SelectionChanged" MouseDoubleClick="AvaiableDocumentsList_MouseDoubleClick"/>
|
||||
|
||||
<Button x:Name="DocumentAddButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="14"
|
||||
Grid.Column="1" Margin="0,0,0,30" VerticalAlignment="Center" Height="25" IsEnabled="False"
|
||||
@@ -82,7 +82,7 @@
|
||||
Grid.Column="2" Margin="10,8,10,10"/>
|
||||
<ListBox x:Name="SelectedDocumentsList" DisplayMemberPath="Name"
|
||||
Grid.Column="2" Margin="10,30,10,37"
|
||||
SelectionChanged="SelectedDocumentsList_SelectionChanged">
|
||||
SelectionChanged="SelectedDocumentsList_SelectionChanged" MouseDoubleClick="SelectedDocumentsList_MouseDoubleClick">
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding Path=DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MailWindow}}}"/>
|
||||
</ListBox.InputBindings>
|
||||
|
||||
@@ -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