mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-27 10:40:08 +00:00
Fix
This commit is contained in:
parent
f9ea8d83d0
commit
0085e0a507
4 changed files with 34 additions and 1 deletions
|
|
@ -27,6 +27,7 @@
|
|||
<Button
|
||||
x:Name="btnSave"
|
||||
Width="100"
|
||||
Click="BtnSave_Click"
|
||||
Content="{x:Static resx:ResUI.TbConfirm}" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
|
|
@ -83,6 +84,9 @@
|
|||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ProfileItems}"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.KeyBindings>
|
||||
<KeyBinding Command="{Binding SelectFinish}" Gesture="Enter" />
|
||||
</DataGrid.KeyBindings>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public partial class ProfilesSelectWindow : ReactiveWindow<ProfilesSelectViewMod
|
|||
private static Config _config;
|
||||
|
||||
public Task<ProfileItem?> ProfileItem => GetFirstProfileItemAsync();
|
||||
private bool _allowMultiSelect = false;
|
||||
|
||||
public ProfilesSelectWindow()
|
||||
{
|
||||
|
|
@ -51,6 +52,7 @@ public partial class ProfilesSelectWindow : ReactiveWindow<ProfilesSelectViewMod
|
|||
|
||||
public void AllowMultiSelect(bool allow)
|
||||
{
|
||||
_allowMultiSelect = allow;
|
||||
if (allow)
|
||||
{
|
||||
lstProfiles.SelectionMode = DataGridSelectionMode.Extended;
|
||||
|
|
@ -113,7 +115,11 @@ public partial class ProfilesSelectWindow : ReactiveWindow<ProfilesSelectViewMod
|
|||
{
|
||||
if (e.Key == Key.A)
|
||||
{
|
||||
lstProfiles.SelectAll();
|
||||
if (_allowMultiSelect)
|
||||
{
|
||||
lstProfiles.SelectAll();
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -121,6 +127,7 @@ public partial class ProfilesSelectWindow : ReactiveWindow<ProfilesSelectViewMod
|
|||
if (e.Key is Key.Enter or Key.Return)
|
||||
{
|
||||
ViewModel?.SelectFinish();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -157,4 +164,10 @@ public partial class ProfilesSelectWindow : ReactiveWindow<ProfilesSelectViewMod
|
|||
var item = await ViewModel?.GetProfileItem();
|
||||
return item;
|
||||
}
|
||||
|
||||
private void BtnSave_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Trigger selection finalize when Confirm is clicked
|
||||
ViewModel?.SelectFinish();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
Width="100"
|
||||
Content="{x:Static resx:ResUI.TbConfirm}"
|
||||
IsDefault="True"
|
||||
Click="BtnSave_Click"
|
||||
Style="{StaticResource DefButton}" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public partial class ProfilesSelectWindow
|
|||
private static Config _config;
|
||||
|
||||
public Task<ProfileItem?> ProfileItem => GetFirstProfileItemAsync();
|
||||
private bool _allowMultiSelect = false;
|
||||
|
||||
public ProfilesSelectWindow()
|
||||
{
|
||||
|
|
@ -46,6 +47,7 @@ public partial class ProfilesSelectWindow
|
|||
|
||||
public void AllowMultiSelect(bool allow)
|
||||
{
|
||||
_allowMultiSelect = allow;
|
||||
if (allow)
|
||||
{
|
||||
lstProfiles.SelectionMode = DataGridSelectionMode.Extended;
|
||||
|
|
@ -108,6 +110,10 @@ public partial class ProfilesSelectWindow
|
|||
|
||||
private void menuSelectAll_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_allowMultiSelect)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lstProfiles.SelectAll();
|
||||
}
|
||||
|
||||
|
|
@ -119,6 +125,7 @@ public partial class ProfilesSelectWindow
|
|||
{
|
||||
case Key.A:
|
||||
menuSelectAll_Click(null, null);
|
||||
e.Handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -127,6 +134,7 @@ public partial class ProfilesSelectWindow
|
|||
if (e.Key is Key.Enter or Key.Return)
|
||||
{
|
||||
ViewModel?.SelectFinish();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -156,6 +164,7 @@ public partial class ProfilesSelectWindow
|
|||
if (e.Key is Key.Enter or Key.Return)
|
||||
{
|
||||
ViewModel?.RefreshServers();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,5 +173,11 @@ public partial class ProfilesSelectWindow
|
|||
var item = await ViewModel?.GetProfileItem();
|
||||
return item;
|
||||
}
|
||||
|
||||
private void BtnSave_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Trigger selection finalize when Confirm is clicked
|
||||
ViewModel?.SelectFinish();
|
||||
}
|
||||
#endregion Event
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue