/// <inheritdoc /> public override void PerformAction() { if (DebugView.Current == null) { DebugView.Launch(); } }
private static void RunApp() { var app = new App(AppArgs.SpotifyArgs); app.InitializeComponent(); #if DEBUG DebugView.Launch(); #endif Core.Spotify.Instance.Connected -= Spotify_Connected; Core.Spotify.Instance.Connected += Spotify_Connected; app.Run(); }
private static void HotkeyActionCallback([NotNull] Hotkey hotkey) { if (ToastView.Current?.IsInitComplete != true) { return; } // Ignore this keypress if it's been less than WAIT_BETWEEN_HOTKEY_PRESS since the last press if (DateTime.Now.Subtract(hotkey.LastPressTime).TotalMilliseconds < WAIT_BETWEEN_HOTKEY_PRESS) { return; } hotkey.LastPressTime = DateTime.Now; LastHotkey = hotkey; if (logger.IsDebugEnabled) { logger.Debug($"HotkeyActionCallback: {hotkey.Action}"); } try { #if DEBUG if (hotkey.Action == ToastifyAction.ShowDebugView && DebugView.Current == null) { DebugView.Launch(); } #endif if (hotkey.Action == ToastifyAction.CopyTrackInfo && Spotify.Instance.CurrentSong != null) { Analytics.TrackEvent(Analytics.ToastifyEventCategory.Action, Analytics.ToastifyEvent.Action.CopyTrackInfo); Clipboard.SetText(Spotify.Instance.CurrentSong.GetClipboardText(Settings.Current.ClipboardTemplate)); } else if (hotkey.Action == ToastifyAction.PasteTrackInfo && Spotify.Instance.CurrentSong != null) { Analytics.TrackEvent(Analytics.ToastifyEventCategory.Action, Analytics.ToastifyEvent.Action.PasteTrackInfo); Clipboard.SetText(Spotify.Instance.CurrentSong.GetClipboardText(Settings.Current.ClipboardTemplate)); Windows.SendPasteKey(); } else { Spotify.Instance.SendAction(hotkey.Action); } ToastView.Current.DisplayAction(hotkey.Action); } catch (Exception ex) { if (Debugger.IsAttached) { Debugger.Break(); } logger.Error("Exception with hooked key.", ex); ActionCallbackFailed?.Invoke(typeof(Hotkey), new HotkeyActionCallbackFailedEventArgs(hotkey, ex)); Analytics.TrackException(ex); } }