Example #1
0
 private void Load()
 {
     mBox.msgShow            += MBox_msgShow;
     input.msgShow           += Input_msgShow;
     refreshControls.Elapsed += RefreshControls_Elapsed;
     g_Weather    = new GovWeather3();
     g_SunRiseSet = new InternalSunRiseSet();
     LoadLatLongs();
     g_Weather.Load();
     g_SunRiseSet.Load();
     refreshControls.Interval = 3600000.0;
     refreshControls.Start();
     notificationMenu = InitializeMenu();
 }
Example #2
0
        private void DeclareGlobals()
        {
            try
            {
                //get weather type
                string weatherType = SharedObjects.AppSettings.ReadSetting(Properties.Resources.cWeather);
                if (!string.IsNullOrWhiteSpace(weatherType))
                {
                    GetWeatherByName(weatherType);
                }
                if (g_Weather == null)
                {
                    g_Weather = (from X in WeatherObjects.AsEnumerable()
                                 where (!(X.Metadata.ClassName.StartsWith("Mock")))
                                 select(ISharedWeatherinterface) X.Value).FirstOrDefault() ?? GetWeatherByName("Mock_Weather");
                }
                g_Weather.Load();

                //try get latlong if you can
                if (!SharedObjects.LatLong.HasRecord())
                {
                    if (LatLongObjects != null)
                    {
                        double[] i = (from X in LatLongObjects.AsEnumerable()
                                      where X.Value.worked()
                                      select new double[] { X.Value.Latitude(), X.Value.Longitude() }).FirstOrDefault() ?? new double[] { 0, 0 };
                        SharedObjects.LatLong.Set(i[0], i[1]);
                    }
                }

                //get SRS
                string srs = SharedObjects.AppSettings.ReadSetting(Properties.Resources.cSRS);
                if (!string.IsNullOrWhiteSpace(srs))
                {
                    g_SunRiseSet = GetSRSByName(srs);
                }
                if (g_SunRiseSet == null)
                {
                    g_SunRiseSet = (from X in SRSObjects.AsEnumerable()
                                    where (!X.Metadata.ClassName.StartsWith("Mock"))
                                    select(IsharedSunRiseSetInterface) X.Value).First() ?? GetSRSByName("Mock_SunRiseSet");
                }
                g_SunRiseSet.Load();
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }
        }
Example #3
0
        private void UpdateGlobalObjecttype(object sender, EventArgs e)
        {
            MenuItem Current = (MenuItem)sender;
            string   Name    = Current.Text;

            if (((MenuItem)Current.Parent).Text == "Weather")
            {
                SharedObjects.AppSettings.AddUpdateAppSettings(Properties.Resources.cWeather, Name);
                g_Weather = GetWeatherByName(Name);
                g_Weather.Load();
            }
            else if (((MenuItem)Current.Parent).Text == "SunRiseSet")
            {
                SharedObjects.AppSettings.AddUpdateAppSettings(Properties.Resources.cSRS, Name);

                g_SunRiseSet = GetSRSByName(Name);
                g_SunRiseSet.Load();
            }
            notificationMenu       = new ContextMenu(InitializeMenu());
            notifyIcon.ContextMenu = notificationMenu;
        }