Пример #1
0
 public void NextSong(uVK.MainWindow main)
 {
     if (main.RandomAudioButton.IsChecked.Value)
     {
         Random rnds  = new Random();
         int    value = rnds.Next(0, int.Parse(main.api.Audio.GetCount(main.vkDatas.datas.User_id).ToString()) - 1);
         main.MusicList.SelectedIndex = value;
         Thread.Sleep(270);
         main.vkDatas.OffsetOwn += 1;
         SetAudioInfo(main);
     }
     else
     {
         try
         {
             main.vkDatas.OffsetOwn += 1;
             SetAudioInfo(main);
         }
         catch
         {
             main.vkDatas.OffsetOwn += 1;
             SetAudioInfo(main);
         }
     }
 }
Пример #2
0
 public void SetAudioInfo(uVK.MainWindow main, bool isback = false, bool fromClick = false)
 {
     foreach (var audio in main.vkDatas.HotAudios)
     {
         if (audio.Artist + " - " + audio.Title == main.MusicList.SelectedItem.ToString())
         {
             if (audio.Url != null)
             {
                 main.player.URL       = audio.Url.ToString();
                 main.MusicArtist.Text = audio.Artist;
                 main.MusicName.Text   = audio.Title;
                 main.player.controls.play();
                 break;
             }
             else if (isback)
             {
                 main.MusicList.SelectedIndex -= 1;
                 SetAudioInfo(main, true);
             }
             else
             {
                 main.MusicList.SelectedIndex += 1;
                 SetAudioInfo(main, false);
             }
         }
     }
 }
Пример #3
0
 public void NextSong(uVK.MainWindow main)
 {
     if (main.vkDatas.SearchAudios != null)
     {
         if (main.RandomAudioButton.IsChecked.Value)
         {
             Random rnds = new Random();
             int    value;
             value = rnds.Next(0, main.vkDatas.SearchAudios.Count);
             main.vkDatas.OffsetSearch = value;
             SetAudioInfo(main);
         }
         else
         {
             try
             {
                 main.vkDatas.OffsetSearch += 1;
                 SetAudioInfo(main);
             }
             catch
             {
                 main.vkDatas.OffsetSearch = 0;
                 SetAudioInfo(main);
             }
         }
     }
 }
Пример #4
0
 public void PrevSong(uVK.MainWindow main)
 {
     try
     {
         main.MusicList.SelectedIndex -= 1;
         SetAudioInfo(main, true);
     }
     catch
     {
         main.MusicList.SelectedIndex = main.MusicList.Items.Count - 1;
         SetAudioInfo(main, true);
     }
 }
Пример #5
0
 public void PrevSong(uVK.MainWindow main)
 {
     try
     {
         main.vkDatas.OffsetSearch -= 1;
         SetAudioInfo(main);
     }
     catch
     {
         main.vkDatas.OffsetSearch = main.vkDatas.SearchAudios.Count - 1;
         SetAudioInfo(main, true);
     }
 }
Пример #6
0
 public void PrevSong(uVK.MainWindow main)
 {
     try
     {
         main.vkDatas.OffsetOwn -= 1;;
         if (main.vkDatas.OffsetOwn == -1)
         {
             main.vkDatas.OffsetOwn = int.Parse(main.api.Audio.GetCount(main.vkDatas.datas.User_id).ToString()) - 1;
         }
         SetAudioInfo(main, true);
     }
     catch
     {
         SetAudioInfo(main, true);
     }
 }
Пример #7
0
 public void NextSong(uVK.MainWindow main)
 {
     if (main.RandomAudioButton.IsChecked.Value)
     {
         Random rnds  = new Random();
         int    value = rnds.Next(0, main.MusicList.Items.Count);
         main.MusicList.SelectedIndex = value;
         SetAudioInfo(main);
     }
     else
     {
         try
         {
             main.MusicList.SelectedIndex += 1;
             SetAudioInfo(main);
         }
         catch
         {
             main.MusicList.SelectedIndex = 0;
             SetAudioInfo(main);
         }
     }
 }
Пример #8
0
    public void SetAudioInfo(uVK.MainWindow main, bool isback = false, bool fromClick = false)
    {
        if (fromClick)
        {
            foreach (var audio in main.vkDatas.SearchAudios)
            {
                if (audio.Artist + " - " + audio.Title == main.MusicList.SelectedItem.ToString())
                {
                    main.vkDatas.OffsetSearch = main.MusicList.SelectedIndex;
                    bool th = false;
                    while (main.vkDatas.Audio[main.vkDatas.OffsetSearch].Url == null)
                    {
                        if (isback)
                        {
                            main.vkDatas.OffsetSearch--;
                        }
                        else
                        {
                            main.vkDatas.OffsetSearch++;
                        }
                        th = true;
                    }
                    if (th)
                    {
                        throw new Exception("1");
                    }
                    main.player.URL       = audio.Url.ToString();
                    main.MusicArtist.Text = audio.Artist;
                    main.MusicName.Text   = audio.Title;
                    main.player.controls.play();
                    break;
                }
            }
        }
        else
        {
            main.player.URL       = main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Url.ToString();
            main.MusicArtist.Text = main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Artist;
            main.MusicName.Text   = main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Title;
            for (int i = 0; i < main.MusicList.Items.Count; i++)
            {
                string str  = main.MusicList.Items[i].ToString();
                string str2 = main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Artist + " - " +
                              main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Title;
                if (main.MusicList.Items[i].ToString() == main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Artist
                    + " - " + main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Title)
                {
                    main.MusicList.SelectedIndex = i;
                    break;
                }
            }

            main.player.controls.play();
        }

        try
        {
            var uriImageSource = new Uri(main.vkDatas.SearchAudios[main.vkDatas.OffsetSearch].Album.Cover.Photo135, UriKind.RelativeOrAbsolute);
            main.MusicImage.ImageSource = new System.Windows.Media.Imaging.BitmapImage(uriImageSource);
        }
        catch
        {
            var uriImageSource = new Uri("https://psv4.userapi.com/c848020/u279747195/docs/d8/f81b6ea0493b/ImageMusic.png?extra=eAix6htvrxG4hUmiCSjYZFxb05FSZFEuJMjSpZXm5a3QVGsK6OOUkCOSYmjwrnV0VoILNas2Rf3ZN0M3QQNRTCG-39Ff_lkWs28baALlQGZaCkQLoLejYgpYKhoqnmuCYjABlFLmzm-zOWJ4CIPMm-2Q9PU", UriKind.RelativeOrAbsolute);
            main.MusicImage.ImageSource = new System.Windows.Media.Imaging.BitmapImage(uriImageSource);
        }
    }
Пример #9
0
 public void SetAudioInfo(uVK.MainWindow main, bool isback = false, bool fromClick = false)
 {
     State.SetAudioInfo(main, isback, fromClick);
 }
Пример #10
0
 public void PrevSong(uVK.MainWindow main)
 {
     State.PrevSong(main);
 }
Пример #11
0
 public void NextSong(uVK.MainWindow main)
 {
     State.NextSong(main);
 }