Exemplo n.º 1
0
        private void Weather_CurrentUpdated(object sender, WeatherArgs e)
        {
            if (e == null)
            {
                return;
            }
            if (e.Data == null)
            {
                return;
            }
            if (e.Data.Length <= 0)
            {
                return;
            }

            WeatherData Data       = e.Data[0];
            DateTime    upt        = Data.Time;
            string      UnitString = Extensions.ToString(Data.Unit);

            Invoke(new MethodInvoker(() =>
            {
                picCurrentCondition.Image = ConditionImage(Data.Condition);
                lblCurrentTemp.Text       = string.Format("{0:N1}", Data.Current.Convert(Data.Unit)) + UnitString;
                lblMinMaxHumValues.Text   = string.Format("{0}\r\n{1}\r\n{2}", string.Format("{0:N0}{1}", Data.Minimum.Convert(Data.Unit), UnitString), string.Format("{0:N0}{1}", Data.Maximum.Convert(Data.Unit), UnitString), string.Format("{0:N0}%", Data.Humidity));
                lblLastUpdated.Text       = string.Format("{0}:{1}{2} {3}/{4}/{5}", (upt.Hour % 12 == 0 ? 12 : upt.Hour % 12), upt.Minute.ToString("D2"), (upt.Hour % 12 < 11 ? "AM" : "PM"), upt.Day.ToString("D2"), upt.Month.ToString("D2"), upt.Year);
                lblCurrentLocation.Text   = Data.Location;
            }));
        }
Exemplo n.º 2
0
        private void Weather_ForecastUpdated(object sender, WeatherArgs e)
        {
            if (e == null)
            {
                return;
            }
            if (e.Data == null)
            {
                return;
            }
            if (e.Data.Length <= 0)
            {
                return;
            }

            DateTime upt = e.Data[0].Time;

            Invoke(new MethodInvoker(() =>
            {
                lblLastUpdated.Text = string.Format("{0}:{1}{2} {3}/{4}/{5}", (upt.Hour % 12 == 0 ? 12 : upt.Hour % 12), upt.Minute.ToString("D2"), (upt.Hour % 12 < 11 ? "AM" : "PM"), upt.Day.ToString("D2"), upt.Month.ToString("D2"), upt.Year);
            }));
        }