예제 #1
0
        private void SongList_SelectedCellsChanged(object sender, EventArgs e)
        {
            if (SongList.SelectedCells.Count > 1)
            {
                return;
            }

            if (selectedFile == SongList.CurrentCell.Item as PlaylistItem)
            {
                return;
            }
            if (SongList.CurrentCell.Item == null)
            {
                return;
            }

            playbackState = AS.GetPlaybackState(playbackState);

            if (playbackState == PlaybackState.Playing || playbackState == PlaybackState.Paused)
            {
                selectedFile = SongList.CurrentCell.Item as PlaylistItem;

                if (selectedFile == null)
                {
                    return;
                }

                AS.StopSong();
                Task.Delay(100).ContinueWith(_ =>
                {
                    AS.PlaySong(selectedFile, "file");
                });

                DGUI.NowPlaying($"{selectedFile.artist} - {selectedFile.fileName}", NowPlayingTxt);

                currentRow = SongList.SelectedIndex;

                #region DiscordRPC
                //RPC.EditDetails($"Playing: {selectedFile.artist} - {selectedFile.fileName}", "In Song List");
                //RPC.EditImage("Listening.", OC.OriginToImageText(selectedFile.origin));
                //RPC.EditImageKeys("", OC.OriginToImageText(selectedFile.origin));
                RPC.EditRPC("In Song List", $"Playing: {selectedFile.artist} - {selectedFile.fileName}", "logo2", "Listening.", OC.OriginToAssetName(selectedFile.origin), OC.OriginToImageText(selectedFile.origin));
                #endregion
            }

            if (playbackState == PlaybackState.Stopped)
            {
                selectedFile = SongList.CurrentCell.Item as PlaylistItem;

                AS.PlaySong(selectedFile, "file");
                DGUI.NowPlaying(selectedFile.filePath, NowPlayingTxt);
            }
        }