private void AfterExecute(string Guid, int ID, object CustomIn, object CustomOut) { if (!_showShortcut) { return; } try { var cmd = _dte.Commands.Item(Guid, ID); if (string.IsNullOrWhiteSpace(cmd?.Name) || ShouldCommandBeIgnored(cmd)) { return; } string shortcut = GetShortcut(cmd); if (!string.IsNullOrWhiteSpace(shortcut)) { if (_options.LogToStatusBar) { string prettyName = Prettify(cmd); string text = $"{prettyName} ({shortcut})"; _control.SetVisibility(Visibility.Visible); _control.Text = text; } if (_options.ShowTooltip) { _control.SetTooltip(cmd); } if (_options.LogToOutputWindow) { Logger.Log($"{cmd.Name} ({shortcut})"); } if (_options.Timeout > 0) { _timer.Stop(); _timer.Start(); } } } catch (ArgumentException ex) { Telemetry.TrackException(ex); } catch (Exception ex) { Logger.Log(ex); } }
private void AfterExecute(string Guid, int ID, object CustomIn, object CustomOut) { ThreadHelper.ThrowIfNotOnUIThread(); if (!_showShortcut || !(CustomIn is null) || !(CustomOut is null)) { return; } try { Command cmd = null; try { cmd = _dte.Commands.Item(Guid, ID); } catch (ArgumentException) { return; } if (string.IsNullOrWhiteSpace(cmd?.Name) || ShouldCommandBeIgnored(cmd)) { return; } var shortcut = GetShortcut(cmd); if (string.IsNullOrWhiteSpace(shortcut)) { return; } if (_options.LogToStatusBar) { string prettyName = Prettify(cmd); string text = $"{prettyName} ({shortcut})"; _control.SetVisibilityAsync(Visibility.Visible).ConfigureAwait(false); _control.Text = text; } if (_options.ShowTooltip) { _control.SetTooltip(cmd); } if (_options.LogToOutputWindow) { Logger.LogAsync($"{cmd.Name} ({shortcut})").ConfigureAwait(false); } if (_options.Timeout > 0) { _timer.Stop(); _timer.Start(); } } catch (Exception ex) { Logger.LogAsync(ex).ConfigureAwait(false); } }