-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up OnFrameworkInitializationCompleted, remove some async void u…
…sage (#763) * Run debug info logging and startup update check in separate threads * Convert CheckForUpdates from async void to async Task
- Loading branch information
1 parent
dcd0095
commit 5edf620
Showing
4 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,7 +184,7 @@ private void CopyToTargetGameModDirectory() { | |
}); | ||
copyThread.Start(); | ||
} | ||
public void LaunchConverter() { | ||
public async Task LaunchConverter() { | ||
Check warning on line 187 in Fronter.NET/ViewModels/MainWindowViewModel.cs GitHub Actions / test_and_check_coverage
Check warning on line 187 in Fronter.NET/ViewModels/MainWindowViewModel.cs GitHub Actions / test (macos-15)
|
||
ConvertButtonEnabled = false; | ||
ClearLogGrid(); | ||
|
||
|
@@ -201,7 +201,7 @@ public void LaunchConverter() { | |
|
||
var converterLauncher = new ConverterLauncher(Config); | ||
bool success; | ||
var converterThread = new Thread(() => { | ||
await Task.Run(async () => { | ||
ConvertStatus = "CONVERTSTATUSIN"; | ||
|
||
try { | ||
|
@@ -245,14 +245,13 @@ public void LaunchConverter() { | |
} | ||
} else { | ||
ConvertStatus = "CONVERTSTATUSPOSTFAIL"; | ||
Dispatcher.UIThread.Post(ShowErrorMessageBox); | ||
await Dispatcher.UIThread.InvokeAsync(ShowErrorMessageBox); | ||
ConvertButtonEnabled = true; | ||
} | ||
}); | ||
converterThread.Start(); | ||
} | ||
|
||
private async void ShowErrorMessageBox() { | ||
private async Task ShowErrorMessageBox() { | ||
var messageBoxWindow = MessageBoxManager | ||
.GetMessageBoxStandard(new MessageBoxStandardParams { | ||
Icon = Icon.Error, | ||
|
@@ -267,7 +266,7 @@ private async void ShowErrorMessageBox() { | |
} | ||
} | ||
|
||
public async void CheckForUpdates() { | ||
public async Task CheckForUpdates() { | ||
if (!Config.UpdateCheckerEnabled) { | ||
return; | ||
} | ||
|
@@ -319,11 +318,11 @@ await Dispatcher.UIThread.InvokeAsync(async () => { | |
} | ||
} | ||
|
||
public void CheckForUpdatesOnStartup() { | ||
public async Task CheckForUpdatesOnStartup() { | ||
if (!Config.CheckForUpdatesOnStartup) { | ||
return; | ||
} | ||
CheckForUpdates(); | ||
await CheckForUpdates(); | ||
} | ||
|
||
#pragma warning disable CA1822 | ||
|
@@ -335,7 +334,7 @@ public void Exit() { | |
} | ||
|
||
#pragma warning disable CA1822 | ||
public async void OpenAboutDialog() { | ||
public async Task OpenAboutDialog() { | ||
#pragma warning restore CA1822 | ||
var messageBoxWindow = MessageBoxManager | ||
.GetMessageBoxStandard(new MessageBoxStandardParams { | ||
|
@@ -365,7 +364,7 @@ public void SetLanguage(string languageKey) { | |
#pragma warning disable CA1822 | ||
public void SetTheme(string themeName) { | ||
#pragma warning restore CA1822 | ||
App.SaveTheme(themeName); | ||
_ = App.SaveTheme(themeName); | ||
} | ||
|
||
public string WindowTitle { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters