diff --git a/ProxySuper.Core/ViewModels/HomeViewModel.cs b/ProxySuper.Core/ViewModels/HomeViewModel.cs index 8b401db..87baad7 100644 --- a/ProxySuper.Core/ViewModels/HomeViewModel.cs +++ b/ProxySuper.Core/ViewModels/HomeViewModel.cs @@ -56,8 +56,42 @@ namespace ProxySuper.Core.ViewModels File.WriteAllText("Data/Record.json", json); } + public void SortDone(string id) + { + var item = Records.Where(x => x.Id == id).FirstOrDefault(); + if (item == null) return; + + var index = Records.IndexOf(item); + if (index >= Records.Count - 1) return; + + Records.Remove(item); + Records.Insert(index + 1, item); + + RaisePropertyChanged("Records"); + SaveToJson(); + } + + public void SortUp(string id) + { + var item = Records.Where(x => x.Id == id).FirstOrDefault(); + if (item == null) return; + + var index = Records.IndexOf(item); + if (index <= 0) return; + + Records.Remove(item); + Records.Insert(index - 1, item); + + RaisePropertyChanged("Records"); + SaveToJson(); + } + public MvxObservableCollection Records { get; set; } + public IMvxCommand SortUpCommand => new MvxCommand(SortUp); + + public IMvxCommand SortDoneCommand => new MvxCommand(SortDone); + public IMvxCommand AddV2rayCommand => new MvxAsyncCommand(AddV2rayRecord); public IMvxCommand AddXrayCommand => new MvxAsyncCommand(AddXrayRecord); diff --git a/ProxySuper.WPF/Resources/Languages/en.xaml b/ProxySuper.WPF/Resources/Languages/en.xaml index 60e0d61..d1a4178 100644 --- a/ProxySuper.WPF/Resources/Languages/en.xaml +++ b/ProxySuper.WPF/Resources/Languages/en.xaml @@ -38,6 +38,8 @@ Edit ViewConfig Delete + Up + Done diff --git a/ProxySuper.WPF/Resources/Languages/tw_cn.xaml b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml index 5e150cf..b95be88 100644 --- a/ProxySuper.WPF/Resources/Languages/tw_cn.xaml +++ b/ProxySuper.WPF/Resources/Languages/tw_cn.xaml @@ -38,6 +38,8 @@ 編輯 查看配置 刪除 + 上移 + 下移 diff --git a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml index 74886e7..a3bf221 100644 --- a/ProxySuper.WPF/Resources/Languages/zh_cn.xaml +++ b/ProxySuper.WPF/Resources/Languages/zh_cn.xaml @@ -38,6 +38,8 @@ 编辑 查看配置 删除 + 上移 + 下移 diff --git a/ProxySuper.WPF/Views/HomeView.xaml b/ProxySuper.WPF/Views/HomeView.xaml index ae38e81..07e0781 100644 --- a/ProxySuper.WPF/Views/HomeView.xaml +++ b/ProxySuper.WPF/Views/HomeView.xaml @@ -91,26 +91,38 @@