mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-02 19:42:08 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var models = new List<ComboItem>();
|
var models = lstModel.Select(it => new ComboItem { ID = it.IndexId, Text = it.GetSummary() }).ToList();
|
||||||
BlServers = true;
|
|
||||||
foreach (var it in lstModel)
|
|
||||||
{
|
|
||||||
var name = it.GetSummary();
|
|
||||||
|
|
||||||
var item = new ComboItem() { ID = it.IndexId, Text = name };
|
BlServers = true;
|
||||||
models.Add(item);
|
|
||||||
if (_config.IndexId == it.IndexId)
|
|
||||||
{
|
|
||||||
SelectedServer = item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Servers.Clear();
|
Servers.Clear();
|
||||||
Servers.AddRange(models);
|
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)
|
private void ServerSelectedChanged(bool c)
|
||||||
|
|||||||
Reference in New Issue
Block a user