herunterfahren button links unten
This commit is contained in:
parent
074f3ccb7f
commit
3a3c780c07
@ -32,6 +32,13 @@
|
|||||||
<Folder Include="Features\" />
|
<Folder Include="Features\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="artifacts\**\*.cs" />
|
||||||
|
<EmbeddedResource Remove="artifacts\**\*" />
|
||||||
|
<None Remove="artifacts\**\*" />
|
||||||
|
<Page Remove="artifacts\**\*.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Core\AppSettings\app.settings.json">
|
<None Update="Core\AppSettings\app.settings.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
x:Name="MainFrame"
|
x:Name="MainFrame"
|
||||||
NavigationUIVisibility="Hidden"
|
NavigationUIVisibility="Hidden"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Background="LightBlue"
|
Background="Black"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Panel.ZIndex="0" />
|
Panel.ZIndex="0" />
|
||||||
|
|
||||||
@ -54,9 +54,8 @@
|
|||||||
<liveView:TimerControlRectangleAnimation x:Name="TimerControlRectangleAnimation" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<liveView:TimerControlRectangleAnimation x:Name="TimerControlRectangleAnimation" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Name="ButtonPanel" Background="Transparent" Panel.ZIndex="2"
|
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Name="ButtonPanel" Background="Transparent" Panel.ZIndex="2"
|
||||||
|
Visibility="Hidden"
|
||||||
Margin="0 0 0 0">
|
Margin="0 0 0 0">
|
||||||
<ui:Button Content="Start" Click="NavToLiveView" Width="200" Height="75" VerticalAlignment="Bottom"
|
|
||||||
Margin="0 0 5 0" />
|
|
||||||
<ui:Button Content="Hide Debug" Click="SetVisibilityDebugConsole" Width="200" Height="75"
|
<ui:Button Content="Hide Debug" Click="SetVisibilityDebugConsole" Width="200" Height="75"
|
||||||
VerticalAlignment="Bottom" Margin="0 0 5 0" />
|
VerticalAlignment="Bottom" Margin="0 0 5 0" />
|
||||||
<!-- <ui:Button Content="Take Photo" Click="StartTakePhotoProcess" Width="200" Height="75" VerticalAlignment="Bottom" -->
|
<!-- <ui:Button Content="Take Photo" Click="StartTakePhotoProcess" Width="200" Height="75" VerticalAlignment="Bottom" -->
|
||||||
@ -75,9 +74,96 @@
|
|||||||
|
|
||||||
<ui:Button Content="Pictures" Click="SetVisibilityPicturePanel" Width="200" Height="75"
|
<ui:Button Content="Pictures" Click="SetVisibilityPicturePanel" Width="200" Height="75"
|
||||||
VerticalAlignment="Bottom" Margin="0 0 5 0" />
|
VerticalAlignment="Bottom" Margin="0 0 5 0" />
|
||||||
<ui:Button Content="Close" Appearance="Danger" Click="CloseApp" Width="200" Height="75" VerticalAlignment="Bottom" Margin="0 0 5 0" />
|
<ui:Button x:Name="DebugCloseButton" Content="Close" Appearance="Danger" Click="CloseApp" Width="200" Height="75" VerticalAlignment="Bottom" Margin="0 0 5 0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Shutdown Slider (bottom-left) -->
|
||||||
|
<Grid Grid.Row="0"
|
||||||
|
x:Name="ShutdownDock"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Margin="20"
|
||||||
|
Panel.ZIndex="3"
|
||||||
|
Visibility="Hidden">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<ui:Button Grid.Column="0"
|
||||||
|
x:Name="ShutdownToggleButton"
|
||||||
|
Content=""
|
||||||
|
FontFamily="Segoe MDL2 Assets"
|
||||||
|
FontSize="28"
|
||||||
|
Width="64"
|
||||||
|
Height="64"
|
||||||
|
Appearance="Danger"
|
||||||
|
Click="ToggleShutdownSlider" />
|
||||||
|
|
||||||
|
<Border Grid.Column="1"
|
||||||
|
Width="160"
|
||||||
|
Height="64"
|
||||||
|
Margin="8 0 0 0"
|
||||||
|
CornerRadius="10"
|
||||||
|
Background="#44202020"
|
||||||
|
ClipToBounds="True">
|
||||||
|
<Grid RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Grid.RenderTransform>
|
||||||
|
<TranslateTransform x:Name="ShutdownSliderTransform" X="160" />
|
||||||
|
</Grid.RenderTransform>
|
||||||
|
<ui:Button x:Name="ShutdownConfirmButton"
|
||||||
|
Content=""
|
||||||
|
FontFamily="Segoe MDL2 Assets"
|
||||||
|
FontSize="24"
|
||||||
|
Appearance="Danger"
|
||||||
|
Width="160"
|
||||||
|
Height="64"
|
||||||
|
Click="ShutdownWindows" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Welcome Overlay -->
|
||||||
|
<Grid Grid.RowSpan="2"
|
||||||
|
x:Name="WelcomeOverlay"
|
||||||
|
Background="#CC000000"
|
||||||
|
Panel.ZIndex="10">
|
||||||
|
<Border Background="#E61A1A1A"
|
||||||
|
BorderBrush="#66FFFFFF"
|
||||||
|
BorderThickness="1"
|
||||||
|
CornerRadius="20"
|
||||||
|
Padding="48"
|
||||||
|
MaxWidth="900"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<StackPanel HorizontalAlignment="Center">
|
||||||
|
<TextBlock Text="Willkommen bei CamBooth!"
|
||||||
|
Foreground="White"
|
||||||
|
FontSize="56"
|
||||||
|
FontWeight="Bold"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Margin="0 0 0 20"/>
|
||||||
|
<TextBlock Text="In wenigen Sekunden bist du bereit: Mit Start aktivierst du die Kamera und kannst direkt loslegen."
|
||||||
|
Foreground="#FFE8E8E8"
|
||||||
|
FontSize="28"
|
||||||
|
TextAlignment="Center"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Margin="0 0 0 16"/>
|
||||||
|
<TextBlock Text="Viel Spaß mit der CamBooth!"
|
||||||
|
Foreground="#FFFFD280"
|
||||||
|
FontSize="34"
|
||||||
|
FontWeight="SemiBold"
|
||||||
|
TextAlignment="Center"
|
||||||
|
Margin="0 0 0 36"/>
|
||||||
|
<ui:Button Content="Start"
|
||||||
|
Click="StartExperience"
|
||||||
|
Width="240"
|
||||||
|
Height="80"
|
||||||
|
HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!-- DebugFrame -->
|
<!-- DebugFrame -->
|
||||||
<Frame Grid.Row="1"
|
<Frame Grid.Row="1"
|
||||||
x:Name="DebugFrame"
|
x:Name="DebugFrame"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
using CamBooth.App.Core.AppSettings;
|
using CamBooth.App.Core.AppSettings;
|
||||||
@ -32,6 +34,16 @@ public partial class MainWindow : Window
|
|||||||
private LiveViewPage? _liveViewPage;
|
private LiveViewPage? _liveViewPage;
|
||||||
|
|
||||||
private bool _isPhotoProcessRunning;
|
private bool _isPhotoProcessRunning;
|
||||||
|
|
||||||
|
private bool _isCameraStarted;
|
||||||
|
|
||||||
|
private bool _isShutdownSliderOpen;
|
||||||
|
|
||||||
|
private const string ShutdownGlyphClosed = "\uE7E8";
|
||||||
|
|
||||||
|
private const string ShutdownGlyphOpen = "\uE711";
|
||||||
|
|
||||||
|
private const double ShutdownSliderOffset = 160;
|
||||||
|
|
||||||
private readonly DispatcherTimer _focusStatusAnimationTimer = new() { Interval = TimeSpan.FromMilliseconds(250) };
|
private readonly DispatcherTimer _focusStatusAnimationTimer = new() { Interval = TimeSpan.FromMilliseconds(250) };
|
||||||
|
|
||||||
@ -59,6 +71,11 @@ public partial class MainWindow : Window
|
|||||||
this._focusStatusDots = (this._focusStatusDots + 1) % 4;
|
this._focusStatusDots = (this._focusStatusDots + 1) % 4;
|
||||||
this.CaptureStatusText.Text = $"Scharfstellen{new string('.', this._focusStatusDots)}";
|
this.CaptureStatusText.Text = $"Scharfstellen{new string('.', this._focusStatusDots)}";
|
||||||
};
|
};
|
||||||
|
#if DEBUG
|
||||||
|
this.DebugCloseButton.Visibility = Visibility.Visible;
|
||||||
|
#else
|
||||||
|
this.DebugCloseButton.Visibility = Visibility.Collapsed;
|
||||||
|
#endif
|
||||||
logger.Info($"config file loaded: '{appSettings.ConfigFileName}'");
|
logger.Info($"config file loaded: '{appSettings.ConfigFileName}'");
|
||||||
logger.Info("MainWindow initialized");
|
logger.Info("MainWindow initialized");
|
||||||
}
|
}
|
||||||
@ -107,10 +124,24 @@ public partial class MainWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void NavToLiveView(object sender, RoutedEventArgs e)
|
private void StartExperience(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_liveViewPage = new LiveViewPage(this._logger, this._appSettings, this._cameraService);
|
this.StartLiveViewIfNeeded();
|
||||||
MainFrame.Navigate(this._liveViewPage);
|
this.WelcomeOverlay.Visibility = Visibility.Collapsed;
|
||||||
|
this.ButtonPanel.Visibility = Visibility.Visible;
|
||||||
|
this.ShutdownDock.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartLiveViewIfNeeded()
|
||||||
|
{
|
||||||
|
if (this._isCameraStarted)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._liveViewPage = new LiveViewPage(this._logger, this._appSettings, this._cameraService);
|
||||||
|
this.MainFrame.Navigate(this._liveViewPage);
|
||||||
|
this._isCameraStarted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -211,6 +242,44 @@ public partial class MainWindow : Window
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShutdownWindows(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "shutdown",
|
||||||
|
Arguments = "/s /t 0",
|
||||||
|
CreateNoWindow = true,
|
||||||
|
UseShellExecute = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
this._logger.Error(exception.Message);
|
||||||
|
System.Windows.MessageBox.Show("Windows konnte nicht heruntergefahren werden. Bitte erneut versuchen.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleShutdownSlider(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this._isShutdownSliderOpen = !this._isShutdownSliderOpen;
|
||||||
|
this.ShutdownToggleButton.Content = this._isShutdownSliderOpen ? ShutdownGlyphOpen : ShutdownGlyphClosed;
|
||||||
|
this.AnimateShutdownSlider(this._isShutdownSliderOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AnimateShutdownSlider(bool open)
|
||||||
|
{
|
||||||
|
var animation = new DoubleAnimation
|
||||||
|
{
|
||||||
|
To = open ? 0 : ShutdownSliderOffset,
|
||||||
|
Duration = TimeSpan.FromMilliseconds(250),
|
||||||
|
EasingFunction = new QuadraticEase()
|
||||||
|
};
|
||||||
|
|
||||||
|
this.ShutdownSliderTransform.BeginAnimation(System.Windows.Media.TranslateTransform.XProperty, animation);
|
||||||
|
}
|
||||||
|
|
||||||
private void StartFocusStatusAnimation()
|
private void StartFocusStatusAnimation()
|
||||||
{
|
{
|
||||||
this._focusStatusDots = 0;
|
this._focusStatusDots = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user