mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-19 03:35:02 +03:00
@@ -43,14 +43,14 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||||||
|
|
||||||
private void RefreshCheckUpdateItems()
|
private void RefreshCheckUpdateItems()
|
||||||
{
|
{
|
||||||
|
var models = CoreInfoManager.Instance.GetCheckUpdateCoreTypes()
|
||||||
|
.Select(t => GetCheckUpdateModel(t))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
models.Add(GetGeoFileCheckUpdateModel());
|
||||||
|
|
||||||
CheckUpdateModels.Clear();
|
CheckUpdateModels.Clear();
|
||||||
|
CheckUpdateModels.AddRange(models);
|
||||||
foreach (var type in CoreInfoManager.Instance.GetCheckUpdateCoreTypes())
|
|
||||||
{
|
|
||||||
CheckUpdateModels.Add(GetCheckUpdateModel(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckUpdateModels.Add(GetGeoFileCheckUpdateModel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CheckUpdateModel GetCheckUpdateModel(ECoreType coreType)
|
private CheckUpdateModel GetCheckUpdateModel(ECoreType coreType)
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||||||
var selectedName = SelectedGroup?.Name;
|
var selectedName = SelectedGroup?.Name;
|
||||||
ProxyGroups.Clear();
|
ProxyGroups.Clear();
|
||||||
|
|
||||||
|
var lstProxyGroups = new List<ClashProxyModel>();
|
||||||
var proxyGroups = ClashApiManager.Instance.GetClashProxyGroups();
|
var proxyGroups = ClashApiManager.Instance.GetClashProxyGroups();
|
||||||
if (proxyGroups is { Count: > 0 })
|
if (proxyGroups is { Count: > 0 })
|
||||||
{
|
{
|
||||||
@@ -200,7 +201,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ProxyGroups.Add(new ClashProxyModel()
|
lstProxyGroups.Add(new ClashProxyModel()
|
||||||
{
|
{
|
||||||
Now = item.now,
|
Now = item.now,
|
||||||
Name = item.name,
|
Name = item.name,
|
||||||
@@ -216,12 +217,12 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var item = ProxyGroups.FirstOrDefault(t => t.Name == kv.Key);
|
var item = lstProxyGroups.FirstOrDefault(t => t.Name == kv.Key);
|
||||||
if (item != null && item.Name.IsNotEmpty())
|
if (item != null && item.Name.IsNotEmpty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ProxyGroups.Add(new ClashProxyModel()
|
lstProxyGroups.Add(new ClashProxyModel()
|
||||||
{
|
{
|
||||||
Now = kv.Value.now,
|
Now = kv.Value.now,
|
||||||
Name = kv.Key,
|
Name = kv.Key,
|
||||||
@@ -229,6 +230,8 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProxyGroups.AddRange(lstProxyGroups);
|
||||||
|
|
||||||
if (ProxyGroups is { Count: > 0 })
|
if (ProxyGroups is { Count: > 0 })
|
||||||
{
|
{
|
||||||
if (selectedName != null && ProxyGroups.Any(t => t.Name == selectedName))
|
if (selectedName != null && ProxyGroups.Any(t => t.Name == selectedName))
|
||||||
|
|||||||
@@ -161,19 +161,17 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
|||||||
await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null);
|
await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RefreshSubscriptions()
|
private async Task RefreshSubscriptions()
|
||||||
{
|
{
|
||||||
|
var subItems = await AppManager.Instance.SubItems();
|
||||||
|
subItems.Insert(0, new SubItem { Remarks = ResUI.AllGroupServers });
|
||||||
|
|
||||||
SubItems.Clear();
|
SubItems.Clear();
|
||||||
|
SubItems.AddRange(subItems);
|
||||||
|
|
||||||
SubItems.Add(new SubItem { Remarks = ResUI.AllGroupServers });
|
|
||||||
|
|
||||||
foreach (var item in await AppManager.Instance.SubItems())
|
|
||||||
{
|
|
||||||
SubItems.Add(item);
|
|
||||||
}
|
|
||||||
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
||||||
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
? subItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
||||||
: null) ?? SubItems.FirstOrDefault();
|
: null) ?? subItems.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
||||||
|
|||||||
@@ -397,17 +397,15 @@ public class ProfilesViewModel : MyReactiveObject
|
|||||||
|
|
||||||
private async Task RefreshSubscriptions()
|
private async Task RefreshSubscriptions()
|
||||||
{
|
{
|
||||||
|
var subItems = await AppManager.Instance.SubItems();
|
||||||
|
subItems.Insert(0, new SubItem { Remarks = ResUI.AllGroupServers });
|
||||||
|
|
||||||
SubItems.Clear();
|
SubItems.Clear();
|
||||||
|
SubItems.AddRange(subItems);
|
||||||
|
|
||||||
SubItems.Add(new SubItem { Remarks = ResUI.AllGroupServers });
|
|
||||||
|
|
||||||
foreach (var item in await AppManager.Instance.SubItems())
|
|
||||||
{
|
|
||||||
SubItems.Add(item);
|
|
||||||
}
|
|
||||||
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
||||||
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
? subItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
||||||
: null) ?? SubItems.FirstOrDefault();
|
: null) ?? subItems.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
|
|||||||
{
|
{
|
||||||
RulesItems.Clear();
|
RulesItems.Clear();
|
||||||
|
|
||||||
|
var models = new List<RulesItemModel>();
|
||||||
foreach (var item in _rules)
|
foreach (var item in _rules)
|
||||||
{
|
{
|
||||||
var it = new RulesItemModel()
|
var it = new RulesItemModel()
|
||||||
@@ -110,8 +111,9 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
|
|||||||
Enabled = item.Enabled,
|
Enabled = item.Enabled,
|
||||||
Remarks = item.Remarks,
|
Remarks = item.Remarks,
|
||||||
};
|
};
|
||||||
RulesItems.Add(it);
|
models.Add(it);
|
||||||
}
|
}
|
||||||
|
RulesItems.AddRange(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RuleEditAsync(bool blNew)
|
public async Task RuleEditAsync(bool blNew)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class RoutingSettingViewModel : MyReactiveObject
|
|||||||
public async Task RefreshRoutingItems()
|
public async Task RefreshRoutingItems()
|
||||||
{
|
{
|
||||||
RoutingItems.Clear();
|
RoutingItems.Clear();
|
||||||
|
var models = new List<RoutingItemModel>();
|
||||||
|
|
||||||
var routings = await AppManager.Instance.RoutingItems();
|
var routings = await AppManager.Instance.RoutingItems();
|
||||||
foreach (var item in routings)
|
foreach (var item in routings)
|
||||||
@@ -98,8 +99,9 @@ public class RoutingSettingViewModel : MyReactiveObject
|
|||||||
CustomRulesetPath4Singbox = item.CustomRulesetPath4Singbox,
|
CustomRulesetPath4Singbox = item.CustomRulesetPath4Singbox,
|
||||||
Sort = item.Sort,
|
Sort = item.Sort,
|
||||||
};
|
};
|
||||||
RoutingItems.Add(it);
|
models.Add(it);
|
||||||
}
|
}
|
||||||
|
RoutingItems.AddRange(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -234,6 +234,8 @@ public class StatusBarViewModel : MyReactiveObject
|
|||||||
await RefreshRoutingsMenu();
|
await RefreshRoutingsMenu();
|
||||||
await InboundDisplayStatus();
|
await InboundDisplayStatus();
|
||||||
await ChangeSystemProxyAsync(_config.SystemProxyItem.SysProxyType, true);
|
await ChangeSystemProxyAsync(_config.SystemProxyItem.SysProxyType, true);
|
||||||
|
|
||||||
|
BlRouting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitUpdateView(Func<EViewAction, object?, Task<bool>>? updateView)
|
public void InitUpdateView(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||||
@@ -312,18 +314,20 @@ public class StatusBarViewModel : MyReactiveObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var models = new List<ComboItem>();
|
||||||
BlServers = true;
|
BlServers = true;
|
||||||
foreach (var it in lstModel)
|
foreach (var it in lstModel)
|
||||||
{
|
{
|
||||||
var name = it.GetSummary();
|
var name = it.GetSummary();
|
||||||
|
|
||||||
var item = new ComboItem() { ID = it.IndexId, Text = name };
|
var item = new ComboItem() { ID = it.IndexId, Text = name };
|
||||||
Servers.Add(item);
|
models.Add(item);
|
||||||
if (_config.IndexId == it.IndexId)
|
if (_config.IndexId == it.IndexId)
|
||||||
{
|
{
|
||||||
SelectedServer = item;
|
SelectedServer = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Servers.AddRange(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ServerSelectedChanged(bool c)
|
private void ServerSelectedChanged(bool c)
|
||||||
@@ -408,18 +412,12 @@ public class StatusBarViewModel : MyReactiveObject
|
|||||||
|
|
||||||
private async Task RefreshRoutingsMenu()
|
private async Task RefreshRoutingsMenu()
|
||||||
{
|
{
|
||||||
RoutingItems.Clear();
|
|
||||||
|
|
||||||
BlRouting = true;
|
|
||||||
var routings = await AppManager.Instance.RoutingItems();
|
var routings = await AppManager.Instance.RoutingItems();
|
||||||
foreach (var item in routings)
|
|
||||||
{
|
RoutingItems.Clear();
|
||||||
RoutingItems.Add(item);
|
RoutingItems.AddRange(routings);
|
||||||
if (item.IsActive)
|
|
||||||
{
|
SelectedRouting = routings.FirstOrDefault(t => t.IsActive == true);
|
||||||
SelectedRouting = item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RoutingSelectedChangedAsync(bool c)
|
private async Task RoutingSelectedChangedAsync(bool c)
|
||||||
|
|||||||
Reference in New Issue
Block a user