mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
CmdPal: Adding page Id to OpenPage telemetry event (#43584)
@niels9001 requested this. As the name says
This commit is contained in:
@@ -64,6 +64,8 @@ public partial class PageViewModel : ExtensionObjectViewModel, IPageContext
|
|||||||
|
|
||||||
public string Title { get => string.IsNullOrEmpty(field) ? Name : field; protected set; } = string.Empty;
|
public string Title { get => string.IsNullOrEmpty(field) ? Name : field; protected set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Id { get; protected set; } = string.Empty;
|
||||||
|
|
||||||
// This property maps to `IPage.IsLoading`, but we want to expose our own
|
// This property maps to `IPage.IsLoading`, but we want to expose our own
|
||||||
// `IsLoading` property as a combo of this value and `IsInitialized`
|
// `IsLoading` property as a combo of this value and `IsInitialized`
|
||||||
public bool ModelIsLoading { get; protected set; } = true;
|
public bool ModelIsLoading { get; protected set; } = true;
|
||||||
@@ -142,6 +144,7 @@ public partial class PageViewModel : ExtensionObjectViewModel, IPageContext
|
|||||||
return; // throw?
|
return; // throw?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id = page.Id;
|
||||||
Name = page.Name;
|
Name = page.Name;
|
||||||
ModelIsLoading = page.IsLoading;
|
ModelIsLoading = page.IsLoading;
|
||||||
Title = page.Title;
|
Title = page.Title;
|
||||||
|
|||||||
@@ -15,9 +15,12 @@ public class OpenPage : EventBase, IEvent
|
|||||||
{
|
{
|
||||||
public int PageDepth { get; set; }
|
public int PageDepth { get; set; }
|
||||||
|
|
||||||
public OpenPage(int pageDepth)
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public OpenPage(int pageDepth, string id)
|
||||||
{
|
{
|
||||||
PageDepth = pageDepth;
|
PageDepth = pageDepth;
|
||||||
|
Id = id;
|
||||||
|
|
||||||
EventName = "CmdPal_OpenPage";
|
EventName = "CmdPal_OpenPage";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ using Microsoft.PowerToys.Telemetry;
|
|||||||
using Microsoft.UI.Dispatching;
|
using Microsoft.UI.Dispatching;
|
||||||
using Microsoft.UI.Input;
|
using Microsoft.UI.Input;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Automation.Peers;
|
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Input;
|
using Microsoft.UI.Xaml.Input;
|
||||||
using Microsoft.UI.Xaml.Media.Animation;
|
using Microsoft.UI.Xaml.Media.Animation;
|
||||||
@@ -160,7 +159,7 @@ public sealed partial class ShellPage : Microsoft.UI.Xaml.Controls.Page,
|
|||||||
new AsyncNavigationRequest(message.Page, message.CancellationToken),
|
new AsyncNavigationRequest(message.Page, message.CancellationToken),
|
||||||
message.WithAnimation ? DefaultPageAnimation : _noAnimation);
|
message.WithAnimation ? DefaultPageAnimation : _noAnimation);
|
||||||
|
|
||||||
PowerToysTelemetry.Log.WriteEvent(new OpenPage(RootFrame.BackStackDepth));
|
PowerToysTelemetry.Log.WriteEvent(new OpenPage(RootFrame.BackStackDepth, message.Page.Id));
|
||||||
|
|
||||||
if (!ViewModel.IsNested)
|
if (!ViewModel.IsNested)
|
||||||
{
|
{
|
||||||
@@ -655,15 +654,15 @@ public sealed partial class ShellPage : Microsoft.UI.Xaml.Controls.Page,
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// The CommandBar is responsible for handling all the item keybindings,
|
// The CommandBar is responsible for handling all the item keybindings,
|
||||||
// since the bound context item may need to then show another
|
// since the bound context item may need to then show another
|
||||||
// context menu
|
// context menu
|
||||||
TryCommandKeybindingMessage msg = new(ctrlPressed, altPressed, shiftPressed, winPressed, e.Key);
|
TryCommandKeybindingMessage msg = new(ctrlPressed, altPressed, shiftPressed, winPressed, e.Key);
|
||||||
WeakReferenceMessenger.Default.Send(msg);
|
WeakReferenceMessenger.Default.Send(msg);
|
||||||
e.Handled = msg.Handled;
|
e.Handled = msg.Handled;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user