Skip to content

Commit

Permalink
Fix language picking to the new startup procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Oct 10, 2021
1 parent 7860894 commit a664d39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 0 additions & 8 deletions PicView/UILogic/Loading/StartLoading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ internal static class StartLoading
{
internal static async Task LoadedEventsAsync()
{
await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (Action)(() =>
{
// Subscribe to Windows resized event || Need to be exactly on load
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(ConfigureWindows.GetMainWindow).Handle);
source.AddHook(new HwndSourceHook(NativeMethods.WndProc));
}));

#if DEBUG
Trace.Listeners.Add(new TextWriterTraceListener("Debug.log"));
Expand Down Expand Up @@ -59,8 +53,6 @@ await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threa
ConfigureWindows.GetMainWindow.MinHeight *= MonitorInfo.DpiScaling;
}));

LoadLanguage.DetermineLanguage();

if (!Properties.Settings.Default.ShowInterface)
{
await ConfigureWindows.GetMainWindow.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, (Action)(() =>
Expand Down
10 changes: 9 additions & 1 deletion PicView/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ public MainWindow()
}
Topmost = Properties.Settings.Default.TopMost;

Loaded += async (_, _) => await StartLoading.LoadedEventsAsync().ConfigureAwait(false);
Loaded += async (_, _) =>
{
// Subscribe to Windows resized event || Need to be exactly on load
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(ConfigureWindows.GetMainWindow).Handle);
source.AddHook(new HwndSourceHook(NativeMethods.WndProc));
Translations.LoadLanguage.DetermineLanguage();
await StartLoading.LoadedEventsAsync().ConfigureAwait(false);
};
ContentRendered += delegate
{
// keyboard and Mouse_Keys Keys
Expand Down

0 comments on commit a664d39

Please sign in to comment.