Skip to content

Commit

Permalink
changed selection mode of multiple keyload lists
Browse files Browse the repository at this point in the history
you can now shift+sel multiple keys/groups at a time to add/remove
  • Loading branch information
W3AXL committed Oct 6, 2023
1 parent 57756a9 commit 2587f73
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
8 changes: 4 additions & 4 deletions sw/control/KFDtool.Gui/Control/P25MultipleKeyload.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
<Label Content="Keys" HorizontalAlignment="Left" Margin="183,5,0,0" VerticalAlignment="Top"/>
<Label Content="Available" HorizontalAlignment="Left" Margin="56,23,0,0" VerticalAlignment="Top"/>
<Label Content="Selected" HorizontalAlignment="Left" Margin="285,23,0,0" VerticalAlignment="Top"/>
<ListBox Name="lbKeysAvailable" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="19,54,0,0" VerticalAlignment="Top" Width="140"/>
<ListBox Name="lbKeysAvailable" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="19,54,0,0" VerticalAlignment="Top" Width="140" SelectionMode="Extended"/>
<Button Content="Add &gt;" HorizontalAlignment="Left" Margin="164,163,0,0" VerticalAlignment="Top" Width="75" Click="Keys_Add_Click"/>
<Button Content="&lt; Remove" HorizontalAlignment="Left" Margin="164,195,0,0" VerticalAlignment="Top" Width="75" Click="Keys_Remove_Click"/>
<ListBox Name="lbKeysSelected" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="244,54,0,0" VerticalAlignment="Top" Width="140"/>
<ListBox Name="lbKeysSelected" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="244,54,0,0" VerticalAlignment="Top" Width="140" SelectionMode="Extended"/>
<Label Content="Groups" HorizontalAlignment="Left" Margin="556,5,0,0" VerticalAlignment="Top"/>
<Label Content="Available" HorizontalAlignment="Left" Margin="438,23,0,0" VerticalAlignment="Top"/>
<Label Content="Selected" HorizontalAlignment="Left" Margin="668,23,0,0" VerticalAlignment="Top"/>
<ListBox Name="lbGroupsAvailable" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="399,54,0,0" VerticalAlignment="Top" Width="140"/>
<ListBox Name="lbGroupsAvailable" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="399,54,0,0" VerticalAlignment="Top" Width="140" SelectionMode="Extended"/>
<Button Content="Add &gt;" HorizontalAlignment="Left" Margin="544,163,0,0" VerticalAlignment="Top" Width="75" Click="Groups_Add_Click"/>
<Button Content="&lt; Remove" HorizontalAlignment="Left" Margin="544,195,0,0" VerticalAlignment="Top" Width="75" Click="Groups_Remove_Click"/>
<ListBox Name="lbGroupsSelected" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="624,54,0,0" VerticalAlignment="Top" Width="140"/>
<ListBox Name="lbGroupsSelected" DisplayMemberPath="Value" HorizontalAlignment="Left" Height="275" Margin="624,54,0,0" VerticalAlignment="Top" Width="140" SelectionMode="Extended"/>
<ComboBox Name="dropKeksAvailable" DisplayMemberPath="Value" HorizontalAlignment="Left" Margin="20,345,0,0" VerticalAlignment="Top" Width="175"/>
<Button Content="Load" HorizontalAlignment="Left" Margin="310,345,0,0" VerticalAlignment="Top" Width="75" Click="Load_Click"/>
<Button Content="Elite Export" HorizontalAlignment="Left" Margin="400,345,0,0" VerticalAlignment="Top" Width="75" Click="Export_Click"/>
Expand Down
38 changes: 23 additions & 15 deletions sw/control/KFDtool.Gui/Control/P25MultipleKeyload.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ private void Keys_Add_Click(object sender, RoutedEventArgs e)
{
if (lbKeysAvailable.SelectedItem != null)
{
int key = ((KeyValuePair<int, string>)lbKeysAvailable.SelectedItem).Key;

Keys.Add(key);

foreach(var item in lbKeysAvailable.SelectedItems)
{
int key = ((KeyValuePair<int, string>)item).Key;
Keys.Add(key);
}

UpdateKeysColumns();
}
}
Expand All @@ -158,10 +160,12 @@ private void Keys_Remove_Click(object sender, RoutedEventArgs e)
{
if (lbKeysSelected.SelectedItem != null)
{
int key = ((KeyValuePair<int, string>)lbKeysSelected.SelectedItem).Key;

Keys.Remove(key);

foreach(var item in lbKeysSelected.SelectedItems)
{
int key = ((KeyValuePair<int, string>)item).Key;
Keys.Remove(key);
}

UpdateKeysColumns();
}
}
Expand All @@ -170,9 +174,11 @@ private void Groups_Add_Click(object sender, RoutedEventArgs e)
{
if (lbGroupsAvailable.SelectedItem != null)
{
int key = ((KeyValuePair<int, string>)lbGroupsAvailable.SelectedItem).Key;

Groups.Add(key);
foreach (var item in lbGroupsAvailable.SelectedItems)
{
int key = ((KeyValuePair<int, string>)item).Key;
Groups.Add(key);
}

UpdateGroupsColumns();
}
Expand All @@ -182,10 +188,12 @@ private void Groups_Remove_Click(object sender, RoutedEventArgs e)
{
if (lbGroupsSelected.SelectedItem != null)
{
int key = ((KeyValuePair<int, string>)lbGroupsSelected.SelectedItem).Key;

Groups.Remove(key);

foreach (var item in lbGroupsSelected.SelectedItems)
{
int key = ((KeyValuePair<int, string>)item).Key;
Groups.Remove(key);
}

UpdateGroupsColumns();
}
}
Expand Down

0 comments on commit 2587f73

Please sign in to comment.