wip
This commit is contained in:
parent
8659a27d01
commit
97083feb7c
@ -9,8 +9,7 @@
|
|||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
Background="Magenta">
|
Background="Magenta">
|
||||||
<Grid>
|
<Grid>
|
||||||
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto">
|
<WrapPanel VerticalAlignment="Stretch" x:Name="PicturesPanel" Orientation="Horizontal" />
|
||||||
<WrapPanel VerticalAlignment="Stretch" x:Name="PicturesPanel" Orientation="Horizontal" />
|
<ContentPresenter x:Name="RootContentDialogPresenter" Grid.Row="0" />
|
||||||
</ScrollViewer>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
@ -1,12 +1,17 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Documents;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
using CamBooth.App.Core.AppSettings;
|
using CamBooth.App.Core.AppSettings;
|
||||||
using CamBooth.App.Core.Logging;
|
using CamBooth.App.Core.Logging;
|
||||||
|
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
using Image = Wpf.Ui.Controls.Image;
|
using Image = Wpf.Ui.Controls.Image;
|
||||||
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
using TextBlock = Wpf.Ui.Controls.TextBlock;
|
||||||
|
|
||||||
namespace CamBooth.App.PictureGallery;
|
namespace CamBooth.App.PictureGallery;
|
||||||
|
|
||||||
@ -29,7 +34,7 @@ public partial class PictureGalleryPage : Page, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Initialize()
|
private async void Initialize()
|
||||||
{
|
{
|
||||||
try
|
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)
|
private void LoadPictures(int howManyPictures = 0)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
@ -53,14 +67,20 @@ public partial class PictureGalleryPage : Page, IDisposable
|
|||||||
{
|
{
|
||||||
BitmapImage thumbnail = this._pictureGalleryService.ThumbnailsOrderedByNewestDescending[loop];
|
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,
|
Source = thumbnail,
|
||||||
Width = 388,
|
Width = 388,
|
||||||
Margin = new Thickness(3)
|
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++;
|
loop++;
|
||||||
}
|
}
|
||||||
while ((loop < howManyPictures || howManyPictures == 0) && loop < this._pictureGalleryService.ThumbnailsOrderedByNewestDescending.Count);
|
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>
|
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user