diff --git a/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryPage.xaml.cs b/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryPage.xaml.cs index 11e1324..d08b88e 100644 --- a/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryPage.xaml.cs +++ b/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryPage.xaml.cs @@ -2,6 +2,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Documents; +using System.Windows.Media; using System.Windows.Media.Imaging; using CamBooth.App.Core.AppSettings; @@ -9,6 +10,7 @@ using CamBooth.App.Core.Logging; using Wpf.Ui.Controls; +using Button = Wpf.Ui.Controls.Button; using Image = Wpf.Ui.Controls.Image; using MessageBox = System.Windows.MessageBox; using TextBlock = Wpf.Ui.Controls.TextBlock; @@ -95,11 +97,21 @@ public partial class PictureGalleryPage : Page, IDisposable async () => { var contentDialog = new ContentDialog(RootContentDialogPresenter); - - contentDialog.SetCurrentValue(ContentDialog.TitleProperty, "Hello World"); - contentDialog.SetCurrentValue(ContentControl.ContentProperty, "This is a message"); - contentDialog.SetCurrentValue(ContentDialog.CloseButtonTextProperty, "Close this dialog"); + var imageToShow = new Image + { + VerticalAlignment = VerticalAlignment.Center, + Source = PictureGalleryService.CreateThumbnail(picturePathUri.AbsolutePath, 500, 300) + }; + + contentDialog.DialogWidth = 940; + contentDialog.CloseButtonAppearance = ControlAppearance.Dark; + contentDialog.PrimaryButtonAppearance = ControlAppearance.Light; + //contentDialog.SetCurrentValue(ContentDialog.TitleProperty, "Hello World"); + contentDialog.SetCurrentValue(ContentControl.ContentProperty, imageToShow); + contentDialog.SetCurrentValue(ContentDialog.CloseButtonTextProperty, "Schließen"); contentDialog.SetCurrentValue(ContentDialog.PrimaryButtonTextProperty, "Drucken"); + contentDialog.SetCurrentValue(ContentDialog.PrimaryButtonIconProperty, PictureGalleryService.CreateRegularSymbolIcon(SymbolRegular.Print48, Colors.Tomato)); + contentDialog.Tag = picturePathUri.AbsolutePath; contentDialog.ButtonClicked += ContentDialog_OnButtonClicked; diff --git a/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryService.cs b/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryService.cs index 137ea7f..2bd0a3b 100644 --- a/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryService.cs +++ b/src/CamBooth/CamBooth.App/PictureGallery/PictureGalleryService.cs @@ -1,5 +1,6 @@ using System.IO; using System.Windows; +using System.Windows.Media; using System.Windows.Media.Imaging; using CamBooth.App.Core.AppSettings; @@ -50,7 +51,7 @@ public class PictureGalleryService // add if not exists if (!this.thumbnails.ContainsKey(creationTime)) { - this.thumbnails.Add(creationTime, CreateThumbnail(picturePath, 244, 200)); + this.thumbnails.Add(creationTime, CreateThumbnail(picturePath, 244, 0)); this._logger.Info($"Thumbnail '{picturePath}' successfully created"); } @@ -68,9 +69,22 @@ public class PictureGalleryService bitmap.BeginInit(); bitmap.UriSource = new Uri(filePath); bitmap.DecodePixelWidth = maxWidth; // Größe des ThumbnailsOrderedByNewestDescending direkt beim Dekodieren festlegen + bitmap.DecodePixelHeight = maxHeight; // Größe des ThumbnailsOrderedByNewestDescending direkt beim Dekodieren festlegen bitmap.CacheOption = BitmapCacheOption.OnLoad; bitmap.EndInit(); bitmap.Freeze(); // Threadsicher machen return bitmap; } + + public static SymbolIcon CreateRegularSymbolIcon(SymbolRegular symbolRegular, Color foregroundColor = default) + { + return new SymbolIcon + { + Symbol = symbolRegular, + Foreground = new SolidColorBrush(foregroundColor), + Width = 24, + Height = 24, + FontSize = 24 + }; + } } \ No newline at end of file