mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 03:49:07 +08:00
Add telemetry event for when the user presses delete within the first 2 seconds of showing the launcher.
This commit is contained in:
parent
221e153f4c
commit
5cda4135b1
@ -26,6 +26,8 @@ using Windows.UI.Xaml.Data;
|
||||
using System.Diagnostics;
|
||||
using Mages.Core.Runtime.Converters;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using System.Timers;
|
||||
|
||||
namespace PowerLauncher
|
||||
{
|
||||
@ -41,6 +43,9 @@ namespace PowerLauncher
|
||||
const int ROW_HEIGHT = 75;
|
||||
const int MAX_LIST_HEIGHT = 300;
|
||||
bool isDPIChanged = false;
|
||||
bool _deletePressed = false;
|
||||
Timer _firstDeleteTimer = new Timer();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@ -51,7 +56,21 @@ namespace PowerLauncher
|
||||
_settings = settings;
|
||||
InitializeComponent();
|
||||
|
||||
_firstDeleteTimer.Elapsed += CheckForFirstDelete;
|
||||
_firstDeleteTimer.Interval = 1000;
|
||||
|
||||
}
|
||||
|
||||
private void CheckForFirstDelete(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
_firstDeleteTimer.Stop();
|
||||
if (_deletePressed)
|
||||
{
|
||||
PowerLauncherTelemetry.Log.WriteEvent(new FirstDeleteEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -202,6 +221,8 @@ namespace PowerLauncher
|
||||
{
|
||||
if (Visibility == System.Windows.Visibility.Visible)
|
||||
{
|
||||
_deletePressed = false;
|
||||
_firstDeleteTimer.Start();
|
||||
Activate();
|
||||
UpdatePosition();
|
||||
_settings.ActivateTimes++;
|
||||
@ -216,6 +237,10 @@ namespace PowerLauncher
|
||||
_launcher.QueryTextBox.SelectAll();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_firstDeleteTimer.Stop();
|
||||
}
|
||||
}
|
||||
else if(e.PropertyName == nameof(MainViewModel.SystemQueryText))
|
||||
{
|
||||
@ -307,6 +332,10 @@ namespace PowerLauncher
|
||||
_viewModel.SelectPrevPageCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
else if( e.Key == VirtualKey.Back)
|
||||
{
|
||||
_deletePressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTextBoxToSelectedItem()
|
||||
|
Loading…
Reference in New Issue
Block a user