Skip to content

Commit

Permalink
Refactor new StatusBarViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Oct 12, 2024
1 parent d7bde77 commit 7618f9f
Show file tree
Hide file tree
Showing 14 changed files with 1,095 additions and 869 deletions.
476 changes: 36 additions & 440 deletions v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions v2rayN/ServiceLib/ViewModels/ProfilesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class ProfilesViewModel : MyReactiveObject

private List<ProfileItem> _lstProfile;
private string _serverFilter = string.Empty;

private Dictionary<string, bool> _dicHeaderSort = new();
private SpeedtestService? _speedtestHandler;

Expand Down Expand Up @@ -57,7 +56,6 @@ public class ProfilesViewModel : MyReactiveObject

//servers delete
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }

public ReactiveCommand<Unit, Unit> RemoveServerCmd { get; }
public ReactiveCommand<Unit, Unit> RemoveDuplicateServerCmd { get; }
public ReactiveCommand<Unit, Unit> CopyServerCmd { get; }
Expand All @@ -68,22 +66,19 @@ public class ProfilesViewModel : MyReactiveObject

//servers move
public ReactiveCommand<Unit, Unit> MoveTopCmd { get; }

public ReactiveCommand<Unit, Unit> MoveUpCmd { get; }
public ReactiveCommand<Unit, Unit> MoveDownCmd { get; }
public ReactiveCommand<Unit, Unit> MoveBottomCmd { get; }

//servers ping
public ReactiveCommand<Unit, Unit> MixedTestServerCmd { get; }

public ReactiveCommand<Unit, Unit> TcpingServerCmd { get; }
public ReactiveCommand<Unit, Unit> RealPingServerCmd { get; }
public ReactiveCommand<Unit, Unit> SpeedServerCmd { get; }
public ReactiveCommand<Unit, Unit> SortServerResultCmd { get; }

//servers export
public ReactiveCommand<Unit, Unit> Export2ClientConfigCmd { get; }

public ReactiveCommand<Unit, Unit> Export2ClientConfigClipboardCmd { get; }
public ReactiveCommand<Unit, Unit> Export2ShareUrlCmd { get; }
public ReactiveCommand<Unit, Unit> Export2ShareUrlBase64Cmd { get; }
Expand All @@ -98,7 +93,6 @@ public class ProfilesViewModel : MyReactiveObject
public ProfilesViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
{
_config = AppHandler.Instance.Config;

_updateView = updateView;

MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString()).Subscribe(async x => await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null));
Expand Down Expand Up @@ -505,7 +499,7 @@ public async Task SetDefaultServer()
SetDefaultServer(SelectedProfile.indexId);
}

private async Task SetDefaultServer(string indexId)
public async Task SetDefaultServer(string indexId)
{
if (Utils.IsNullOrEmpty(indexId))
{
Expand Down
Loading

0 comments on commit 7618f9f

Please sign in to comment.