This commit is contained in:
Tobias Wohlleben 2025-01-20 17:08:21 +01:00
parent 18371ee6d0
commit 6a1b1a9f9b
5 changed files with 70 additions and 35 deletions

View File

@ -0,0 +1,14 @@
<Window x:Class="CamBooth.App.Core.GenericOverlayWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CamBooth.App.Core"
mc:Ignorable="d"
Title="GenericOverlayWindow" Height="350" Width="600">
<Grid>
<TextBlock Name="TbHeader" FontSize="40" HorizontalAlignment="Center">Hoppla</TextBlock>
<TextBlock Name="TbContent" FontSize="25" HorizontalAlignment="Center" VerticalAlignment="Center">Sorry, da ging was schief!</TextBlock>
<Button Click="ButtonBase_OnClick" Width="300" Height="100" FontSize="25" HorizontalAlignment="Center" VerticalAlignment="Bottom" Content="Schließen"></Button>
</Grid>
</Window>

View File

@ -0,0 +1,17 @@
using System.Windows;
namespace CamBooth.App.Core;
public partial class GenericOverlayWindow : Window
{
public GenericOverlayWindow()
{
InitializeComponent();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
this.Close();
}
}

View File

@ -27,6 +27,7 @@ public partial class LiveViewPage : Page
private ImageBrush bgbrush = new ImageBrush(); private ImageBrush bgbrush = new ImageBrush();
public LiveViewPage(Logger logger, AppSettingsService appSettings, CameraService cameraService) public LiveViewPage(Logger logger, AppSettingsService appSettings, CameraService cameraService)
{ {
this._logger = logger; this._logger = logger;
@ -63,19 +64,6 @@ public partial class LiveViewPage : Page
} }
public void TakePhoto()
{
try
{
this._cameraService.TakePhoto();
}
catch (Exception e)
{
MessageBox.Show("Sorry, das hat leider nicht geklappt!");
}
}
public void Dispose() public void Dispose()
{ {
this._cameraService.Dispose(); this._cameraService.Dispose();

View File

@ -13,10 +13,10 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <!-- Erste Zeile (Auto-Höhe) --> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <!-- Zweite Zeile (flexibler Platz) --> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <!-- Dritte Zeile (flexibler Platz) --> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <!-- Dritte Zeile (Auto-Höhe) --> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Inhalt der ersten Zeile --> <!-- Inhalt der ersten Zeile -->
@ -49,6 +49,11 @@
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Panel.ZIndex="1" /> Panel.ZIndex="1" />
<StackPanel x:Name="GenericPanelCtl"
Panel.ZIndex="10"
Grid.Row="0">
</StackPanel>
<!-- Inhalt der dritten Zeile --> <!-- Inhalt der dritten Zeile -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="0 0 5 5"> Margin="0 0 5 5">

View File

@ -2,6 +2,7 @@
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using CamBooth.App.Core;
using CamBooth.App.Core.AppSettings; using CamBooth.App.Core.AppSettings;
using CamBooth.App.Core.Camera; using CamBooth.App.Core.Camera;
using CamBooth.App.Core.Logging; using CamBooth.App.Core.Logging;
@ -9,6 +10,10 @@ using CamBooth.App.DebugConsole;
using CamBooth.App.LiveView; using CamBooth.App.LiveView;
using CamBooth.App.PictureGallery; using CamBooth.App.PictureGallery;
using Wpf.Ui.Controls;
using MessageBox = Wpf.Ui.Controls.MessageBox;
namespace CamBooth.App; namespace CamBooth.App;
/// <summary> /// <summary>
@ -42,23 +47,13 @@ public partial class MainWindow : Window
this._cameraService = cameraService; this._cameraService = cameraService;
InitializeComponent(); InitializeComponent();
this.SetVisibilityDebugConsole(this._isDebugConsoleVisible); this.SetVisibilityDebugConsole(this._isDebugConsoleVisible);
this.LoadPicturePanelAsync();
this.SetVisibilityPicturePanel(this._isPicturePanelVisible); this.SetVisibilityPicturePanel(this._isPicturePanelVisible);
_ = this._pictureGalleryService.LoadThumbnailsToCache();
CreateMessageBox();
this.Closing += OnClosing; this.Closing += OnClosing;
logger.Info("MainWindow initialized"); logger.Info("MainWindow initialized");
} }
private async void LoadPicturePanelAsync()
{
//this.PictureGalleryPage.Visibility = Visibility.Hidden;
//this.PictureGalleryPage.Navigate(new PictureGalleryPage(this._appSettings, this._logger));
// this._pictureGalleryService.LoadThumbnailsToCache();
await this._pictureGalleryService.LoadThumbnailsToCache();
//this.DebugFrame.Navigate(new DebugConsolePage(this._logger));
}
private void SetVisibilityPicturePanel(bool visibility) private void SetVisibilityPicturePanel(bool visibility)
{ {
if (visibility) if (visibility)
@ -110,7 +105,23 @@ public partial class MainWindow : Window
private void TakePhoto(object sender, RoutedEventArgs e) private void TakePhoto(object sender, RoutedEventArgs e)
{ {
this._liveViewPage?.TakePhoto(); try
{
this._cameraService.TakePhoto();
}
catch (Exception exception)
{
this.CreateMessageBox();
this._logger.Info(exception.Message);
}
}
private void CreateMessageBox()
{
// <ui:MessageBox Title="Hoppla" FontSize="40" Grid.Row="0" Name="MsgBoxCtl">
//
// </ui:MessageBox>
} }