2020-08-06 05:06:55 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2020-07-21 02:22:03 +08:00
|
|
|
|
using System.Windows.Input;
|
2020-08-06 05:06:55 +08:00
|
|
|
|
using Microsoft.PowerLauncher.Telemetry;
|
|
|
|
|
using Microsoft.PowerToys.Telemetry;
|
2020-07-21 02:22:03 +08:00
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
|
|
|
|
|
namespace PowerLauncher.ViewModel
|
|
|
|
|
{
|
|
|
|
|
public class ContextMenuItemViewModel : BaseModel
|
|
|
|
|
{
|
|
|
|
|
private ICommand _command;
|
|
|
|
|
|
|
|
|
|
public string PluginName { get; set; }
|
2020-08-06 05:06:55 +08:00
|
|
|
|
|
2020-07-21 02:22:03 +08:00
|
|
|
|
public string Title { get; set; }
|
2020-08-06 05:06:55 +08:00
|
|
|
|
|
2020-07-21 02:22:03 +08:00
|
|
|
|
public string Glyph { get; set; }
|
2020-08-06 05:06:55 +08:00
|
|
|
|
|
2020-07-21 02:22:03 +08:00
|
|
|
|
public string FontFamily { get; set; }
|
2020-08-06 05:06:55 +08:00
|
|
|
|
|
2020-07-23 04:27:17 +08:00
|
|
|
|
public ICommand Command
|
|
|
|
|
{
|
2020-07-21 02:22:03 +08:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._command;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
// ICommand does not implement the INotifyPropertyChanged interface and must call OnPropertyChanged() to prevent memory leaks
|
|
|
|
|
if (value != this._command)
|
|
|
|
|
{
|
|
|
|
|
this._command = value;
|
|
|
|
|
OnPropertyChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Key AcceleratorKey { get; set; }
|
2020-08-06 05:06:55 +08:00
|
|
|
|
|
2020-07-21 02:22:03 +08:00
|
|
|
|
public ModifierKeys AcceleratorModifiers { get; set; }
|
2020-08-06 05:06:55 +08:00
|
|
|
|
|
2020-07-21 02:22:03 +08:00
|
|
|
|
public bool IsAcceleratorKeyEnabled { get; set; }
|
|
|
|
|
|
|
|
|
|
public void SendTelemetryEvent(LauncherResultActionEvent.TriggerType triggerType)
|
|
|
|
|
{
|
|
|
|
|
var eventData = new LauncherResultActionEvent()
|
|
|
|
|
{
|
|
|
|
|
PluginName = PluginName,
|
|
|
|
|
Trigger = triggerType.ToString(),
|
|
|
|
|
ActionName = Title
|
|
|
|
|
};
|
|
|
|
|
PowerToysTelemetry.Log.WriteEvent(eventData);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-06 05:06:55 +08:00
|
|
|
|
}
|