Skip to content

Commit

Permalink
[PowerOCR][Telemetry]Cancel and capture events (#20165)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo authored Aug 31, 2022
1 parent fcfbb67 commit 76ebed0
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/PowerOCR/PowerOCR/Helpers/WindowUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void LaunchOCROverlayOnEveryScreen()
allFullscreenGrab.Add(overlay);
}

PowerToysTelemetry.Log.WriteEvent(new PowerOCR.Telemetry.PowerOCRLaunchOverlayEvent());
PowerToysTelemetry.Log.WriteEvent(new PowerOCR.Telemetry.PowerOCRInvokedEvent());
}

internal static bool IsOCROverlayCreated()
Expand Down
4 changes: 4 additions & 0 deletions src/modules/PowerOCR/PowerOCR/OCROverlay.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Microsoft.PowerToys.Telemetry;
using PowerOCR.Helpers;
using PowerOCR.Utilities;

Expand Down Expand Up @@ -101,6 +102,7 @@ private void MainWindow_KeyDown(object sender, KeyEventArgs e)
{
case Key.Escape:
WindowUtilities.CloseAllOCROverlays();
PowerToysTelemetry.Log.WriteEvent(new PowerOCR.Telemetry.PowerOCRCancelledEvent());
break;
default:
break;
Expand Down Expand Up @@ -276,11 +278,13 @@ private async void RegionClickCanvas_MouseUp(object sender, MouseButtonEventArgs
}

WindowUtilities.CloseAllOCROverlays();
PowerToysTelemetry.Log.WriteEvent(new PowerOCR.Telemetry.PowerOCRCaptureEvent());
}
}

private void CancelMenuItem_Click(object sender, RoutedEventArgs e)
{
WindowUtilities.CloseAllOCROverlays();
PowerToysTelemetry.Log.WriteEvent(new PowerOCR.Telemetry.PowerOCRCancelledEvent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace PowerOCR.Telemetry
{
[EventData]
public class PowerOCRLaunchOverlayEvent : EventBase, IEvent
public class PowerOCRCancelledEvent : EventBase, IEvent
{
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
Expand Down
16 changes: 16 additions & 0 deletions src/modules/PowerOCR/PowerOCR/Telemetry/PowerOCRCaptureEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;

namespace PowerOCR.Telemetry
{
[EventData]
public class PowerOCRCaptureEvent : EventBase, IEvent
{
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}
16 changes: 16 additions & 0 deletions src/modules/PowerOCR/PowerOCR/Telemetry/PowerOCRInvokedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;

namespace PowerOCR.Telemetry
{
[EventData]
public class PowerOCRInvokedEvent : EventBase, IEvent
{
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

0 comments on commit 76ebed0

Please sign in to comment.