コード例 #1
0
        private void PlayRadio(Image panel)
        {
            Radio.RadioFull station = (GetData.GetParentStack(panel) as StackPanel).DataContext as Radio.RadioFull;

            station = GetStations.GetStream((panel.DataContext as Radio.RadioFull).Url, station);

            if (station != null)
            {
                StationJanre.Content     = $"[{ station.Janre}]";
                StationNameLabel.Content = station.Name;

                StationNameLabel.Uid          = station.WhoPlay;
                StationCoverImage.ImageSource = new BitmapImage(new Uri(station.Picture));
                StationWhoPlayLabel.Content   = GetTrack.Get(station.WhoPlay);
                StationWhoPlayLabel.Uid       = station.WhoPlay;

                FirstQualityButton.IsEnabled  = true;
                FirstQualityButton.Background = (Brush)this.TryFindResource("GeneralColor");
                FirstQualityButton.Content    = station.QualityStream[0];
                FirstQualityButton.Uid        = station.Stream[0];

                PlayGrid.DataContext = station;

                SecondQualityButton.IsEnabled = true;
                if (station.QualityStream[1] != null)
                {
                    SecondQualityButton.Content = station.QualityStream[1];
                    SecondQualityButton.Uid     = station.Stream[1];
                }
                else
                {
                    SecondQualityButton.Content   = "-";
                    SecondQualityButton.IsEnabled = false;
                }

                FirstQualityButton.Background  = (Brush)this.TryFindResource("GeneralColor");
                SecondQualityButton.Background = new SolidColorBrush(Colors.WhiteSmoke);

                bool found = Favorite.Coincidence(FavoriteRadio, station.Name);

                if (found)
                {
                    FavoriteRadioButton.Source = new BitmapImage(new Uri("pack://application:,,/Resources/Icons/pl_start_fav.png"));
                    FavoriteRadioButton.Uid    = "1";
                }
                else
                {
                    FavoriteRadioButton.Source = new BitmapImage(new Uri("pack://application:,,/Resources/Icons/pl_star.png"));
                    FavoriteRadioButton.Uid    = "0";
                }

                PlayMusic(station.Stream[0]);
            }
        }
コード例 #2
0
        private void RefreshArtist(object id)
        {
            string track = "";

            while (true)
            {
                track = GetTrack.Get(id as string);

                Dispatcher.Invoke(() => StationWhoPlayLabel.Content = track);

                Thread.Sleep(5000);
            }
        }