Add WPF UI alongside WinForms; improve cancellation logic
Introduced MainWindow.xaml and code-behind for a modern WPF interface with tabbed settings. Enabled WPF in project file. Refactored startup to launch WPF or WinForms UI based on availability. Registered WPF MainWindow in DI. Improved DataModel cancellation to be synchronous and log exceptions. Minor logging and comment updates. App now supports both WPF and WinForms frontends.
This commit is contained in:
parent
8872080741
commit
10cc574acb
5 changed files with 484 additions and 10 deletions
|
|
@ -1132,13 +1132,26 @@ namespace ImageCatalog_2
|
|||
{
|
||||
try
|
||||
{
|
||||
await MainToken?.CancelAsync();
|
||||
var tokenSource = MainToken;
|
||||
if (tokenSource is not null)
|
||||
{
|
||||
// Cancel synchronously and return to caller. Some CTSource implementations
|
||||
// may provide async helpers but cancelling is immediate.
|
||||
try
|
||||
{
|
||||
tokenSource.Cancel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Exception while cancelling token");
|
||||
}
|
||||
}
|
||||
|
||||
UiEnabled = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e.Message, "Error canceling the token");
|
||||
_logger.LogError(e, "Error canceling the token");
|
||||
_logger.LogInformation("Ignora questo errore");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue