Пример #1
0
        void Repeat(object o)
        {
            if (IsRepeated == false)
            {
                IsRepeated = true;
            }
            else if (IsRepeated == true && SliderValue != 1)
            {
                IsRepeated = false;
            }

            else if (IsRepeated == true && SliderValue == 1)
            {
                Mp.Open(new Uri(CurrentSong.PathS, UriKind.RelativeOrAbsolute));
                Mp.Play();
                Mp.MediaOpened += new EventHandler(mediaOpened);
            }
        }
Пример #2
0
        void Play(object o)
        {
            Random rand = new Random();

            if (IsShuffled == true && o == null && flag == 0)
            {
                int n        = rand.Next(0, Songs.Count);
                int temprand = n;
                if (CurrentSong == Songs[n])
                {
                    while (temprand == n)
                    {
                        n = rand.Next(0, Songs.Count);
                    }
                }
                CurrentSong = Songs[n];

                Mp.Open(new Uri(Songs[n].PathS, UriKind.RelativeOrAbsolute));
                Mp.Play();
                Mp.MediaOpened += new EventHandler(mediaOpened);

                flag = 1;
            }
            else if ((o != null && (flag == 0)) || (o != temp && (flag == 2 || flag == 1)) && IsShuffled == true)
            {
                int n        = rand.Next(0, Songs.Count);
                int temprand = n;
                if (CurrentSong == Songs[n])
                {
                    while (temprand == n)
                    {
                        n = rand.Next(0, Songs.Count);
                    }
                }
                CurrentSong = Songs[n];

                Mp.Open(new Uri(Songs[n].PathS, UriKind.RelativeOrAbsolute));
                Mp.Play();
                Mp.MediaOpened += new EventHandler(mediaOpened);
                Isplaying       = true;
                flag            = 1;
            }

            else if ((o != null && (flag == 0)) || (o != temp && (flag == 2 || flag == 1)) && IsShuffled == false)
            {
                Song s = o as Song;
                CurrentSong = s;
                Mp.Open(new Uri(s.PathS, UriKind.RelativeOrAbsolute));
                Mp.Play();
                Mp.MediaOpened += new EventHandler(mediaOpened);
                Isplaying       = true;
                flag            = 1;
            }

            else if (o == null && flag == 0 && IsShuffled == false)
            {
                Mp.Open(new Uri(Songs[0].PathS, UriKind.RelativeOrAbsolute));
                CurrentSong = Songs[0];
                Mp.Play();
                Mp.MediaOpened += new EventHandler(mediaOpened);
                flag            = 1;
            }
            else if (flag == 1)
            {
                Mp.Pause();
                flag = 2;
            }
            else if (flag == 2)
            {
                Mp.Play();
                flag = 1;
            }


            Selecteds = CurrentSong;
            temp      = Selecteds;
        }