gaadgdg
This commit is contained in:
parent
23afd4903c
commit
c31ecdda99
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace LayersShell;
|
||||
|
|
@ -7,13 +9,48 @@ public partial class App : Application
|
|||
private MainWindow? _window;
|
||||
|
||||
public App()
|
||||
{
|
||||
Log("App ctor enter");
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
Log($"UnhandledException: {e.ExceptionObject}");
|
||||
UnhandledException += (_, e) =>
|
||||
Log($"XAML UnhandledException: {e.Exception}");
|
||||
Log("App ctor ok");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"App ctor FAILED: {ex}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
Log("OnLaunched enter");
|
||||
try
|
||||
{
|
||||
_window = new MainWindow();
|
||||
Log("MainWindow constructed");
|
||||
_window.Activate();
|
||||
Log("MainWindow activated");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"OnLaunched FAILED: {ex}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Log(string line)
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), "layers-shell.log");
|
||||
File.AppendAllText(path, DateTime.Now.ToString("HH:mm:ss.fff ") + line + Environment.NewLine);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,16 @@ public sealed partial class MainWindow : Window
|
|||
private bool _isHovered = false;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
App.Log("MainWindow ctor enter");
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
catch (Exception ex) { App.Log($"InitializeComponent FAILED: {ex}"); throw; }
|
||||
Title = "Layers";
|
||||
_hwnd = WindowNative.GetWindowHandle(this);
|
||||
App.Log($"hwnd = {_hwnd:X}");
|
||||
|
||||
var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd));
|
||||
if (appWindow is not null)
|
||||
|
|
@ -51,10 +57,23 @@ public sealed partial class MainWindow : Window
|
|||
|
||||
DispatcherQueue.TryEnqueue(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
App.Log("deferred init: PointToRust");
|
||||
PointToRust();
|
||||
App.Log("deferred init: StartupIfNeeded");
|
||||
LayersNative.StartupIfNeeded();
|
||||
App.Log("deferred init: CreateNativeHandle");
|
||||
CreateNativeHandle();
|
||||
App.Log($"deferred init: _handle = {_handle:X}");
|
||||
StartRenderLoop();
|
||||
App.Log("deferred init: render loop started");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.Log($"deferred init FAILED: {ex}");
|
||||
throw;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue