Example #1
0
 void MaybeAddNullStation()
 {
     if (items.Count() == 0)
     {
         items.Add(new StationDockItem(NPR.LookupStation(-1)));
     }
 }
Example #2
0
        public void ShowMyStations()
        {
            ClearResults();
            my_stations.Sensitive = false;

            // no need to thread this, MyStations already exist in memory
            NPR.MyStations.ToList().ForEach(sID => {
                tileview.AppendTile(NPR.LookupStation(sID));
            });
        }
Example #3
0
        public void ReloadStations()
        {
            items.Clear();

            NPR.MyStations.ToList().ForEach(s => {
                items.Add(new StationDockItem(NPR.LookupStation(s)));
            });

            MaybeAddNullStation();

            Items = items;
        }
Example #4
0
        protected virtual void SearchClicked(object sender, System.EventArgs e)
        {
            my_stations.Sensitive = true;

            tileview.Clear();

            DockServices.System.RunOnThread(() => {
                // grab a list of nearby stations, sorted by closeness to the supplied query
                IEnumerable <Station> stations = NPR.SearchStations(ZipEntry.InnerEntry.Text);

                stations.ToList().ForEach(s => {
                    if (s.IsLoaded)
                    {
                        tileview.AppendTile(s);
                    }
                    s.FinishedLoading += delegate {
                        DockServices.System.RunOnMainThread(() => {
                            tileview.AppendTile(s);
                        });
                    };
                });
            });
        }
Example #5
0
        public Station(int id)
        {
            IsLoaded    = false;
            ForcePixbuf = DockServices.Drawing.LoadIcon("nprlogo.gif@" + GetType().Assembly.FullName, 128, -1);
            ID          = id;

            if (ID > 0)
            {
                DockServices.System.RunOnThread(() => {
                    LoadDataFromXElement(NPR.StationXElement(ID));
                });
                // this is how we create our "null" station entry
            }
            else
            {
                Name             = Catalog.GetString("No stations found.");
                Description      = Catalog.GetString("Please try your search again.");
                ShowActionButton = false;
                IsLoaded         = true;
            }

            DockServices.System.ConnectionStatusChanged += HandleConnectionStatusChanged;
        }
Example #6
0
 void HandleConnectionStatusChanged(object o, EventArgs args)
 {
     DockServices.System.RunOnThread(() => {
         LoadDataFromXElement(NPR.StationXElement(ID));
     });
 }