wip
This commit is contained in:
parent
8659a27d01
commit
97083feb7c
@ -9,8 +9,7 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Background="Magenta">
|
||||
<Grid>
|
||||
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto">
|
||||
<WrapPanel VerticalAlignment="Stretch" x:Name="PicturesPanel" Orientation="Horizontal" />
|
||||
</ScrollViewer>
|
||||
<WrapPanel VerticalAlignment="Stretch" x:Name="PicturesPanel" Orientation="Horizontal" />
|
||||
<ContentPresenter x:Name="RootContentDialogPresenter" Grid.Row="0" />
|
||||
</Grid>
|
||||
</Page>
|
||||
@ -1,12 +1,17 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
using CamBooth.App.Core.AppSettings;
|
||||
using CamBooth.App.Core.Logging;
|
||||
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
using Image = Wpf.Ui.Controls.Image;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using TextBlock = Wpf.Ui.Controls.TextBlock;
|
||||
|
||||
namespace CamBooth.App.PictureGallery;
|
||||
|
||||
@ -29,7 +34,7 @@ public partial class PictureGalleryPage : Page, IDisposable
|
||||
}
|
||||
|
||||
|
||||
private void Initialize()
|
||||
private async void Initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -42,6 +47,15 @@ public partial class PictureGalleryPage : Page, IDisposable
|
||||
}
|
||||
|
||||
|
||||
private void ContentDialog_OnButtonClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
if (args.Button == ContentDialogButton.Primary)
|
||||
{
|
||||
MessageBox.Show($"Print the shit baby {sender.Tag}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void LoadPictures(int howManyPictures = 0)
|
||||
{
|
||||
int loop = 0;
|
||||
@ -53,14 +67,20 @@ public partial class PictureGalleryPage : Page, IDisposable
|
||||
{
|
||||
BitmapImage thumbnail = this._pictureGalleryService.ThumbnailsOrderedByNewestDescending[loop];
|
||||
|
||||
var imageControl = new Wpf.Ui.Controls.Image()
|
||||
var textBlock = new TextBlock();
|
||||
var hyperlink = new Hyperlink();
|
||||
hyperlink.Click += Hyperlink_OnClick;
|
||||
hyperlink.Tag = thumbnail.UriSource;
|
||||
var imageControl = new Wpf.Ui.Controls.Image
|
||||
{
|
||||
Source = thumbnail,
|
||||
Width = 388,
|
||||
Margin = new Thickness(3)
|
||||
};
|
||||
hyperlink.Inlines.Add(new InlineUIContainer(imageControl));
|
||||
|
||||
this.PicturesPanel.Children.Add(imageControl);
|
||||
textBlock.Inlines.Add(hyperlink);
|
||||
this.PicturesPanel.Children.Add(textBlock);
|
||||
loop++;
|
||||
}
|
||||
while ((loop < howManyPictures || howManyPictures == 0) && loop < this._pictureGalleryService.ThumbnailsOrderedByNewestDescending.Count);
|
||||
@ -68,6 +88,26 @@ public partial class PictureGalleryPage : Page, IDisposable
|
||||
}
|
||||
|
||||
|
||||
private void Hyperlink_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Uri? picturePathUri = ((Hyperlink)sender).Tag as Uri;
|
||||
Application.Current.Dispatcher.BeginInvoke(
|
||||
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");
|
||||
contentDialog.SetCurrentValue(ContentDialog.PrimaryButtonTextProperty, "Drucken");
|
||||
contentDialog.Tag = picturePathUri.AbsolutePath;
|
||||
contentDialog.ButtonClicked += ContentDialog_OnButtonClicked;
|
||||
|
||||
await contentDialog.ShowAsync();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user