Data diagnostics opt-in

This commit is contained in:
Stefan Markovic
2024-09-24 13:47:38 +02:00
parent 2146dff3bf
commit bea3607ea0
242 changed files with 2546 additions and 1283 deletions

View File

@@ -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);
});
}

View File

@@ -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)
{

View File

@@ -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();
}
}
}