"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:
parent
d0db293bb8
commit
9ad55bd90a
@ -1,15 +1,11 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
using CamBooth.App.Core.AppSettings;
|
using CamBooth.App.Core.AppSettings;
|
||||||
using CamBooth.App.Core.Logging;
|
using CamBooth.App.Core.Logging;
|
||||||
using CamBooth.App.Features.Camera;
|
using CamBooth.App.Features.Camera;
|
||||||
using CamBooth.App.Features.PhotoPrismUpload;
|
using CamBooth.App.Features.PhotoPrismUpload;
|
||||||
using CamBooth.App.Features.PictureGallery;
|
using CamBooth.App.Features.PictureGallery;
|
||||||
|
|
||||||
using EDSDKLib.API.Base;
|
using EDSDKLib.API.Base;
|
||||||
|
|
||||||
using EOSDigital.API;
|
using EOSDigital.API;
|
||||||
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class CameraService : IDisposable
|
|||||||
|
|
||||||
if (attempt < maxRetries - 1)
|
if (attempt < maxRetries - 1)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(retryDelayMs);
|
Thread.Sleep(retryDelayMs);
|
||||||
RefreshCameraList();
|
RefreshCameraList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,9 +143,7 @@ public class CameraService : IDisposable
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Task.Run(() => sdkCamera.SendCommand(CameraCommand.PressShutterButton, (int)ShutterButton.Halfway));
|
await Task.Run(() => sdkCamera.SendCommand(CameraCommand.PressShutterButton, (int)ShutterButton.Halfway));
|
||||||
var completed = await Task.WhenAny(focusCompleted.Task, Task.Delay(focusTimeoutMs));
|
await Task.WhenAny(focusCompleted.Task, Task.Delay(focusTimeoutMs));
|
||||||
if (completed != focusCompleted.Task)
|
|
||||||
_logger.Info("Autofocus timeout reached, continuing.");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -286,13 +284,13 @@ public class CameraService : IDisposable
|
|||||||
|
|
||||||
private void MainCamera_DownloadReady(ICamera sender, IDownloadInfo info)
|
private void MainCamera_DownloadReady(ICamera sender, IDownloadInfo info)
|
||||||
{
|
{
|
||||||
_logger.Info("Download ready");
|
_logger.Debug("Download ready");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
info.FileName = $"img_{Guid.NewGuid()}.jpg";
|
info.FileName = $"img_{Guid.NewGuid()}.jpg";
|
||||||
sender.DownloadFile(info, _appSettings.PictureLocation);
|
sender.DownloadFile(info, _appSettings.PictureLocation);
|
||||||
var savedPath = Path.Combine(_appSettings.PictureLocation!, info.FileName);
|
var savedPath = Path.Combine(_appSettings.PictureLocation!, info.FileName);
|
||||||
_logger.Info($"Download complete: {savedPath}");
|
_logger.Debug($"Download complete: {savedPath}");
|
||||||
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,20 +1,15 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using CamBooth.App.Core.Logging;
|
using CamBooth.App.Core.Logging;
|
||||||
using CamBooth.App.Features.Camera;
|
using CamBooth.App.Features.Camera;
|
||||||
using EOSDigital.API;
|
|
||||||
|
|
||||||
namespace CamBooth.App.Features.LiveView;
|
namespace CamBooth.App.Features.LiveView;
|
||||||
|
|
||||||
public partial class LiveViewPage : Page, IDisposable
|
public partial class LiveViewPage : IDisposable
|
||||||
{
|
{
|
||||||
private readonly CameraService _cameraService;
|
private readonly CameraService _cameraService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|||||||
@ -41,35 +41,4 @@ public partial class ModernTimerControl : UserControl
|
|||||||
StatusText.Text = "Zeit abgelaufen!";
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -54,6 +54,11 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Instruction text below the ring -->
|
<!-- Instruction text below the ring -->
|
||||||
|
<Border Background="#CC101010"
|
||||||
|
CornerRadius="16"
|
||||||
|
Padding="28,14"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,24,0,0">
|
||||||
<TextBlock x:Name="InstructionText"
|
<TextBlock x:Name="InstructionText"
|
||||||
FontSize="46"
|
FontSize="46"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
@ -62,8 +67,8 @@
|
|||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
MaxWidth="900"
|
MaxWidth="900"
|
||||||
Margin="0,24,0,0"
|
|
||||||
Text="Lächeln! 😊"/>
|
Text="Lächeln! 😊"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class PhotoPrismAuthService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info("Starte PhotoPrism-Authentifizierung...");
|
_logger.Debug("Starte PhotoPrism-Authentifizierung...");
|
||||||
|
|
||||||
if (!ValidateConfiguration())
|
if (!ValidateConfiguration())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -134,7 +134,7 @@ public class PhotoPrismUploadQueueService : IDisposable
|
|||||||
{
|
{
|
||||||
if (_uploadQueue.Contains(photoPath)) return;
|
if (_uploadQueue.Contains(photoPath)) return;
|
||||||
_uploadQueue.Enqueue(photoPath);
|
_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)
|
private async Task ProcessQueueAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_logger.Info("PhotoPrism Upload-Queue-Verarbeitung gestartet");
|
_logger.Debug("PhotoPrism Upload-Queue-Verarbeitung gestartet");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -203,7 +203,7 @@ public class PhotoPrismUploadQueueService : IDisposable
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
_uploadTracker.MarkAsUploaded(filePath);
|
_uploadTracker.MarkAsUploaded(filePath);
|
||||||
_logger.Info($"✅ PhotoPrism Upload erfolgreich: {fileName}");
|
_logger.Debug($"✅ PhotoPrism Upload erfolgreich: {fileName}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -140,7 +140,7 @@ public class PhotoPrismUploadService : IDisposable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info($"Starte Upload: {Path.GetFileName(imagePath)}");
|
_logger.Debug($"Starte Upload: {Path.GetFileName(imagePath)}");
|
||||||
_logger.Debug($" Authentifiziert: {_isAuthenticated}");
|
_logger.Debug($" Authentifiziert: {_isAuthenticated}");
|
||||||
_logger.Debug($" Token vorhanden: {!string.IsNullOrEmpty(_authService.AccessToken)}");
|
_logger.Debug($" Token vorhanden: {!string.IsNullOrEmpty(_authService.AccessToken)}");
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ public class PhotoPrismUploadTracker
|
|||||||
};
|
};
|
||||||
|
|
||||||
SaveToDisk();
|
SaveToDisk();
|
||||||
_logger.Info($"Bild als hochgeladen markiert: {key}");
|
_logger.Debug($"Bild als hochgeladen markiert: {key}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -76,12 +76,13 @@ public partial class PictureGalleryPage : Page
|
|||||||
|
|
||||||
var qrSubLabel = new TextBlock
|
var qrSubLabel = new TextBlock
|
||||||
{
|
{
|
||||||
Text = "zum Fotoalbum",
|
Text = "📱 Handy-Kamera draufhalten",
|
||||||
Foreground = new SolidColorBrush(Colors.White),
|
Foreground = new SolidColorBrush(Colors.White),
|
||||||
FontSize = 11,
|
FontSize = 12,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
TextAlignment = TextAlignment.Center,
|
TextAlignment = TextAlignment.Center,
|
||||||
Margin = new Thickness(4, 0, 4, 2)
|
TextWrapping = TextWrapping.Wrap,
|
||||||
|
Margin = new Thickness(4, 0, 4, 4)
|
||||||
};
|
};
|
||||||
|
|
||||||
qrContainer.Children.Add(qrSubLabel);
|
qrContainer.Children.Add(qrSubLabel);
|
||||||
|
|||||||
@ -103,7 +103,7 @@ public class PictureGalleryService
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.thumbnails.Add(creationTime, PictureGalleryService.CreateThumbnail(picturePath, 244, 0));
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ public class PictureGalleryService
|
|||||||
}
|
}
|
||||||
while ((loop < cacheSize || cacheSize == 0) && loop < picturePaths.Count);
|
while ((loop < cacheSize || cacheSize == 0) && loop < picturePaths.Count);
|
||||||
});
|
});
|
||||||
this._logger.Info("Loading thumbnails into cache completed");
|
this._logger.Debug("Loading thumbnails into cache completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -253,13 +253,13 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Text -->
|
<!-- Text -->
|
||||||
<TextBlock Text="Herunterladen"
|
<TextBlock Text="Fotos"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
Margin="0,0,0,2"/>
|
Margin="0,0,0,2"/>
|
||||||
<TextBlock Text="Fotos"
|
<TextBlock Text="aufs Handy"
|
||||||
Foreground="#D4AF37"
|
Foreground="#D4AF37"
|
||||||
FontSize="8"
|
FontSize="8"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
@ -525,7 +525,7 @@
|
|||||||
|
|
||||||
<!-- QR-Code Dialog -->
|
<!-- QR-Code Dialog -->
|
||||||
<core:BaseDialogOverlay x:Name="QRCodeOverlay"
|
<core:BaseDialogOverlay x:Name="QRCodeOverlay"
|
||||||
DialogTitle="Online-Fotoalbum"
|
DialogTitle="Alle Fotos aufs Handy"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Panel.ZIndex="200"/>
|
Panel.ZIndex="200"/>
|
||||||
|
|
||||||
|
|||||||
@ -233,10 +233,14 @@ public partial class MainWindow : Window
|
|||||||
});
|
});
|
||||||
content.Children.Add(new System.Windows.Controls.TextBlock
|
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,
|
Foreground = Brushes.White,
|
||||||
FontSize = 16,
|
FontSize = 18,
|
||||||
TextAlignment = TextAlignment.Center
|
LineHeight = 26,
|
||||||
|
TextAlignment = TextAlignment.Center,
|
||||||
|
TextWrapping = TextWrapping.Wrap,
|
||||||
|
MaxWidth = 420
|
||||||
});
|
});
|
||||||
|
|
||||||
QRCodeOverlay.DialogContent = content;
|
QRCodeOverlay.DialogContent = content;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user