pull/2962/head
2dust 2023-01-03 15:43:57 +08:00
parent 0f099a19cd
commit 781fab5aab
2 changed files with 20 additions and 1 deletions

View File

@ -11,6 +11,7 @@ namespace v2rayN.Views
public RoutingSettingWindow()
{
InitializeComponent();
this.Closing += RoutingSettingWindow_Closing;
this.PreviewKeyDown += RoutingSettingWindow_PreviewKeyDown;
lstRoutings.SelectionChanged += lstRoutings_SelectionChanged;
lstRoutings.MouseDoubleClick += LstRoutings_MouseDoubleClick;
@ -61,6 +62,14 @@ namespace v2rayN.Views
});
}
private void RoutingSettingWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
{
if (ViewModel?.IsModified == true)
{
this.DialogResult = true;
}
}
private void RoutingSettingWindow_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))

View File

@ -1,4 +1,5 @@
using ReactiveUI;
using System.ComponentModel;
using System.Reactive.Disposables;
using System.Windows.Input;
using v2rayN.ViewModels;
@ -12,6 +13,7 @@ namespace v2rayN.Views
InitializeComponent();
ViewModel = new SubSettingViewModel(this);
this.Closing += SubSettingWindow_Closing;
lstSubscription.MouseDoubleClick += LstSubscription_MouseDoubleClick;
this.WhenActivated(disposables =>
@ -27,10 +29,18 @@ namespace v2rayN.Views
});
}
private void SubSettingWindow_Closing(object? sender, CancelEventArgs e)
{
if (ViewModel?.IsModified == true)
{
this.DialogResult = true;
}
}
private void LstSubscription_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
ViewModel?.EditSub(false);
}
}
private void menuClose_Click(object sender, System.Windows.RoutedEventArgs e)
{