wip
This commit is contained in:
parent
97083feb7c
commit
bbf81a46ab
@ -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);
|
||||
var imageToShow = new Image
|
||||
{
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Source = PictureGalleryService.CreateThumbnail(picturePathUri.AbsolutePath, 500, 300)
|
||||
};
|
||||
|
||||
contentDialog.SetCurrentValue(ContentDialog.TitleProperty, "Hello World");
|
||||
contentDialog.SetCurrentValue(ContentControl.ContentProperty, "This is a message");
|
||||
contentDialog.SetCurrentValue(ContentDialog.CloseButtonTextProperty, "Close this dialog");
|
||||
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;
|
||||
|
||||
|
||||
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user