Add photobooth folder presets
This commit is contained in:
@@ -49,6 +49,10 @@
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="Upload-Ordner" FontWeight="SemiBold" />
|
||||
<TextBlock x:Name="FolderText" Text="Noch nicht ausgewählt." TextWrapping="Wrap" Classes="subtitle" />
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Button x:Name="DslrBoothPresetButton" Content="DSLrBooth" Click="DslrBoothPresetButton_Click" Classes="secondary" IsVisible="False" />
|
||||
<Button x:Name="SparkboothPresetButton" Content="Sparkbooth" Click="SparkboothPresetButton_Click" Classes="secondary" IsVisible="False" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Button x:Name="PickFolderButton" Content="Ordner auswählen" Click="PickFolderButton_Click" IsEnabled="False" Classes="primary" />
|
||||
<Button x:Name="TestUploadButton" Content="Test-Upload senden" Click="TestUploadButton_Click" IsEnabled="False" Classes="secondary" />
|
||||
|
||||
@@ -169,6 +169,16 @@ public partial class MainWindow : Window
|
||||
StartUploadPipelineIfReady();
|
||||
}
|
||||
|
||||
private void DslrBoothPresetButton_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ApplyPresetFolder(GetDslrBoothFolder());
|
||||
}
|
||||
|
||||
private void SparkboothPresetButton_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ApplyPresetFolder(GetSparkboothFolder());
|
||||
}
|
||||
|
||||
private void ApplySettings()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_settings.WatchFolder))
|
||||
@@ -202,6 +212,7 @@ public partial class MainWindow : Window
|
||||
UpdateSteps();
|
||||
RefreshProfiles();
|
||||
UpdateAdvancedLockState();
|
||||
UpdatePresetButtons();
|
||||
}
|
||||
|
||||
private void OnWindowOpened(object? sender, EventArgs e)
|
||||
@@ -1289,4 +1300,51 @@ public partial class MainWindow : Window
|
||||
|
||||
return _logBuffer.Count > 0 ? string.Join(Environment.NewLine, _logBuffer) : string.Empty;
|
||||
}
|
||||
|
||||
private void UpdatePresetButtons()
|
||||
{
|
||||
DslrBoothPresetButton.IsVisible = OperatingSystem.IsWindows();
|
||||
SparkboothPresetButton.IsVisible = OperatingSystem.IsWindows() || OperatingSystem.IsMacOS();
|
||||
}
|
||||
|
||||
private void ApplyPresetFolder(string? folder)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(folder))
|
||||
{
|
||||
UpdateStatus("Preset-Ordner nicht verfügbar.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
}
|
||||
catch
|
||||
{
|
||||
UpdateStatus("Preset-Ordner konnte nicht erstellt werden.");
|
||||
return;
|
||||
}
|
||||
|
||||
_settings.WatchFolder = folder;
|
||||
_settingsStore.Save(_settings);
|
||||
FolderText.Text = folder;
|
||||
UpdateFolderHealth();
|
||||
StartUploadPipelineIfReady();
|
||||
}
|
||||
|
||||
private static string? GetDslrBoothFolder()
|
||||
{
|
||||
return OperatingSystem.IsWindows() ? @"C:\dslrBooth" : null;
|
||||
}
|
||||
|
||||
private static string? GetSparkboothFolder()
|
||||
{
|
||||
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
if (string.IsNullOrWhiteSpace(documents))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Path.Combine(documents, "sparkbooth");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user