public void NextSong()
        {
            if (MusicsItemSource.Count == 0)
            {
                return;
            }
            currentMusic++;
            if (currentMusic > MusicsItemSource.Count)
            {
                currentMusic = 1;
            }
            if (isShuffled)
            {
                currentMusic = randNumbers[randomshuffle];
                randomshuffle++;
                randomshuffle = randomshuffle >= MusicsItemSource.Count ? randomshuffle = 0 : randomshuffle;
            }
            var tempCurrentMusic = MusicsItemSource.Where(i => i.Id == currentMusic).FirstOrDefault();

            if (isPaused)
            {
                PackIcon[0] = PackIconKind.Pause;
                isPaused    = false;
            }
            MusicPlayFunction(tempCurrentMusic);
            SelectedMusic        = currentMusic - 1;
            CurrentMusicPosition = 0;
            MaxTimeMusic         = (int)tempCurrentMusic.TimeSpanDuration.TotalSeconds;
        }
        public void PreviousSong()
        {
            if (MusicsItemSource.Count == 0)
            {
                return;
            }
            currentMusic--;
            if (currentMusic == 0)
            {
                currentMusic = MusicsItemSource.Count;
            }
            var tempCurrentMusic = MusicsItemSource.Where(i => i.Id == currentMusic).FirstOrDefault();

            if (isPaused)
            {
                PackIcon[0] = PackIconKind.Pause;
                isPaused    = false;
            }
            MusicPlayFunction(tempCurrentMusic);
            SelectedMusic        = currentMusic - 1;
            CurrentMusicPosition = 0;
        }
        public void InsertMusic()
        {
            Music          musics = null;
            OpenFileDialog open   = new OpenFileDialog
            {
                Title       = "Select Music",
                Filter      = "Music |*.mp3",
                Multiselect = true,
            };
            SaveFileDialog savePhoto = new SaveFileDialog();

            if (open.ShowDialog() == true)
            {
                foreach (var mus in open.FileNames)
                {
                    string tempTime = null;
                    musics = new Music();
                    TagLib.File tagFile = TagLib.File.Create(mus);
                    musics.Id               = index;
                    musics.Singer           = tagFile.Tag.FirstPerformer;
                    musics.SongName         = !string.IsNullOrWhiteSpace(tagFile.Tag.Title) ? tagFile.Tag.Title : Path.GetFileNameWithoutExtension(mus);
                    musics.URL              = mus;
                    musics.TimeSpanDuration = tagFile.Properties.Duration;
                    //if (tagFile.Tag.Pictures.Length >= 1)
                    //{
                    //	var bin = tagFile.Tag.Pictures[0].Data.Data;
                    //	var a = System.Drawing.Image.FromStream(new MemoryStream(bin)).GetThumbnailImage(100, 100, null, IntPtr.Zero);
                    //}
                    tempTime        = tagFile.Properties.Duration.Seconds >= 10 ? tagFile.Properties.Duration.Seconds.ToString() : "0" + tagFile.Properties.Duration.Seconds;
                    musics.Duration = tagFile.Properties.Duration.Minutes + ":" + tempTime;
                    MusicsItemSource.Add(musics);
                    index++;
                }
            }

            randNumbers = RandomHelper.GetRandom(MusicsItemSource.Count);
        }