コード例 #1
0
        public void SetData(WuLocation location)
        {
            locationLabel.Text = location?.Name;

            // redraw graph
            graphView.SetNeedsDisplay();
        }
コード例 #2
0
		public void SetData (WuLocation location)
		{
			locationLabel.Text = location?.Name;

			// redraw graph
			graphView.SetNeedsDisplay ();
		}
コード例 #3
0
        public static DateTime LocalTime(this WuLocation location)
        {
            var tzId = location?.Location?.tz ?? location?.Conditions?.local_tz_long ?? location?.TodayForecast?.date?.tz_long;

            var now = DateTime.Now;

            if (string.IsNullOrWhiteSpace(tzId))
            {
                return(now);
            }

            try {
                //var tzInfo = TimeZoneInfo.FindSystemTimeZoneById (location.Location.tz);

                return(TimeZoneInfo.ConvertTimeBySystemTimeZoneId(now, tzId));
            } catch (TimeZoneNotFoundException tzEx) {
                System.Diagnostics.Debug.WriteLine(tzEx.Message);
                System.Diagnostics.Debug.WriteLine(tzId);

                return(now);
            } catch (Exception ex) {
                System.Diagnostics.Debug.WriteLine(ex.Message);

                return(now);
            }
        }
コード例 #4
0
ファイル: LocationTvCell.cs プロジェクト: blparr/XWeather
 public void SetData(WuLocation location)
 {
     currentImage.Hidden = !location.Current;
     nameLabel.Text      = location.Name;
     timeLabel.Text      = location?.LocalTimeString();
     tempLabel.Text      = location?.TempString(Settings.UomTemperature, true);
 }
コード例 #5
0
ファイル: WuClient.cs プロジェクト: vackup/XWeather
        public void RemoveLocation(WuLocation location)
        {
            Locations.Remove(location);

            Locations.Sort();

            LocationRemoved?.Invoke(this, EventArgs.Empty);
        }
コード例 #6
0
		public static List<WeatherDetail> GetDetails (WuLocation location, TemperatureUnits temp, SpeedUnits speed, LengthUnits length, DistanceUnits distance, PressureUnits pressure)
		{
			var list = new List<WeatherDetail> ();

			for (int i = 0; i < Count; i++) list.Add (GetDetail (i, location, temp, speed, length, distance, pressure));

			return list;
		}
コード例 #7
0
ファイル: WeatherDetails.cs プロジェクト: blparr/XWeather
 public static WeatherDetail GetDetail(int row, WuLocation location, TemperatureUnits temp, SpeedUnits speed, LengthUnits length, DistanceUnits distance, PressureUnits pressure)
 {
     return(new WeatherDetail {
         DetailLabel = GetLabel(row),
         DetailValue = GetValue(row, location, temp, speed, length, distance, pressure),
         IsSectionTop = IsSectionTop(row)
     });
 }
コード例 #8
0
		public static WeatherDetail GetDetail (int row, WuLocation location, TemperatureUnits temp, SpeedUnits speed, LengthUnits length, DistanceUnits distance, PressureUnits pressure)
		{
			return new WeatherDetail {
				DetailLabel = GetLabel (row),
				DetailValue = GetValue (row, location, temp, speed, length, distance, pressure),
				IsSectionTop = IsSectionTop (row)
			};
		}
コード例 #9
0
ファイル: WuClient.cs プロジェクト: blparr/XWeather
        public void RemoveLocation(WuLocation location)
        {
            Locations.Remove(location);

            Locations.Sort();

            LocationRemoved?.Invoke(this, EventArgs.Empty);

            SettingsStudio.Settings.LocationsJson = Locations.GetLocationsJson();
        }
コード例 #10
0
ファイル: WeatherDetails.cs プロジェクト: blparr/XWeather
        public static List <WeatherDetail> GetDetails(WuLocation location, TemperatureUnits temp, SpeedUnits speed, LengthUnits length, DistanceUnits distance, PressureUnits pressure)
        {
            var list = new List <WeatherDetail> ();

            for (int i = 0; i < Count; i++)
            {
                list.Add(GetDetail(i, location, temp, speed, length, distance, pressure));
            }

            return(list);
        }
コード例 #11
0
ファイル: WuClient.cs プロジェクト: vackup/XWeather
        async Task <WuLocation> getWuLocation(WuAcLocation acLocation)
        {
            var location = new WuLocation(acLocation);

            location.Weather = await GetAsync <WuWeather> (acLocation.l);

            System.Diagnostics.Debug.WriteLine(location.Weather.ToJson());

            location.Updated = DateTime.UtcNow;

            return(location);
        }
コード例 #12
0
ファイル: WuClient.cs プロジェクト: blparr/XWeather
        public void AddLocation(WuLocation location, bool preventNotification = false)
        {
            Locations.Add(location);

            Locations.Sort();

            if (!preventNotification)
            {
                LocationAdded?.Invoke(this, EventArgs.Empty);

                SettingsStudio.Settings.LocationsJson = Locations.GetLocationsJson();
            }
        }
コード例 #13
0
        public void SetData(WuLocation location)
        {
            conditionLabel.Text = location?.Conditions?.weather;
            dayLabel.Text       = DateTime.Today.DayOfWeek.ToString();
            highTempLabel.Text  = location?.HighTempString(Settings.UomTemperature);
            locationLabel.Text  = location?.Name;
            lowTempLabel.Text   = location?.LowTempString(Settings.UomTemperature);
            precipLabel.Text    = location.ProbabilityPercipString();
            tempLabel.Text      = location?.TempString(Settings.UomTemperature, true);
            todayLabel.Text     = "Today";

            //precipIcon.Text = null;
            //wuIcon.Text = null;
        }
コード例 #14
0
		public static string GetValue (int row, WuLocation location, TemperatureUnits temp, SpeedUnits speed, LengthUnits length, DistanceUnits distance, PressureUnits pressure)
		{
			var conditions = location?.Conditions;

			if (conditions == null) return string.Empty;

			switch (row) {
				case 0: return conditions.FeelsLikeString (temp, true, true);
				case 1: return location.SunriseString ();
				case 2: return location.SunsetString ();
				case 3: return location.ProbabilityPercipString ();
				case 4: return conditions.relative_humidity;
				case 5: return conditions.WindString (speed);
				case 6: return conditions.GustString (speed);
				case 7: return conditions.PrecipTodayString (length);
				case 8: return conditions.PressureString (pressure);
				case 9: return conditions.VisibilityString (distance);
				case 10: return location.Conditions.UV.ToString ();
				default: return string.Empty;
			}
		}
コード例 #15
0
ファイル: WeatherDetails.cs プロジェクト: blparr/XWeather
        public static string GetValue(int row, WuLocation location, TemperatureUnits temp, SpeedUnits speed, LengthUnits length, DistanceUnits distance, PressureUnits pressure)
        {
            var conditions = location?.Conditions;

            if (conditions == null)
            {
                return(string.Empty);
            }

            switch (row)
            {
            case 0: return(conditions.FeelsLikeString(temp, true, true));

            case 1: return(location.SunriseString());

            case 2: return(location.SunsetString());

            case 3: return(location.ProbabilityPercipString());

            case 4: return(conditions.relative_humidity);

            case 5: return(conditions.WindString(speed));

            case 6: return(conditions.GustString(speed));

            case 7: return(conditions.PrecipTodayString(length));

            case 8: return(conditions.PressureString(pressure));

            case 9: return(conditions.VisibilityString(distance));

            case 10: return(location.Conditions.UV.ToString());

            default: return(string.Empty);
            }
        }
コード例 #16
0
 public static string LocalTimeString(this WuLocation location, bool lowercase = true)
 => lowercase?location?.LocalTime().ToShortTimeString().ToLower() : location?.LocalTime().ToShortTimeString();
コード例 #17
0
ファイル: DetailsTvHeader.cs プロジェクト: blparr/XWeather
 public void SetData(WuLocation location)
 {
     conditionLabel.Text = location?.ForecastString(Settings.UomTemperature);
     locationLabel.Text  = location?.Name;
     //wuIcon.Text = null;
 }
コード例 #18
0
ファイル: ColorExtensions.cs プロジェクト: blparr/XWeather
        public static Tuple <Color [], int> GetTimeOfDayGradient(this WuLocation location, bool random = false)
        {
            var index = location.GetTimeOfDayIndex(random);

            return(new Tuple <Color [], int> (Colors.Gradients [index], index));
        }
コード例 #19
0
		public void SetData (WuLocation location)
		{
			nameLabel.Text = location.Name;
			timeLabel.Text = location?.LocalTimeString ();
			tempLabel.Text = location?.TempString (Settings.UomTemperature, true);
		}
コード例 #20
0
 public void SetData(WuLocation location)
 {
     nameLabel.Text = location.Name;
     timeLabel.Text = location?.LocalTimeString();
     tempLabel.Text = location?.TempString(Settings.UomTemperature, true);
 }