gaadgdg
This commit is contained in:
parent
23afd4903c
commit
c31ecdda99
|
|
@ -1,3 +1,5 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
|
|
||||||
namespace LayersShell;
|
namespace LayersShell;
|
||||||
|
|
@ -8,12 +10,47 @@ public partial class App : Application
|
||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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)
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
_window = new MainWindow();
|
Log("OnLaunched enter");
|
||||||
_window.Activate();
|
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 { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,15 @@ public sealed partial class MainWindow : Window
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
App.Log("MainWindow ctor enter");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
catch (Exception ex) { App.Log($"InitializeComponent FAILED: {ex}"); throw; }
|
||||||
Title = "Layers";
|
Title = "Layers";
|
||||||
_hwnd = WindowNative.GetWindowHandle(this);
|
_hwnd = WindowNative.GetWindowHandle(this);
|
||||||
|
App.Log($"hwnd = {_hwnd:X}");
|
||||||
|
|
||||||
var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd));
|
var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd));
|
||||||
if (appWindow is not null)
|
if (appWindow is not null)
|
||||||
|
|
@ -51,10 +57,23 @@ public sealed partial class MainWindow : Window
|
||||||
|
|
||||||
DispatcherQueue.TryEnqueue(() =>
|
DispatcherQueue.TryEnqueue(() =>
|
||||||
{
|
{
|
||||||
PointToRust();
|
try
|
||||||
LayersNative.StartupIfNeeded();
|
{
|
||||||
CreateNativeHandle();
|
App.Log("deferred init: PointToRust");
|
||||||
StartRenderLoop();
|
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