DesignerPreview changes

This commit is contained in:
2023-07-20 06:54:59 +02:00
parent db32c7aef3
commit 342fc0d047
3 changed files with 15 additions and 17 deletions

View File

@@ -18,18 +18,6 @@ public static class Program
public static string AppDataRoot { get; private set; } public static string AppDataRoot { get; private set; }
public static string EnvironmentName { get; private set; } public static string EnvironmentName { get; private set; }
static Program()
{
#if DEBUG
InitDevelopment();
#else
InitRelease();
#endif
InitLogging();
Log.Logger.Information("Early app starting...");
}
private static void InitDevelopment() private static void InitDevelopment()
{ {
EnvironmentName = "Development"; EnvironmentName = "Development";
@@ -92,6 +80,15 @@ public static class Program
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
#if DEBUG
InitDevelopment();
#else
InitRelease();
#endif
InitLogging();
Log.Logger.Information("Early app starting...");
AppDomain.CurrentDomain.FirstChanceException -= OnFirstChanceException; AppDomain.CurrentDomain.FirstChanceException -= OnFirstChanceException;
AppDomain.CurrentDomain.UnhandledException -= OnAppDomainUnhandledException; AppDomain.CurrentDomain.UnhandledException -= OnAppDomainUnhandledException;
TaskScheduler.UnobservedTaskException -= OnTaskSchedulerUnobservedTaskException; TaskScheduler.UnobservedTaskException -= OnTaskSchedulerUnobservedTaskException;
@@ -117,13 +114,13 @@ public static class Program
.UseReactiveUI() .UseReactiveUI()
.LogToTrace(); .LogToTrace();
private static void OnTaskSchedulerUnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e) private static void OnTaskSchedulerUnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)
=> HandleUnhandledException(sender, e.Exception); => HandleUnhandledException(sender, e.Exception);
private static void OnAppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) private static void OnAppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
=> HandleUnhandledException(sender, e.ExceptionObject as Exception); => HandleUnhandledException(sender, e.ExceptionObject as Exception);
private static void OnFirstChanceException(object? sender, FirstChanceExceptionEventArgs e) private static void OnFirstChanceException(object? sender, FirstChanceExceptionEventArgs e)
=> HandleUnhandledException(sender, e.Exception); => HandleUnhandledException(sender, e.Exception);
private static void HandleUnhandledException(object? sender, Exception? ex, [CallerMemberName] string caller = "") private static void HandleUnhandledException(object? sender, Exception? ex, [CallerMemberName] string caller = "")
@@ -135,7 +132,7 @@ public static class Program
sender?.GetType().ToString() ?? "null", sender?.GetType().ToString() ?? "null",
sender?.ToString() ?? "null", sender?.ToString() ?? "null",
ex); ex);
Log.CloseAndFlush(); Log.CloseAndFlush();
} }
} }

View File

@@ -10,7 +10,7 @@ namespace FileTime.GuiApp.ViewModels;
public class MainWindowDesignViewModel : IMainWindowViewModel public class MainWindowDesignViewModel : IMainWindowViewModel
{ {
public bool Loading => false; public bool Loading => false;
public IObservable<string?> MainFont { get; } = new BehaviorSubject<string?>(""); public IObservable<string?> MainFont { get; } = new BehaviorSubject<string?>(null);
public string Title => "FileTime Design Preview"; public string Title => "FileTime Design Preview";
public IGuiAppState AppState { get; } public IGuiAppState AppState { get; }
public IItemPreviewService ItemPreviewService { get; } public IItemPreviewService ItemPreviewService { get; }

View File

@@ -11,6 +11,7 @@
RequestedThemeVariant="Dark" RequestedThemeVariant="Dark"
Title="FileTime" Title="FileTime"
TransparencyLevelHint="Blur" TransparencyLevelHint="Blur"
d:DataContext="vm:MainWindowDesignViewModel"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d" mc:Ignorable="d"