mirror of https://github.com/2dust/v2rayN
Optimization and Improvement.
parent
1d69916410
commit
b8eb7e7b29
|
@ -13,11 +13,11 @@ namespace ServiceLib.ViewModels;
|
|||
public class CheckUpdateViewModel : MyReactiveObject
|
||||
{
|
||||
private const string _geo = "GeoFiles";
|
||||
private string _v2rayN = ECoreType.v2rayN.ToString();
|
||||
private readonly string _v2rayN = ECoreType.v2rayN.ToString();
|
||||
private List<CheckUpdateModel> _lstUpdated = [];
|
||||
private static readonly string _tag = "CheckUpdateViewModel";
|
||||
|
||||
private IObservableCollection<CheckUpdateModel> _checkUpdateModel = new ObservableCollectionExtended<CheckUpdateModel>();
|
||||
public IObservableCollection<CheckUpdateModel> CheckUpdateModels => _checkUpdateModel;
|
||||
public IObservableCollection<CheckUpdateModel> CheckUpdateModels { get; } = new ObservableCollectionExtended<CheckUpdateModel>();
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateCmd { get; }
|
||||
[Reactive] public bool EnableCheckPreReleaseUpdate { get; set; }
|
||||
|
||||
|
@ -26,9 +26,11 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
_config = AppManager.Instance.Config;
|
||||
_updateView = updateView;
|
||||
|
||||
CheckUpdateCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
CheckUpdateCmd = ReactiveCommand.CreateFromTask(CheckUpdate);
|
||||
CheckUpdateCmd.ThrownExceptions.Subscribe(ex =>
|
||||
{
|
||||
await CheckUpdate();
|
||||
Logging.SaveLog(_tag, ex);
|
||||
_ = UpdateView(_v2rayN, ex.Message);
|
||||
});
|
||||
|
||||
EnableCheckPreReleaseUpdate = _config.CheckUpdateItem.CheckPreReleaseUpdate;
|
||||
|
@ -43,20 +45,20 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
|
||||
private void RefreshCheckUpdateItems()
|
||||
{
|
||||
_checkUpdateModel.Clear();
|
||||
CheckUpdateModels.Clear();
|
||||
|
||||
if (RuntimeInformation.ProcessArchitecture != Architecture.X86)
|
||||
{
|
||||
_checkUpdateModel.Add(GetCheckUpdateModel(_v2rayN));
|
||||
CheckUpdateModels.Add(GetCheckUpdateModel(_v2rayN));
|
||||
//Not Windows and under Win10
|
||||
if (!(Utils.IsWindows() && Environment.OSVersion.Version.Major < 10))
|
||||
{
|
||||
_checkUpdateModel.Add(GetCheckUpdateModel(ECoreType.Xray.ToString()));
|
||||
_checkUpdateModel.Add(GetCheckUpdateModel(ECoreType.mihomo.ToString()));
|
||||
_checkUpdateModel.Add(GetCheckUpdateModel(ECoreType.sing_box.ToString()));
|
||||
CheckUpdateModels.Add(GetCheckUpdateModel(ECoreType.Xray.ToString()));
|
||||
CheckUpdateModels.Add(GetCheckUpdateModel(ECoreType.mihomo.ToString()));
|
||||
CheckUpdateModels.Add(GetCheckUpdateModel(ECoreType.sing_box.ToString()));
|
||||
}
|
||||
}
|
||||
_checkUpdateModel.Add(GetCheckUpdateModel(_geo));
|
||||
CheckUpdateModels.Add(GetCheckUpdateModel(_geo));
|
||||
}
|
||||
|
||||
private CheckUpdateModel GetCheckUpdateModel(string coreType)
|
||||
|
@ -71,7 +73,7 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
|
||||
private async Task SaveSelectedCoreTypes()
|
||||
{
|
||||
_config.CheckUpdateItem.SelectedCoreTypes = _checkUpdateModel.Where(t => t.IsSelected == true).Select(t => t.CoreType ?? "").ToList();
|
||||
_config.CheckUpdateItem.SelectedCoreTypes = CheckUpdateModels.Where(t => t.IsSelected == true).Select(t => t.CoreType ?? "").ToList();
|
||||
await ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
|
||||
|
@ -83,13 +85,13 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
private async Task CheckUpdateTask()
|
||||
{
|
||||
_lstUpdated.Clear();
|
||||
_lstUpdated = _checkUpdateModel.Where(x => x.IsSelected == true)
|
||||
_lstUpdated = CheckUpdateModels.Where(x => x.IsSelected == true)
|
||||
.Select(x => new CheckUpdateModel() { CoreType = x.CoreType }).ToList();
|
||||
await SaveSelectedCoreTypes();
|
||||
|
||||
for (var k = _checkUpdateModel.Count - 1; k >= 0; k--)
|
||||
for (var k = CheckUpdateModels.Count - 1; k >= 0; k--)
|
||||
{
|
||||
var item = _checkUpdateModel[k];
|
||||
var item = CheckUpdateModels[k];
|
||||
if (item.IsSelected != true)
|
||||
{
|
||||
continue;
|
||||
|
@ -320,7 +322,7 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
|
||||
public async Task UpdateViewResult(CheckUpdateModel model)
|
||||
{
|
||||
var found = _checkUpdateModel.FirstOrDefault(t => t.CoreType == model.CoreType);
|
||||
var found = CheckUpdateModels.FirstOrDefault(t => t.CoreType == model.CoreType);
|
||||
if (found == null)
|
||||
{
|
||||
return;
|
||||
|
@ -328,6 +330,6 @@ public class CheckUpdateViewModel : MyReactiveObject
|
|||
|
||||
var itemCopy = JsonUtils.DeepCopy(found);
|
||||
itemCopy.Remarks = model.Remarks;
|
||||
_checkUpdateModel.Replace(found, itemCopy);
|
||||
CheckUpdateModels.Replace(found, itemCopy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ namespace ServiceLib.ViewModels;
|
|||
|
||||
public class ClashConnectionsViewModel : MyReactiveObject
|
||||
{
|
||||
private IObservableCollection<ClashConnectionModel> _connectionItems = new ObservableCollectionExtended<ClashConnectionModel>();
|
||||
public IObservableCollection<ClashConnectionModel> ConnectionItems => _connectionItems;
|
||||
public IObservableCollection<ClashConnectionModel> ConnectionItems { get; } = new ObservableCollectionExtended<ClashConnectionModel>();
|
||||
|
||||
[Reactive]
|
||||
public ClashConnectionModel SelectedSource { get; set; }
|
||||
|
@ -74,7 +73,7 @@ public class ClashConnectionsViewModel : MyReactiveObject
|
|||
|
||||
public async Task RefreshConnections(List<ConnectionItem>? connections)
|
||||
{
|
||||
_connectionItems.Clear();
|
||||
ConnectionItems.Clear();
|
||||
|
||||
var dtNow = DateTime.Now;
|
||||
var lstModel = new List<ClashConnectionModel>();
|
||||
|
@ -104,7 +103,7 @@ public class ClashConnectionsViewModel : MyReactiveObject
|
|||
return;
|
||||
}
|
||||
|
||||
_connectionItems.AddRange(lstModel);
|
||||
ConnectionItems.AddRange(lstModel);
|
||||
}
|
||||
|
||||
public async Task ClashConnectionClose(bool all)
|
||||
|
@ -121,7 +120,7 @@ public class ClashConnectionsViewModel : MyReactiveObject
|
|||
}
|
||||
else
|
||||
{
|
||||
_connectionItems.Clear();
|
||||
ConnectionItems.Clear();
|
||||
}
|
||||
await ClashApiManager.Instance.ClashConnectionClose(id);
|
||||
await GetClashConnections();
|
||||
|
|
|
@ -17,11 +17,8 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
private Dictionary<string, ProvidersItem>? _providers;
|
||||
private readonly int _delayTimeout = 99999999;
|
||||
|
||||
private IObservableCollection<ClashProxyModel> _proxyGroups = new ObservableCollectionExtended<ClashProxyModel>();
|
||||
private IObservableCollection<ClashProxyModel> _proxyDetails = new ObservableCollectionExtended<ClashProxyModel>();
|
||||
|
||||
public IObservableCollection<ClashProxyModel> ProxyGroups => _proxyGroups;
|
||||
public IObservableCollection<ClashProxyModel> ProxyDetails => _proxyDetails;
|
||||
public IObservableCollection<ClashProxyModel> ProxyGroups { get; } = new ObservableCollectionExtended<ClashProxyModel>();
|
||||
public IObservableCollection<ClashProxyModel> ProxyDetails { get; } = new ObservableCollectionExtended<ClashProxyModel>();
|
||||
|
||||
[Reactive]
|
||||
public ClashProxyModel SelectedGroup { get; set; }
|
||||
|
@ -182,7 +179,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
}
|
||||
|
||||
var selectedName = SelectedGroup?.Name;
|
||||
_proxyGroups.Clear();
|
||||
ProxyGroups.Clear();
|
||||
|
||||
var proxyGroups = ClashApiManager.Instance.GetClashProxyGroups();
|
||||
if (proxyGroups != null && proxyGroups.Count > 0)
|
||||
|
@ -198,7 +195,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
{
|
||||
continue;
|
||||
}
|
||||
_proxyGroups.Add(new ClashProxyModel()
|
||||
ProxyGroups.Add(new ClashProxyModel()
|
||||
{
|
||||
Now = item.now,
|
||||
Name = item.name,
|
||||
|
@ -214,12 +211,12 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
{
|
||||
continue;
|
||||
}
|
||||
var item = _proxyGroups.FirstOrDefault(t => t.Name == kv.Key);
|
||||
var item = ProxyGroups.FirstOrDefault(t => t.Name == kv.Key);
|
||||
if (item != null && item.Name.IsNotEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
_proxyGroups.Add(new ClashProxyModel()
|
||||
ProxyGroups.Add(new ClashProxyModel()
|
||||
{
|
||||
Now = kv.Value.now,
|
||||
Name = kv.Key,
|
||||
|
@ -227,15 +224,15 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
});
|
||||
}
|
||||
|
||||
if (_proxyGroups != null && _proxyGroups.Count > 0)
|
||||
if (ProxyGroups != null && ProxyGroups.Count > 0)
|
||||
{
|
||||
if (selectedName != null && _proxyGroups.Any(t => t.Name == selectedName))
|
||||
if (selectedName != null && ProxyGroups.Any(t => t.Name == selectedName))
|
||||
{
|
||||
SelectedGroup = _proxyGroups.FirstOrDefault(t => t.Name == selectedName);
|
||||
SelectedGroup = ProxyGroups.FirstOrDefault(t => t.Name == selectedName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedGroup = _proxyGroups.First();
|
||||
SelectedGroup = ProxyGroups.First();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -246,7 +243,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
|
||||
private void RefreshProxyDetails(bool c)
|
||||
{
|
||||
_proxyDetails.Clear();
|
||||
ProxyDetails.Clear();
|
||||
if (!c)
|
||||
{
|
||||
return;
|
||||
|
@ -299,7 +296,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
default:
|
||||
break;
|
||||
}
|
||||
_proxyDetails.AddRange(lstDetails);
|
||||
ProxyDetails.AddRange(lstDetails);
|
||||
}
|
||||
|
||||
private ProxiesItem? TryGetProxy(string name)
|
||||
|
@ -361,12 +358,12 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
await ClashApiManager.Instance.ClashSetActiveProxy(name, nameNode);
|
||||
|
||||
selectedProxy.now = nameNode;
|
||||
var group = _proxyGroups.FirstOrDefault(it => it.Name == SelectedGroup.Name);
|
||||
var group = ProxyGroups.FirstOrDefault(it => it.Name == SelectedGroup.Name);
|
||||
if (group != null)
|
||||
{
|
||||
group.Now = nameNode;
|
||||
var group2 = JsonUtils.DeepCopy(group);
|
||||
_proxyGroups.Replace(group, group2);
|
||||
ProxyGroups.Replace(group, group2);
|
||||
|
||||
SelectedGroup = group2;
|
||||
}
|
||||
|
@ -375,7 +372,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
|
||||
private async Task ProxiesDelayTest(bool blAll = true)
|
||||
{
|
||||
ClashApiManager.Instance.ClashProxiesDelayTest(blAll, _proxyDetails.ToList(), async (item, result) =>
|
||||
ClashApiManager.Instance.ClashProxiesDelayTest(blAll, ProxyDetails.ToList(), async (item, result) =>
|
||||
{
|
||||
if (item == null || result.IsNullOrEmpty())
|
||||
{
|
||||
|
@ -395,7 +392,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
public async Task ProxiesDelayTestResult(SpeedTestResult result)
|
||||
{
|
||||
//UpdateHandler(false, $"{item.name}={result}");
|
||||
var detail = _proxyDetails.FirstOrDefault(it => it.Name == result.IndexId);
|
||||
var detail = ProxyDetails.FirstOrDefault(it => it.Name == result.IndexId);
|
||||
if (detail == null)
|
||||
{
|
||||
return;
|
||||
|
@ -417,7 +414,7 @@ public class ClashProxiesViewModel : MyReactiveObject
|
|||
detail.Delay = _delayTimeout;
|
||||
detail.DelayName = string.Empty;
|
||||
}
|
||||
_proxyDetails.Replace(detail, JsonUtils.DeepCopy(detail));
|
||||
ProxyDetails.Replace(detail, JsonUtils.DeepCopy(detail));
|
||||
}
|
||||
|
||||
#endregion proxy function
|
||||
|
|
|
@ -8,8 +8,8 @@ namespace ServiceLib.ViewModels;
|
|||
|
||||
public class MsgViewModel : MyReactiveObject
|
||||
{
|
||||
private ConcurrentQueue<string> _queueMsg = new();
|
||||
private int _numMaxMsg = 500;
|
||||
private readonly ConcurrentQueue<string> _queueMsg = new();
|
||||
private readonly int _numMaxMsg = 500;
|
||||
private bool _lastMsgFilterNotAvailable;
|
||||
private bool _blLockShow = false;
|
||||
|
||||
|
|
|
@ -23,13 +23,9 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
|
||||
#region ObservableCollection
|
||||
|
||||
private IObservableCollection<ProfileItemModel> _profileItems = new ObservableCollectionExtended<ProfileItemModel>();
|
||||
public IObservableCollection<ProfileItemModel> ProfileItems => _profileItems;
|
||||
public IObservableCollection<ProfileItemModel> ProfileItems { get; } = new ObservableCollectionExtended<ProfileItemModel>();
|
||||
|
||||
private IObservableCollection<SubItem> _subItems = new ObservableCollectionExtended<SubItem>();
|
||||
public IObservableCollection<SubItem> SubItems => _subItems;
|
||||
|
||||
private IObservableCollection<ComboItem> _servers = new ObservableCollectionExtended<ComboItem>();
|
||||
public IObservableCollection<SubItem> SubItems { get; } = new ObservableCollectionExtended<SubItem>();
|
||||
|
||||
[Reactive]
|
||||
public ProfileItemModel SelectedProfile { get; set; }
|
||||
|
@ -293,7 +289,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
NoticeManager.Instance.Enqueue(result.Delay);
|
||||
return;
|
||||
}
|
||||
var item = _profileItems.FirstOrDefault(it => it.IndexId == result.IndexId);
|
||||
var item = ProfileItems.FirstOrDefault(it => it.IndexId == result.IndexId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
|
@ -323,7 +319,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
|
||||
try
|
||||
{
|
||||
var item = _profileItems.FirstOrDefault(it => it.IndexId == update.IndexId);
|
||||
var item = ProfileItems.FirstOrDefault(it => it.IndexId == update.IndexId);
|
||||
if (item != null)
|
||||
{
|
||||
item.TodayDown = Utils.HumanFy(update.TodayDown);
|
||||
|
@ -390,8 +386,8 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
var lstModel = await GetProfileItemsEx(_config.SubIndexId, _serverFilter);
|
||||
_lstProfile = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(lstModel)) ?? [];
|
||||
|
||||
_profileItems.Clear();
|
||||
_profileItems.AddRange(lstModel);
|
||||
ProfileItems.Clear();
|
||||
ProfileItems.AddRange(lstModel);
|
||||
if (lstModel.Count > 0)
|
||||
{
|
||||
var selected = lstModel.FirstOrDefault(t => t.IndexId == _config.IndexId);
|
||||
|
@ -410,21 +406,21 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
|
||||
public async Task RefreshSubscriptions()
|
||||
{
|
||||
_subItems.Clear();
|
||||
SubItems.Clear();
|
||||
|
||||
_subItems.Add(new SubItem { Remarks = ResUI.AllGroupServers });
|
||||
SubItems.Add(new SubItem { Remarks = ResUI.AllGroupServers });
|
||||
|
||||
foreach (var item in await AppManager.Instance.SubItems())
|
||||
{
|
||||
_subItems.Add(item);
|
||||
SubItems.Add(item);
|
||||
}
|
||||
if (_config.SubIndexId != null && _subItems.FirstOrDefault(t => t.Id == _config.SubIndexId) != null)
|
||||
if (_config.SubIndexId != null && SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId) != null)
|
||||
{
|
||||
SelectedSub = _subItems.FirstOrDefault(t => t.Id == _config.SubIndexId);
|
||||
SelectedSub = SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedSub = _subItems.First();
|
||||
SelectedSub = SubItems.First();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,9 +544,9 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
|
||||
await ConfigHandler.RemoveServers(_config, lstSelected);
|
||||
NoticeManager.Instance.Enqueue(ResUI.OperationSuccess);
|
||||
if (lstSelected.Count == _profileItems.Count)
|
||||
if (lstSelected.Count == ProfileItems.Count)
|
||||
{
|
||||
_profileItems.Clear();
|
||||
ProfileItems.Clear();
|
||||
}
|
||||
await RefreshServers();
|
||||
if (exists)
|
||||
|
@ -740,7 +736,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
|
||||
public async Task MoveServerTo(int startIndex, ProfileItemModel targetItem)
|
||||
{
|
||||
var targetIndex = _profileItems.IndexOf(targetItem);
|
||||
var targetIndex = ProfileItems.IndexOf(targetItem);
|
||||
if (startIndex >= 0 && targetIndex >= 0 && startIndex != targetIndex)
|
||||
{
|
||||
if (await ConfigHandler.MoveServer(_config, _lstProfile, startIndex, EMove.Position, targetIndex) == 0)
|
||||
|
@ -754,7 +750,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
{
|
||||
if (actionType == ESpeedActionType.Mixedtest)
|
||||
{
|
||||
SelectedProfiles = _profileItems;
|
||||
SelectedProfiles = ProfileItems;
|
||||
}
|
||||
var lstSelected = await GetProfileItems(false);
|
||||
if (lstSelected == null)
|
||||
|
|
|
@ -13,9 +13,7 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
|
|||
|
||||
[Reactive]
|
||||
public RoutingItem SelectedRouting { get; set; }
|
||||
|
||||
private IObservableCollection<RulesItemModel> _rulesItems = new ObservableCollectionExtended<RulesItemModel>();
|
||||
public IObservableCollection<RulesItemModel> RulesItems => _rulesItems;
|
||||
public IObservableCollection<RulesItemModel> RulesItems { get; } = new ObservableCollectionExtended<RulesItemModel>();
|
||||
|
||||
[Reactive]
|
||||
public RulesItemModel SelectedSource { get; set; }
|
||||
|
@ -101,7 +99,7 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
|
|||
|
||||
public void RefreshRulesItems()
|
||||
{
|
||||
_rulesItems.Clear();
|
||||
RulesItems.Clear();
|
||||
|
||||
foreach (var item in _rules)
|
||||
{
|
||||
|
@ -118,7 +116,7 @@ public class RoutingRuleSettingViewModel : MyReactiveObject
|
|||
Enabled = item.Enabled,
|
||||
Remarks = item.Remarks,
|
||||
};
|
||||
_rulesItems.Add(it);
|
||||
RulesItems.Add(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ public class RoutingSettingViewModel : MyReactiveObject
|
|||
{
|
||||
#region Reactive
|
||||
|
||||
private IObservableCollection<RoutingItemModel> _routingItems = new ObservableCollectionExtended<RoutingItemModel>();
|
||||
public IObservableCollection<RoutingItemModel> RoutingItems => _routingItems;
|
||||
public IObservableCollection<RoutingItemModel> RoutingItems { get; } = new ObservableCollectionExtended<RoutingItemModel>();
|
||||
|
||||
[Reactive]
|
||||
public RoutingItemModel SelectedSource { get; set; }
|
||||
|
@ -82,7 +81,7 @@ public class RoutingSettingViewModel : MyReactiveObject
|
|||
|
||||
public async Task RefreshRoutingItems()
|
||||
{
|
||||
_routingItems.Clear();
|
||||
RoutingItems.Clear();
|
||||
|
||||
var routings = await AppManager.Instance.RoutingItems();
|
||||
foreach (var item in routings)
|
||||
|
@ -98,7 +97,7 @@ public class RoutingSettingViewModel : MyReactiveObject
|
|||
CustomRulesetPath4Singbox = item.CustomRulesetPath4Singbox,
|
||||
Sort = item.Sort,
|
||||
};
|
||||
_routingItems.Add(it);
|
||||
RoutingItems.Add(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,9 @@ public class StatusBarViewModel : MyReactiveObject
|
|||
{
|
||||
#region ObservableCollection
|
||||
|
||||
private IObservableCollection<RoutingItem> _routingItems = new ObservableCollectionExtended<RoutingItem>();
|
||||
public IObservableCollection<RoutingItem> RoutingItems => _routingItems;
|
||||
public IObservableCollection<RoutingItem> RoutingItems { get; } = new ObservableCollectionExtended<RoutingItem>();
|
||||
|
||||
private IObservableCollection<ComboItem> _servers = new ObservableCollectionExtended<ComboItem>();
|
||||
public IObservableCollection<ComboItem> Servers => _servers;
|
||||
public IObservableCollection<ComboItem> Servers { get; } = new ObservableCollectionExtended<ComboItem>();
|
||||
|
||||
[Reactive]
|
||||
public RoutingItem SelectedRouting { get; set; }
|
||||
|
@ -295,7 +293,7 @@ public class StatusBarViewModel : MyReactiveObject
|
|||
{
|
||||
var lstModel = await AppManager.Instance.ProfileItems(_config.SubIndexId, "");
|
||||
|
||||
_servers.Clear();
|
||||
Servers.Clear();
|
||||
if (lstModel.Count > _config.GuiItem.TrayMenuServersLimit)
|
||||
{
|
||||
BlServers = false;
|
||||
|
@ -309,7 +307,7 @@ public class StatusBarViewModel : MyReactiveObject
|
|||
string name = it.GetSummary();
|
||||
|
||||
var item = new ComboItem() { ID = it.IndexId, Text = name };
|
||||
_servers.Add(item);
|
||||
Servers.Add(item);
|
||||
if (_config.IndexId == it.IndexId)
|
||||
{
|
||||
SelectedServer = item;
|
||||
|
@ -397,13 +395,13 @@ public class StatusBarViewModel : MyReactiveObject
|
|||
|
||||
public async Task RefreshRoutingsMenu()
|
||||
{
|
||||
_routingItems.Clear();
|
||||
RoutingItems.Clear();
|
||||
|
||||
BlRouting = true;
|
||||
var routings = await AppManager.Instance.RoutingItems();
|
||||
foreach (var item in routings)
|
||||
{
|
||||
_routingItems.Add(item);
|
||||
RoutingItems.Add(item);
|
||||
if (item.IsActive)
|
||||
{
|
||||
SelectedRouting = item;
|
||||
|
|
|
@ -8,8 +8,7 @@ namespace ServiceLib.ViewModels;
|
|||
|
||||
public class SubSettingViewModel : MyReactiveObject
|
||||
{
|
||||
private IObservableCollection<SubItem> _subItems = new ObservableCollectionExtended<SubItem>();
|
||||
public IObservableCollection<SubItem> SubItems => _subItems;
|
||||
public IObservableCollection<SubItem> SubItems { get; } = new ObservableCollectionExtended<SubItem>();
|
||||
|
||||
[Reactive]
|
||||
public SubItem SelectedSource { get; set; }
|
||||
|
@ -60,8 +59,8 @@ public class SubSettingViewModel : MyReactiveObject
|
|||
|
||||
public async Task RefreshSubItems()
|
||||
{
|
||||
_subItems.Clear();
|
||||
_subItems.AddRange(await AppManager.Instance.SubItems());
|
||||
SubItems.Clear();
|
||||
SubItems.AddRange(await AppManager.Instance.SubItems());
|
||||
}
|
||||
|
||||
public async Task EditSubAsync(bool blNew)
|
||||
|
|
Loading…
Reference in New Issue