Esempio n. 1
0
        private async Task BaseApp_StartupComplete_Miscellaneous_Async(object sender, EventArgs eventArgs)
        {
            if (Dispatcher == null)
            {
                throw new Exception("Dispatcher is null");
            }

            // Run on UI thread
            await Dispatcher.Invoke(async() =>
            {
                // Show log viewer if a debugger is attached
                if (Debugger.IsAttached)
                {
                    var logViewer = new LogViewer();
                    var win       = await logViewer.ShowWindowAsync();

                    // NOTE: This is a temporary solution to avoid the log viewer blocking the main window
                    win.Owner         = null;
                    win.ShowInTaskbar = true;
                    MainWindow?.Focus();
                }
            });
        }