mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed keyboard change dialog causing crash when show on startup is enabled
This commit is contained in:
parent
6627a48d93
commit
aa7746e70a
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
@ -20,13 +21,14 @@ namespace Artemis.ViewModels
|
|||||||
private bool _enabled;
|
private bool _enabled;
|
||||||
private string _toggleText;
|
private string _toggleText;
|
||||||
|
|
||||||
public SystemTrayViewModel(IWindowManager windowManager, IEventAggregator events, ShellViewModel shellViewModel,
|
public SystemTrayViewModel(IWindowManager windowManager, IEventAggregator events, MetroDialogService dialogService, ShellViewModel shellViewModel,
|
||||||
MainManager mainManager)
|
MainManager mainManager)
|
||||||
{
|
{
|
||||||
_windowManager = windowManager;
|
_windowManager = windowManager;
|
||||||
_shellViewModel = shellViewModel;
|
_shellViewModel = shellViewModel;
|
||||||
_checkedForUpdate = false;
|
_checkedForUpdate = false;
|
||||||
|
|
||||||
|
DialogService = dialogService;
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
|
|
||||||
events.Subscribe(this);
|
events.Subscribe(this);
|
||||||
@ -36,7 +38,6 @@ namespace Artemis.ViewModels
|
|||||||
ShowWindow();
|
ShowWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Inject]
|
|
||||||
public MetroDialogService DialogService { get; set; }
|
public MetroDialogService DialogService { get; set; }
|
||||||
|
|
||||||
public MainManager MainManager { get; set; }
|
public MainManager MainManager { get; set; }
|
||||||
@ -124,16 +125,19 @@ namespace Artemis.ViewModels
|
|||||||
|
|
||||||
private async void ShowKeyboardDialog()
|
private async void ShowKeyboardDialog()
|
||||||
{
|
{
|
||||||
|
while(!_shellViewModel.IsActive)
|
||||||
|
await Task.Delay(200);
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => CanHideWindow);
|
NotifyOfPropertyChange(() => CanHideWindow);
|
||||||
NotifyOfPropertyChange(() => CanToggleEnabled);
|
NotifyOfPropertyChange(() => CanToggleEnabled);
|
||||||
|
|
||||||
var dialog = await DialogService.ShowProgressDialog("Enabling keyboard",
|
var dialog = await DialogService.ShowProgressDialog("Enabling keyboard",
|
||||||
"Artemis is still busy trying to enable your last used keyboard. " +
|
"Artemis is still busy trying to enable your last used keyboard. " +
|
||||||
"Please what while the progress completes");
|
"Please wait while the progress completes");
|
||||||
dialog.SetIndeterminate();
|
dialog.SetIndeterminate();
|
||||||
|
|
||||||
while (MainManager.DeviceManager.ChangingKeyboard)
|
while (MainManager.DeviceManager.ChangingKeyboard)
|
||||||
await Task.Delay(200);
|
await Task.Delay(10);
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => CanHideWindow);
|
NotifyOfPropertyChange(() => CanHideWindow);
|
||||||
NotifyOfPropertyChange(() => CanToggleEnabled);
|
NotifyOfPropertyChange(() => CanToggleEnabled);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user