Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Jan 3, 2023
1 parent 0f099a1 commit 781fab5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public partial class RoutingSettingWindow
public RoutingSettingWindow()
{
InitializeComponent();
this.Closing += RoutingSettingWindow_Closing;
this.PreviewKeyDown += RoutingSettingWindow_PreviewKeyDown;
lstRoutings.SelectionChanged += lstRoutings_SelectionChanged;
lstRoutings.MouseDoubleClick += LstRoutings_MouseDoubleClick;
Expand Down Expand Up @@ -61,6 +62,14 @@ public RoutingSettingWindow()
});
}

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))
Expand Down
12 changes: 11 additions & 1 deletion v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ReactiveUI;
using System.ComponentModel;
using System.Reactive.Disposables;
using System.Windows.Input;
using v2rayN.ViewModels;
Expand All @@ -12,6 +13,7 @@ public SubSettingWindow()
InitializeComponent();

ViewModel = new SubSettingViewModel(this);
this.Closing += SubSettingWindow_Closing;
lstSubscription.MouseDoubleClick += LstSubscription_MouseDoubleClick;

this.WhenActivated(disposables =>
Expand All @@ -27,10 +29,18 @@ public SubSettingWindow()
});
}

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)
{
Expand Down

0 comments on commit 781fab5

Please sign in to comment.