diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 6d90981..8091907 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -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"); } } diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index e0acb4f..4563b31 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -5,6 +5,7 @@ enable enable true + true False 3.1.2.0 3.1.2.0 diff --git a/imagecatalog/MainWindow.xaml b/imagecatalog/MainWindow.xaml new file mode 100644 index 0000000..b2bd652 --- /dev/null +++ b/imagecatalog/MainWindow.xaml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +