public static async Task InitializeAsync(PsuedoLocPackage package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new DiacriticsCommand(package, commandService); }
public static async Task InitializeAsync(PsuedoLocPackage package) { // Verify the current thread is the UI thread - the call to AddCommand in DoubleCommand's constructor requires // the UI thread. await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new L337Command(package, commandService); }
private L337Command(PsuedoLocPackage package, OleMenuCommandService commandService) : base(package) { ThreadHelper.ThrowIfNotOnUIThread(); commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandId = new CommandID(PsuedoLocPackage.CommandSet, CommandId); var menuItem = new OleMenuCommand(this.Execute, menuCommandId); menuItem.BeforeQueryStatus += this.MenuItem_BeforeQueryStatus; commandService.AddCommand(menuItem); }
#pragma warning restore SA1401 // Fields must be private public BaseCommand(PsuedoLocPackage package) { this.package = package ?? throw new ArgumentNullException(nameof(package)); }
protected ReversableCommand(PsuedoLocPackage package) : base(package) { }