Esempio n. 1
0
        /// <summary>
        /// Widget initialization (e.g.variables initialization, reading settings, loading resources) must done be here.
        /// </summary>
        //! This method is called whenever the widget is loaded by Newgen.
        public override void Load()
        {
            Settings      = (Settings)XmlSerializable.Load(typeof(Settings), SettingsFile) ?? new Settings();
            widgetControl = new Tile();

            widgetControl.Load();
        }
Esempio n. 2
0
        public override void Load()
        {
            var weatherConfig = Assembly.GetExecutingAssembly().GetManifestResourceStream("Widget.Weather.Weather.config");

            //Settings = (Settings)XmlSerializable.Load(typeof(Settings), Envi.WidgetsRoot + "\\Weather\\Weather.config") ?? new Settings();
            Settings      = (Settings)XmlSerializable.Load(typeof(Settings), weatherConfig) ?? new Settings();
            widgetControl = new WeatherWidget();
            widgetControl.Load();
        }
        public void Load()
        {
            WeatherProvider = new WeatherProvider();
            var weatherData = Assembly.GetExecutingAssembly().GetManifestResourceStream("Widget.Weather.Weather.data");

            //CurrentWeather = (WeatherData)XmlSerializable.Load(typeof(WeatherData), Envi.WidgetsRoot + "\\Weather\\Weather.data") ?? new WeatherData();
            CurrentWeather  = (WeatherData)XmlSerializable.Load(typeof(WeatherData), weatherData) ?? new WeatherData();
            currentLocation = new LocationData {
                Code = WidgetDerived.Settings.LocationCode
            };
            UpdateWeatherUI();

            weatherTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMinutes(WidgetDerived.Settings.RefreshInterval)
            };
            weatherTimer.Tick += WeatherTimerTick;
            weatherTimer.Start();

            tileAnimTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(15)
            };
            tileAnimTimer.Tick += TileAnimTimerTick;

            if (!string.IsNullOrEmpty(WidgetDerived.Settings.LocationCode))
            {
                RefreshWeather();
                if (Envi.AnimationEnabled)
                {
                    tileAnimTimer.Start();
                }
            }
            else
            {
                WeatherPanel.Visibility = Visibility.Collapsed;
                Tip.Visibility          = Visibility.Visible;
            }
        }
Esempio n. 4
0
 public override void Load()
 {
     Settings      = (Settings)XmlSerializable.Load(typeof(Settings), Widget.SettingsFile) ?? new Settings();
     widgetControl = new CalendarWidget();
     widgetControl.Load();
 }