示例#1
0
        /// <summary>
        /// Handles the context menu click action.
        /// </summary>
        /// <param name="action">Which action should be performed.</param>
        internal static void HandleClick(CMenuAction action, Song song)
        {
            switch (action)
            {
            case CMenuAction.CopyToClipboard:
                Clipboard.SetText($"Artist: {song.ArtistName}, Circle: {song.CircleName}, Title: {song.Title}");
                break;

            case CMenuAction.CopyJsonToClipboard:
                Clipboard.SetText(JsonConvert.SerializeObject(song));
                break;

            case CMenuAction.SearchOnGoogle:
                System.Diagnostics.Process.Start($"https://www.google.com/search?q={song.ArtistName}+{song.Title}");
                break;

            case CMenuAction.SearchOnTw:
                System.Diagnostics.Process.Start($"https://en.touhouwiki.net/index.php?search={song.CircleName}");
                break;

            case CMenuAction.ShowDetails:
                var details = new SongDetailsWindow(song);
                details.Show();
                break;
            }
        }
        /// <summary>
        /// Handles the context menu click action.
        /// </summary>
        /// <param name="action">Which action should be performed.</param>
        private void HandleClick(CMenuAction action)
        {
            if (SongList.SelectedIndex == -1)
            {
                return;
            }

            var song = (Song)SongList.Items[SongList.SelectedIndex];

            SongActions.HandleClick(action, song);

#if DEBUG
            Console.WriteLine($"[HistoryWindow]: Action Performed - {action}");
#endif
        }