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

@ -22,11 +22,12 @@ public partial class LiveViewPage : Page
private readonly AppSettingsService _appSettings;
private readonly CameraService _cameraService;
Action<BitmapImage> SetImageAction;
private ImageBrush bgbrush = new ImageBrush();
public LiveViewPage(Logger logger, AppSettingsService appSettings, CameraService cameraService)
{
this._logger = logger;
@ -61,20 +62,7 @@ public partial class LiveViewPage : Page
_logger.Error(ex.Message);
}
}
public void TakePhoto()
{
try
{
this._cameraService.TakePhoto();
}
catch (Exception e)
{
MessageBox.Show("Sorry, das hat leider nicht geklappt!");
}
}
public void Dispose()
{

View File

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

View File

@ -2,6 +2,7 @@
using System.Windows;
using System.Windows.Controls;
using CamBooth.App.Core;
using CamBooth.App.Core.AppSettings;
using CamBooth.App.Core.Camera;
using CamBooth.App.Core.Logging;
@ -9,6 +10,10 @@ using CamBooth.App.DebugConsole;
using CamBooth.App.LiveView;
using CamBooth.App.PictureGallery;
using Wpf.Ui.Controls;
using MessageBox = Wpf.Ui.Controls.MessageBox;
namespace CamBooth.App;
/// <summary>
@ -42,23 +47,13 @@ public partial class MainWindow : Window
this._cameraService = cameraService;
InitializeComponent();
this.SetVisibilityDebugConsole(this._isDebugConsoleVisible);
this.LoadPicturePanelAsync();
this.SetVisibilityPicturePanel(this._isPicturePanelVisible);
_ = this._pictureGalleryService.LoadThumbnailsToCache();
CreateMessageBox();
this.Closing += OnClosing;
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)
{
if (visibility)
@ -110,7 +105,23 @@ public partial class MainWindow : Window
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>
}