mirror of
https://github.com/2dust/v2rayN.git
synced 2026-08-15 19:52:06 +03:00
* Fix tray server selection after refresh (#9927) * Update StatusBarViewModel.cs --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -297,21 +297,14 @@ public partial class StatusBarViewModel : MyReactiveObject
|
||||
return;
|
||||
}
|
||||
|
||||
var models = new List<ComboItem>();
|
||||
BlServers = true;
|
||||
foreach (var it in lstModel)
|
||||
{
|
||||
var name = it.GetSummary();
|
||||
var models = lstModel.Select(it => new ComboItem { ID = it.IndexId, Text = it.GetSummary() }).ToList();
|
||||
|
||||
var item = new ComboItem() { ID = it.IndexId, Text = name };
|
||||
models.Add(item);
|
||||
if (_config.IndexId == it.IndexId)
|
||||
{
|
||||
SelectedServer = item;
|
||||
}
|
||||
}
|
||||
BlServers = true;
|
||||
Servers.Clear();
|
||||
Servers.AddRange(models);
|
||||
|
||||
// Update the ItemsSource before SelectedItem so a collection reset does not clear the tray selection.
|
||||
SelectedServer = models.FirstOrDefault(it => it.ID == _config.IndexId) ?? new();
|
||||
}
|
||||
|
||||
private void ServerSelectedChanged(bool c)
|
||||
|
||||
Reference in New Issue
Block a user