mirror of https://github.com/2dust/v2rayN
Subscription multi-select delete
parent
790209efbc
commit
12f3400894
|
@ -6,7 +6,6 @@ using ReactiveUI.Fody.Helpers;
|
|||
using Splat;
|
||||
using System.Reactive;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using v2rayN.Base;
|
||||
using v2rayN.Handler;
|
||||
using v2rayN.Mode;
|
||||
|
@ -24,6 +23,7 @@ namespace v2rayN.ViewModels
|
|||
public IObservableCollection<SubItem> SubItems => _subItems;
|
||||
[Reactive]
|
||||
public SubItem SelectedSource { get; set; }
|
||||
public IList<SubItem> SelectedSources { get; set; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SubAddCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> SubDeleteCmd { get; }
|
||||
|
@ -96,12 +96,15 @@ namespace v2rayN.ViewModels
|
|||
|
||||
private void DeleteSub()
|
||||
{
|
||||
if (UI.ShowYesNo(ResUI.RemoveServer) == DialogResult.No)
|
||||
if (UI.ShowYesNo(ResUI.RemoveServer) == MessageBoxResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigHandler.DeleteSubItem(ref _config, SelectedSource?.id);
|
||||
foreach (var it in SelectedSources)
|
||||
{
|
||||
ConfigHandler.DeleteSubItem(ref _config, it?.id);
|
||||
}
|
||||
RefreshSubItems();
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
IsModified = true;
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.ComponentModel;
|
|||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using v2rayN.Mode;
|
||||
using v2rayN.ViewModels;
|
||||
|
||||
namespace v2rayN.Views
|
||||
|
@ -17,6 +18,7 @@ namespace v2rayN.Views
|
|||
ViewModel = new SubSettingViewModel(this);
|
||||
this.Closing += SubSettingWindow_Closing;
|
||||
lstSubscription.MouseDoubleClick += LstSubscription_MouseDoubleClick;
|
||||
lstSubscription.SelectionChanged += LstSubscription_SelectionChanged;
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
|
@ -43,6 +45,10 @@ namespace v2rayN.Views
|
|||
{
|
||||
ViewModel?.EditSub(false);
|
||||
}
|
||||
private void LstSubscription_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast<SubItem>().ToList();
|
||||
}
|
||||
|
||||
private void menuClose_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue