"Refactor UI and logging: Update UI text and wrapping for better readability, switch logging to Debug for consistency, and clean up unused imports and code alignment across multiple services"

This commit is contained in:
iTob 2026-06-30 17:58:52 +02:00
parent d0db293bb8
commit 9ad55bd90a
14 changed files with 229 additions and 261 deletions

View File

@ -1,15 +1,11 @@
using System.Windows;
using CamBooth.App.Core.AppSettings;
using CamBooth.App.Core.Logging;
using CamBooth.App.Features.Camera;
using CamBooth.App.Features.PhotoPrismUpload;
using CamBooth.App.Features.PictureGallery;
using EDSDKLib.API.Base;
using EOSDigital.API;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

View File

@ -71,7 +71,7 @@ public class CameraService : IDisposable
if (attempt < maxRetries - 1)
{
System.Threading.Thread.Sleep(retryDelayMs);
Thread.Sleep(retryDelayMs);
RefreshCameraList();
}
}
@ -143,9 +143,7 @@ public class CameraService : IDisposable
try
{
await Task.Run(() => sdkCamera.SendCommand(CameraCommand.PressShutterButton, (int)ShutterButton.Halfway));
var completed = await Task.WhenAny(focusCompleted.Task, Task.Delay(focusTimeoutMs));
if (completed != focusCompleted.Task)
_logger.Info("Autofocus timeout reached, continuing.");
await Task.WhenAny(focusCompleted.Task, Task.Delay(focusTimeoutMs));
}
catch (Exception ex)
{
@ -286,13 +284,13 @@ public class CameraService : IDisposable
private void MainCamera_DownloadReady(ICamera sender, IDownloadInfo info)
{
_logger.Info("Download ready");
_logger.Debug("Download ready");
try
{
info.FileName = $"img_{Guid.NewGuid()}.jpg";
sender.DownloadFile(info, _appSettings.PictureLocation);
var savedPath = Path.Combine(_appSettings.PictureLocation!, info.FileName);
_logger.Info($"Download complete: {savedPath}");
_logger.Debug($"Download complete: {savedPath}");
Application.Current.Dispatcher.Invoke(() =>
{

View File

@ -1,20 +1,15 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using CamBooth.App.Core.Logging;
using CamBooth.App.Features.Camera;
using EOSDigital.API;
namespace CamBooth.App.Features.LiveView;
public partial class LiveViewPage : Page, IDisposable
public partial class LiveViewPage : IDisposable
{
private readonly CameraService _cameraService;
private readonly Logger _logger;

View File

@ -41,35 +41,4 @@ public partial class ModernTimerControl : UserControl
StatusText.Text = "Zeit abgelaufen!";
}
}
public void StartTimer(int durationInSeconds)
{
_remainingTime = durationInSeconds;
TimerText.Text = TimeSpan.FromSeconds(_remainingTime).ToString(@"mm\:ss");
StatusText.Text = "Timer läuft...";
_timer.Start();
ShowTimer();
}
public void StopTimer()
{
_timer.Stop();
StatusText.Text = "Timer angehalten";
}
public void ShowTimer()
{
var fadeInAnimation = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(300));
TimerContainer.BeginAnimation(OpacityProperty, fadeInAnimation);
}
public void HideTimer()
{
var fadeOutAnimation = new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(300));
TimerContainer.BeginAnimation(OpacityProperty, fadeOutAnimation);
}
}

View File

@ -54,6 +54,11 @@
</Grid>
<!-- Instruction text below the ring -->
<Border Background="#CC101010"
CornerRadius="16"
Padding="28,14"
HorizontalAlignment="Center"
Margin="0,24,0,0">
<TextBlock x:Name="InstructionText"
FontSize="46"
FontWeight="Bold"
@ -62,8 +67,8 @@
TextAlignment="Center"
TextWrapping="Wrap"
MaxWidth="900"
Margin="0,24,0,0"
Text="Lächeln! 😊"/>
</Border>
</StackPanel>
</Border>

View File

@ -37,7 +37,7 @@ public class PhotoPrismAuthService
{
try
{
_logger.Info("Starte PhotoPrism-Authentifizierung...");
_logger.Debug("Starte PhotoPrism-Authentifizierung...");
if (!ValidateConfiguration())
return false;

View File

@ -134,7 +134,7 @@ public class PhotoPrismUploadQueueService : IDisposable
{
if (_uploadQueue.Contains(photoPath)) return;
_uploadQueue.Enqueue(photoPath);
_logger.Info($"Neues Foto in PhotoPrism-Queue: {Path.GetFileName(photoPath)}");
_logger.Debug($"Neues Foto in PhotoPrism-Queue: {Path.GetFileName(photoPath)}");
}
}
@ -151,7 +151,7 @@ public class PhotoPrismUploadQueueService : IDisposable
private async Task ProcessQueueAsync(CancellationToken cancellationToken)
{
_logger.Info("PhotoPrism Upload-Queue-Verarbeitung gestartet");
_logger.Debug("PhotoPrism Upload-Queue-Verarbeitung gestartet");
try
{
@ -203,7 +203,7 @@ public class PhotoPrismUploadQueueService : IDisposable
if (success)
{
_uploadTracker.MarkAsUploaded(filePath);
_logger.Info($"✅ PhotoPrism Upload erfolgreich: {fileName}");
_logger.Debug($"✅ PhotoPrism Upload erfolgreich: {fileName}");
}
else
{

View File

@ -140,7 +140,7 @@ public class PhotoPrismUploadService : IDisposable
return false;
}
_logger.Info($"Starte Upload: {Path.GetFileName(imagePath)}");
_logger.Debug($"Starte Upload: {Path.GetFileName(imagePath)}");
_logger.Debug($" Authentifiziert: {_isAuthenticated}");
_logger.Debug($" Token vorhanden: {!string.IsNullOrEmpty(_authService.AccessToken)}");

View File

@ -53,7 +53,7 @@ public class PhotoPrismUploadTracker
};
SaveToDisk();
_logger.Info($"Bild als hochgeladen markiert: {key}");
_logger.Debug($"Bild als hochgeladen markiert: {key}");
}
/// <summary>

View File

@ -76,12 +76,13 @@ public partial class PictureGalleryPage : Page
var qrSubLabel = new TextBlock
{
Text = "zum Fotoalbum",
Text = "📱 Handy-Kamera draufhalten",
Foreground = new SolidColorBrush(Colors.White),
FontSize = 11,
FontSize = 12,
FontWeight = FontWeights.Bold,
TextAlignment = TextAlignment.Center,
Margin = new Thickness(4, 0, 4, 2)
TextWrapping = TextWrapping.Wrap,
Margin = new Thickness(4, 0, 4, 4)
};
qrContainer.Children.Add(qrSubLabel);

View File

@ -103,7 +103,7 @@ public class PictureGalleryService
try
{
this.thumbnails.Add(creationTime, PictureGalleryService.CreateThumbnail(picturePath, 244, 0));
this._logger.Info($"Thumbnail '{picturePath}' successfully created");
this._logger.Debug($"Thumbnail '{picturePath}' successfully created");
}
catch (Exception e)
{
@ -115,7 +115,7 @@ public class PictureGalleryService
}
while ((loop < cacheSize || cacheSize == 0) && loop < picturePaths.Count);
});
this._logger.Info("Loading thumbnails into cache completed");
this._logger.Debug("Loading thumbnails into cache completed");
}

View File

@ -253,13 +253,13 @@
</Grid>
<!-- Text -->
<TextBlock Text="Herunterladen"
<TextBlock Text="Fotos"
Foreground="White"
FontSize="10"
FontWeight="Bold"
TextAlignment="Center"
Margin="0,0,0,2"/>
<TextBlock Text="Fotos"
<TextBlock Text="aufs Handy"
Foreground="#D4AF37"
FontSize="8"
FontWeight="SemiBold"
@ -525,7 +525,7 @@
<!-- QR-Code Dialog -->
<core:BaseDialogOverlay x:Name="QRCodeOverlay"
DialogTitle="Online-Fotoalbum"
DialogTitle="Alle Fotos aufs Handy"
Grid.RowSpan="2"
Panel.ZIndex="200"/>

View File

@ -233,10 +233,14 @@ public partial class MainWindow : Window
});
content.Children.Add(new System.Windows.Controls.TextBlock
{
Text = "Mit einem QR-Code-Scanner scannen",
Text = "Nimm dein Handy und halte die Kamera auf den Code.\n" +
"Tippe dann auf den Link, der erscheint - schon siehst du alle Fotos.",
Foreground = Brushes.White,
FontSize = 16,
TextAlignment = TextAlignment.Center
FontSize = 18,
LineHeight = 26,
TextAlignment = TextAlignment.Center,
TextWrapping = TextWrapping.Wrap,
MaxWidth = 420
});
QRCodeOverlay.DialogContent = content;