示例#1
0
 public override void Registered()
 {
     GLib.Idle.Add(delegate {
         WeatherController.ResetTimer();
         return(false);
     });
 }
示例#2
0
        protected override MenuList OnGetMenuItems()
        {
            MenuList list = base.OnGetMenuItems();

            if (WeatherController.Weather.Condition != null)
            {
                list[MenuListContainer.Header].Add(new MenuItem(Catalog.GetString("Radar _Map"),
                                                                WeatherController.Weather.Image, (o, a) => WeatherController.Weather.ShowRadar()));
            }


            list.SetContainerTitle(MenuListContainer.Actions, Mono.Unix.Catalog.GetString("Forecasts"));
            for (int i = 0; i < WeatherController.Weather.ForecastDays; i++)
            {
                if (WeatherController.Weather.Forecasts [i].dow != null)
                {
                    list[MenuListContainer.Actions].Add(new ForecastMenuItem(i,
                                                                             string.Format("{0}", WeatherForecast.DayName(WeatherController.Weather.Forecasts [i].dow)), WeatherController.Weather.Forecasts [i].image));
                }
            }

            list[MenuListContainer.CustomOne].Add(new MenuItem(Catalog.GetString("_Settings"), Gtk.Stock.Preferences,
                                                               delegate {
                if (Config == null)
                {
                    Config = new WeatherConfigDialog();
                }
                Config.Show();
            }));

            if (WeatherController.CurrentLocation != "")
            {
                list[MenuListContainer.CustomOne].Add(new MenuItem(Catalog.GetString("Check _Weather"), Gtk.Stock.Refresh,
                                                                   delegate {
                    Status = WeatherDockletStatus.ManualReload;
                    State |= ItemState.Wait;
                    QueueRedraw();
                    WeatherController.ResetTimer();
                }));
            }

            return(list);
        }