mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Data diagnostics opt-in
This commit is contained in:
@@ -3,20 +3,22 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using MouseWithoutBorders.Class;
|
||||
|
||||
namespace MouseWithoutBorders
|
||||
{
|
||||
internal class ShutdownWithPowerToys
|
||||
{
|
||||
public static void WaitForPowerToysRunner()
|
||||
public static void WaitForPowerToysRunner(ETWTrace etwTrace)
|
||||
{
|
||||
try
|
||||
{
|
||||
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
Common.MainForm.Quit(true, false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -55,6 +55,10 @@ namespace MouseWithoutBorders.Class
|
||||
ManagedCommon.Logger.InitializeLogger("\\MouseWithoutBorders\\Logs");
|
||||
Common.Log(Application.ProductName + " Started!");
|
||||
|
||||
ETWTrace etwTrace = new ETWTrace();
|
||||
|
||||
etwTrace.Start();
|
||||
|
||||
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredMouseWithoutBordersEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
||||
{
|
||||
Common.Log("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
||||
@@ -115,7 +119,7 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
ShutdownWithPowerToys.WaitForPowerToysRunner();
|
||||
ShutdownWithPowerToys.WaitForPowerToysRunner(etwTrace);
|
||||
|
||||
if (firstArg != string.Empty)
|
||||
{
|
||||
@@ -223,6 +227,8 @@ namespace MouseWithoutBorders.Class
|
||||
var formScreen = new FrmScreen();
|
||||
|
||||
Application.Run(formScreen);
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace MouseWithoutBorders
|
||||
{
|
||||
@@ -38,8 +39,12 @@ namespace MouseWithoutBorders
|
||||
return;
|
||||
}
|
||||
|
||||
ETWTrace etwTrace = new ETWTrace();
|
||||
etwTrace.Start();
|
||||
|
||||
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
||||
{
|
||||
etwTrace?.Dispose();
|
||||
Application.Exit();
|
||||
});
|
||||
|
||||
@@ -76,6 +81,8 @@ namespace MouseWithoutBorders
|
||||
|
||||
dotForm = new FormDot();
|
||||
Application.Run(FormHelper = new FormHelper());
|
||||
|
||||
etwTrace?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user