mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
fix SingleInstance
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Wox.Infrastructure.Exception;
|
||||
using Wox.Infrastructure.Logger;
|
||||
@@ -16,7 +17,7 @@ namespace Wox.Helper
|
||||
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
//handle non-ui thread exceptions
|
||||
App.Window.Dispatcher.Invoke(() =>
|
||||
Application.Current.MainWindow.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Report((Exception)e.ExceptionObject);
|
||||
if (!(e.ExceptionObject is WoxException))
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Wox.Helper
|
||||
|
||||
public interface ISingleInstanceApp
|
||||
{
|
||||
void OnActivate();
|
||||
void OnSecondAppStarted();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -416,7 +416,7 @@ namespace Wox.Helper
|
||||
return;
|
||||
}
|
||||
|
||||
((TApplication)Application.Current).OnActivate();
|
||||
((TApplication)Application.Current).OnSecondAppStarted();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -437,8 +437,7 @@ namespace Wox.Helper
|
||||
if (Application.Current != null)
|
||||
{
|
||||
// Do an asynchronous call to ActivateFirstInstance function
|
||||
Application.Current.Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Normal, new DispatcherOperationCallback(ActivateFirstInstanceCallback));
|
||||
Application.Current.Dispatcher.Invoke(ActivateFirstInstance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user