Remember uploader window size
This commit is contained in:
@@ -4,9 +4,10 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="520" d:DesignHeight="360"
|
mc:Ignorable="d" d:DesignWidth="520" d:DesignHeight="360"
|
||||||
x:Class="PhotoboothUploader.MainWindow"
|
x:Class="PhotoboothUploader.MainWindow"
|
||||||
Width="520" Height="360"
|
Width="560" Height="420"
|
||||||
|
MinWidth="520" MinHeight="400"
|
||||||
Title="Die Fotospiel.App - Photobooth Uploader">
|
Title="Die Fotospiel.App - Photobooth Uploader">
|
||||||
<Grid Margin="24" ColumnDefinitions="*,8,*">
|
<Grid Margin="24,32,24,24" ColumnDefinitions="*,8,*">
|
||||||
<StackPanel Grid.Column="0" Spacing="12" MaxWidth="420">
|
<StackPanel Grid.Column="0" Spacing="12" MaxWidth="420">
|
||||||
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
|
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
|
||||||
<Image Source="avares://PhotoboothUploader/Assets/logo.png" Width="32" Height="32" />
|
<Image Source="avares://PhotoboothUploader/Assets/logo.png" Width="32" Height="32" />
|
||||||
@@ -54,7 +55,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="2" Spacing="12" MaxWidth="380">
|
<StackPanel Grid.Column="2" Spacing="12" MaxWidth="380" Margin="0,6,0,0">
|
||||||
<Border Background="#1F000000" Padding="12" CornerRadius="8">
|
<Border Background="#1F000000" Padding="12" CornerRadius="8">
|
||||||
<StackPanel Spacing="6">
|
<StackPanel Spacing="6">
|
||||||
<TextBlock Text="Status" FontWeight="SemiBold" />
|
<TextBlock Text="Status" FontWeight="SemiBold" />
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ public partial class MainWindow : Window
|
|||||||
_liveTimer.Interval = TimeSpan.FromSeconds(30);
|
_liveTimer.Interval = TimeSpan.FromSeconds(30);
|
||||||
_liveTimer.Tick += (_, _) => UpdateLiveStatus();
|
_liveTimer.Tick += (_, _) => UpdateLiveStatus();
|
||||||
_liveTimer.Start();
|
_liveTimer.Start();
|
||||||
|
Opened += OnWindowOpened;
|
||||||
|
Closing += OnWindowClosing;
|
||||||
ApplySettings();
|
ApplySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,6 +187,31 @@ public partial class MainWindow : Window
|
|||||||
UpdateSteps();
|
UpdateSteps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnWindowOpened(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ApplyWindowSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWindowClosing(object? sender, WindowClosingEventArgs e)
|
||||||
|
{
|
||||||
|
_settings.WindowWidth = Width;
|
||||||
|
_settings.WindowHeight = Height;
|
||||||
|
_settingsStore.Save(_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyWindowSize()
|
||||||
|
{
|
||||||
|
if (_settings.WindowWidth > 0)
|
||||||
|
{
|
||||||
|
Width = Math.Max(MinWidth, _settings.WindowWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_settings.WindowHeight > 0)
|
||||||
|
{
|
||||||
|
Height = Math.Max(MinHeight, _settings.WindowHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void StartUploadPipelineIfReady()
|
private void StartUploadPipelineIfReady()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(_settings.UploadUrl) || string.IsNullOrWhiteSpace(_settings.WatchFolder))
|
if (string.IsNullOrWhiteSpace(_settings.UploadUrl) || string.IsNullOrWhiteSpace(_settings.WatchFolder))
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ public sealed class PhotoboothSettings
|
|||||||
public string? LastError { get; set; }
|
public string? LastError { get; set; }
|
||||||
public string? LastErrorAt { get; set; }
|
public string? LastErrorAt { get; set; }
|
||||||
public int MaxConcurrentUploads { get; set; } = 2;
|
public int MaxConcurrentUploads { get; set; } = 2;
|
||||||
|
public double WindowWidth { get; set; }
|
||||||
|
public double WindowHeight { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user