Пример #1
0
        public override ResponseType Run()
        {
            Dialog.ShowAll();

            ResponseType response = (ResponseType)Dialog.Run();

            if (response == ResponseType.Ok)
            {
                string      name = SourceName;
                StationType type = Type;
                string      arg  = Arg;

                ThreadAssist.Spawn(delegate {
                    if (source == null)
                    {
                        source = new StationSource(lastfm, name, type.Name, arg);
                        lastfm.AddChildSource(source);
                        //LastFMPlugin.Instance.Source.AddChildSource (source);
                        //ServiceManager.SourceManager.AddSource (source);
                    }
                    else
                    {
                        source.Rename(name);
                        source.Type = type;
                        source.Arg  = arg;
                        source.Save();
                        //source.Refresh ();
                    }
                });
            }

            return(response);
        }
Пример #2
0
        /*private void OnArtistVisitAmazon (object sender, EventArgs args)
         * {
         *  Browser.Open (String.Format (
         *      Catalog.GetString ("http://amazon.com/wiki/{0}"),
         *      CurrentArtist
         *  ));
         * }
         *
         * private void OnAlbumVisitAmazon (object sender, EventArgs args)
         * {
         * }*/

        private void OnArtistPlayFanRadio(object sender, EventArgs args)
        {
            StationSource fan_radio = null;

            foreach (StationSource station in lastfm.Children)
            {
                if (station.Type == StationType.Fan && station.Arg == CurrentArtist)
                {
                    fan_radio = station;
                    break;
                }
            }

            if (fan_radio == null)
            {
                fan_radio = new StationSource(lastfm,
                                              String.Format(Catalog.GetString("Fans of {0}"), CurrentArtist),
                                              "Fan", CurrentArtist
                                              );
                lastfm.AddChildSource(fan_radio);
            }

            ServiceManager.SourceManager.SetActiveSource(fan_radio);
        }
Пример #3
0
 public static StationSource CreateFromUrl(LastfmSource lastfm, string url)
 {
     foreach (StationType type in StationType.Types)
     {
         string regex = Regex.Escape(type.GetStationFor("XXX")).Replace("XXX", "([^\\/]+)");
         Match  match = Regex.Match(url, regex);
         if (match.Groups.Count == 2 && match.Groups[0].Captures.Count > 0)
         {
             Log.DebugFormat("Creating last.fm station from url {0}", url);
             string        arg     = match.Groups[1].Captures[0].Value;
             StationSource station = new StationSource(lastfm, arg, type.Name, arg);
             lastfm.AddChildSource(station);
             station.NotifyUser();
         }
     }
     return(null);
 }