mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
[cmdpal] WIP add telemetry (#38032)
Related to https://github.com/microsoft/PowerToys/pull/37908 Closes https://github.com/zadjii-msft/PowerToys/issues/520 --------- Co-authored-by: Mike Griese <migrie@microsoft.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.UI.Events;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.Windows.AppLifecycle;
|
||||
|
||||
namespace Microsoft.CmdPal.UI;
|
||||
@@ -30,9 +32,10 @@ internal sealed class Program
|
||||
|
||||
Logger.InitializeLogger("\\CmdPal\\Logs\\");
|
||||
Logger.LogDebug($"Starting at {DateTime.UtcNow}");
|
||||
PowerToysTelemetry.Log.WriteEvent(new CmdPalProcessStarted());
|
||||
|
||||
WinRT.ComWrappersSupport.InitializeComWrappers();
|
||||
bool isRedirect = DecideRedirection();
|
||||
var isRedirect = DecideRedirection();
|
||||
if (!isRedirect)
|
||||
{
|
||||
Microsoft.UI.Xaml.Application.Start((p) =>
|
||||
@@ -48,17 +51,19 @@ internal sealed class Program
|
||||
|
||||
private static bool DecideRedirection()
|
||||
{
|
||||
bool isRedirect = false;
|
||||
AppActivationArguments args = AppInstance.GetCurrent().GetActivatedEventArgs();
|
||||
AppInstance keyInstance = AppInstance.FindOrRegisterForKey("randomKey");
|
||||
var isRedirect = false;
|
||||
var args = AppInstance.GetCurrent().GetActivatedEventArgs();
|
||||
var keyInstance = AppInstance.FindOrRegisterForKey("randomKey");
|
||||
|
||||
if (keyInstance.IsCurrent)
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new ColdLaunch());
|
||||
keyInstance.Activated += OnActivated;
|
||||
}
|
||||
else
|
||||
{
|
||||
isRedirect = true;
|
||||
PowerToysTelemetry.Log.WriteEvent(new ReactivateInstance());
|
||||
keyInstance.RedirectActivationToAsync(args).AsTask().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user