Settings - Update devices each time the tab opens

Readme - Clarified that we're not lazy :p
This commit is contained in:
Robert committed 2021-04-08 20:54:34 +02:00
1 parent 903e434137
commit af496da647
2 files changed
+11 -4

No files matched your search

@@ -24,21 +24,28 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
_settingsVmFactory = settingsVmFactory;
}
protected override void OnInitialActivate()
#region Overrides of AllActive
/// <inheritdoc />
protected override void OnActivate()
{
// Take it off the UI thread to avoid freezing on tab change
Task.Run(async () =>
{
if (Items.Any())
Items.Clear();
await Task.Delay(200);
List<DeviceSettingsViewModel> instances = _rgbService.Devices.Select(d => _settingsVmFactory.CreateDeviceSettingsViewModel(d)).ToList();
foreach (DeviceSettingsViewModel deviceSettingsViewModel in instances)
Items.Add(deviceSettingsViewModel);
});
base.OnInitialActivate();
base.OnActivate();
}
#endregion
public async Task<bool> ShowDeviceDisableDialog()
{
if (_confirmedDisable)