Skip to content

Commit 739bf20

Browse files
committed
Delay Hotkey register & use safe way calling mainwindow animation
1 parent df97be7 commit 739bf20

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
6969
PluginManager.LoadPlugins(_settings.PluginSettings);
7070
_mainVM = new MainViewModel(_settings);
7171

72-
HotKeyMapper.Initialize(_mainVM);
7372

7473
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
7574

@@ -79,6 +78,8 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
7978
await PluginManager.InitializePlugins(API);
8079
var window = new MainWindow(_settings, _mainVM);
8180

81+
HotKeyMapper.Initialize(_mainVM);
82+
8283
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
8384

8485
Current.MainWindow = window;

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ public void Show()
736736
{
737737
if (_settings.UseSound)
738738
{
739-
MediaPlayer media = new MediaPlayer();
739+
var media = new MediaPlayer();
740740
media.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
741741
media.Play();
742742
}
@@ -746,7 +746,7 @@ public void Show()
746746
MainWindowVisibilityStatus = true;
747747

748748
if(_settings.UseAnimation)
749-
((MainWindow)Application.Current.MainWindow).WindowAnimator();
749+
((MainWindow)Application.Current.MainWindow)?.WindowAnimator();
750750

751751
MainWindowOpacity = 1;
752752
}

0 commit comments

Comments
 (0)