Exemple #1
0
 public WeatherData(WeatherIcon Icon, WeatherIcon IconBasic, string CondName, string CondDesc, string CondDescNight = null)
 {
     this.Icon          = Icon;
     this.IconBasic     = IconBasic;
     ConditionName      = CondName;
     ConditionDescDay   = CondDesc;
     ConditionDescNight = CondDescNight;
 }
Exemple #2
0
 private void TimelineItem_HeaderLostFocus(object sender, EventArgs e)
 {
     HeaderDate.Fade(0).Start();
     HeaderTime.Fade(0).Start();
     HeaderSummary.Fade(0).Start();
     HeaderLikes.Fade(0).Start();
     HeaderImageContainer.Scale(1f, 1f, 34, 34).Offset(0, 140).Start();
     HeaderTitle.Offset(190, 70).Fade(0.7f).Scale(0.7f, 0.7f).Start();
     CornerClock.Fade(1).Start();
     WeatherIcon.Offset().Start();
 }
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;

            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            ViewBag.CompanyInfo = infoResponse.companyInfo;

            GetWeatherRequest  weatherRequest  = new GetWeatherRequest(infoResponse.companyInfo.city, infoResponse.companyInfo.province);
            GetWeatherResponse weatherResponse = connection.getWeather(weatherRequest);

            ViewBag.foundWeather = weatherResponse.result;
            if (weatherResponse.result)
            {
                ViewBag.currentTemp = weatherResponse.weather.Temperature.Metric.Value;
                ViewBag.feelTemp    = weatherResponse.weather.RealFeelTemperature.Metric.Value;
                ViewBag.weatherText = weatherResponse.weather.WeatherText;
                WeatherIcon url = new WeatherIcon();
                ViewBag.weatherIconURL = url.weatherURL[weatherResponse.weather.WeatherIcon];
            }
            else
            {
                ViewBag.currentTemp = "N/A";
                ViewBag.feelTemp    = "N/A";
                ViewBag.weatherText = "N/A";
            }

            string            company        = ViewBag.CompanyName;
            GetReviewRequest  reviewRequest  = new GetReviewRequest(company);
            GetReviewResponse reviewResponse = connection.getCompanyReviews(reviewRequest);

            ViewBag.companyReviews = reviewResponse.reviews;

            return(View("DisplayCompany"));
        }
        private void UpdateForm(WeatherResponse weatherResponse)
        {
            City.Text = weatherResponse.Location;
            WeatherIcon.Load(weatherResponse.WeartherUri);
            Temperature.Text = (weatherResponse.Temperature == -432) ? "9K" : weatherResponse.Temperature.ToString();
            WeatherText.Text = weatherResponse.WeatherText;
            Pressure.Text    = $"{weatherResponse.Pressure.ToString()} in";
            Wind.Text        = $"{weatherResponse.WindSpeed.ToString()} mph";
            Humidity.Text    = $"{weatherResponse.RelativeHumidity.ToString()} %";
            UVIndex.Text     = weatherResponse.UVIndex.ToString();
            var localTime = weatherResponse.RetrievedDateTimeOffset.ToLocalTime();

            Updated.Text = $"Updated at {localTime.ToString("h:mm:ss tt")}";
        }
Exemple #5
0
        private void TimelineItem_HeaderGotFocus(object sender, EventArgs e)
        {
            var item = sender as TimelineItem;

            RootPage.Current.UpdateBackground(Hero.HeroImage, Timeline.TimelinePanel.TopItemIndex);

            HeaderDate.Fade(1).Start();
            HeaderTime.Fade(1).Start();
            HeaderSummary.Fade(1).Start();
            HeaderLikes.Fade(1).Start();
            HeaderImageContainer.Scale(1.2f, 1.2f, 34, 34).Offset().Start();
            HeaderTitle.Offset().Fade(1).Scale().Start();
            CornerClock.Fade(0).Start();
            WeatherIcon.Offset(60).Start();
        }
Exemple #6
0
        public WeatherPoint(int temperature, WeatherIcon ico, Point xypoint, PictureBox pbParent, ImageList images)
        {
            tlabel           = new Label();
            tlabel.Parent    = pbParent;
            tlabel.Text      = temperature.ToString() + "c";
            tlabel.Visible   = true;
            tlabel.Location  = xypoint;
            tlabel.BackColor = Color.Transparent;
            tlabel.BringToFront();
            tlabel.Show();

            box           = new PictureBox();
            box.Parent    = pbParent;
            box.Image     = images.Images[(int)ico];
            xypoint.X     = xypoint.X + 10;
            xypoint.Y     = xypoint.Y + 10;
            box.Location  = xypoint;
            box.Size      = new Size(16, 16);
            box.BackColor = Color.Transparent;
            box.BringToFront();
            box.Show();
        }
        public async Task <IActionResult> OnGetAsync(Districts district)
        {
            if (!Enum.IsDefined(typeof(Districts), district))
            {
                return(RedirectToPage("./NotFound"));
            }

            LocationDisplayName = district.GetDisplayName();
            var results = await _ipma.GetForecastForLocation(district);

            Forecasts = results.ToList();

            foreach (var forecast in Forecasts)
            {
                forecast.Weather = _ipma.GetWeatherDetailsForForecast(forecast);
                forecast.Wind    = _ipma.GetWindDetailsForForecast(forecast);
                forecast.Icon    = WeatherIcon.GetIconForWeather(forecast.WeatherTypeId);
            }

            CurrentForecast = Forecasts.First();
            Forecasts       = Forecasts.Where(f => f != CurrentForecast);

            return(Page());
        }
 public WeatherData(string name, double temp, WeatherIcon iconType)
 {
     Name     = name;
     Temp     = temp;
     IconType = iconType;
 }
 void Awake()
 {
     Instance = this;
 }
Exemple #10
0
        public static WeatherIcon GetWeatherIcon(int weatherTypeId)
        {
            WeatherIcon icon = new WeatherIcon();

            if (weatherTypeId == 0)
            {
                icon.MetId       = 0;
                icon.Description = "Clear night";
                icon.Icon        = "wi-night-clear";
            }
            else if (weatherTypeId == 1)
            {
                icon.MetId       = 1;
                icon.Description = "Sunny day";
                icon.Icon        = "wi-day-sunny";
            }
            else if (weatherTypeId == 2)
            {
                icon.MetId       = 2;
                icon.Description = "Partly cloudy (night)";
                icon.Icon        = "wi-night-cloudy";
            }
            else if (weatherTypeId == 3)
            {
                icon.MetId       = 3;
                icon.Description = "Partly cloudy (day)";
                icon.Icon        = "wi-day-cloudy";
            }
            else if (weatherTypeId == 4)
            {
                icon.MetId       = 4;
                icon.Description = "Not used";
                icon.Icon        = "wi-na";
            }
            else if (weatherTypeId == 5)
            {
                icon.MetId       = 5;
                icon.Description = "Mist";
                icon.Icon        = "wi-fog";
            }
            else if (weatherTypeId == 6)
            {
                icon.MetId       = 6;
                icon.Description = "Fog";
                icon.Icon        = "wi-fog";
            }
            else if (weatherTypeId == 7)
            {
                icon.MetId       = 7;
                icon.Description = "Cloudy";
                icon.Icon        = "wi-cloud";
            }
            else if (weatherTypeId == 8)
            {
                icon.MetId       = 8;
                icon.Description = "Overcast";
                icon.Icon        = "wi-cloudy";
            }
            else if (weatherTypeId == 9)
            {
                icon.MetId       = 9;
                icon.Description = "Light rain shower (night)";
                icon.Icon        = "wi-night-showers";
            }
            else if (weatherTypeId == 10)
            {
                icon.MetId       = 10;
                icon.Description = "Light rain shower (day)";
                icon.Icon        = "wi-day-showers";
            }
            else if (weatherTypeId == 11)
            {
                icon.MetId       = 11;
                icon.Description = "Drizzle";
                icon.Icon        = "wi-sprinkle";
            }
            else if (weatherTypeId == 12)
            {
                icon.MetId       = 12;
                icon.Description = "Light rain";
                icon.Icon        = "wi-rain-mix";
            }
            else if (weatherTypeId == 13)
            {
                icon.MetId       = 13;
                icon.Description = "Heavy rain shower (night)";
                icon.Icon        = "wi-night-rain";
            }
            else if (weatherTypeId == 14)
            {
                icon.MetId       = 14;
                icon.Description = "Heavy rain shower (day)";
                icon.Icon        = "wi-day-rain";
            }
            else if (weatherTypeId == 15)
            {
                icon.MetId       = 15;
                icon.Description = "Heavy rain";
                icon.Icon        = "wi-rain";
            }
            else if (weatherTypeId == 16)
            {
                icon.MetId       = 16;
                icon.Description = "Sleet shower (night)";
                icon.Icon        = "wi-night-sleet";
            }
            else if (weatherTypeId == 17)
            {
                icon.MetId       = 17;
                icon.Description = "Sleet shower (day)";
                icon.Icon        = "wi-day-sleet";
            }
            else if (weatherTypeId == 18)
            {
                icon.MetId       = 18;
                icon.Description = "Sleet";
                icon.Icon        = "wi-sleet";
            }
            else if (weatherTypeId == 19)
            {
                icon.MetId       = 19;
                icon.Description = "Hail shower (night)";
                icon.Icon        = "wi-night-hail";
            }
            else if (weatherTypeId == 20)
            {
                icon.MetId       = 20;
                icon.Description = "Hail shower (day)";
                icon.Icon        = "wi-day-hail";
            }
            else if (weatherTypeId == 21)
            {
                icon.MetId       = 21;
                icon.Description = "Hail";
                icon.Icon        = "wi-hail";
            }
            else if (weatherTypeId == 22)
            {
                icon.MetId       = 22;
                icon.Description = "Light snow shower (night)";
                icon.Icon        = "wi-night-snow";
            }
            else if (weatherTypeId == 23)
            {
                icon.MetId       = 23;
                icon.Description = "Light snow shower (day)";
                icon.Icon        = "wi-day-snow";
            }
            else if (weatherTypeId == 24)
            {
                icon.MetId       = 24;
                icon.Description = "Light snow";
                icon.Icon        = "wi-snow";
            }
            else if (weatherTypeId == 25)
            {
                icon.MetId       = 25;
                icon.Description = "Heavy snow shower (night)";
                icon.Icon        = "wi-night-snow";
            }
            else if (weatherTypeId == 26)
            {
                icon.MetId       = 26;
                icon.Description = "Heavy snow shower (day)";
                icon.Icon        = "wi-day-snow";
            }
            else if (weatherTypeId == 27)
            {
                icon.MetId       = 27;
                icon.Description = "Heavy snow";
                icon.Icon        = "wi-snow";
            }
            else if (weatherTypeId == 28)
            {
                icon.MetId       = 28;
                icon.Description = "Thunder shower (night)";
                icon.Icon        = "wi-night-storm-showers";
            }
            else if (weatherTypeId == 29)
            {
                icon.MetId       = 29;
                icon.Description = "Thunder shower (day)";
                icon.Icon        = "wi-day-storm-showers";
            }
            else if (weatherTypeId == 30)
            {
                icon.MetId       = 30;
                icon.Description = "Thunder";
                icon.Icon        = "wi-storm-showers";
            }

            return(icon);
        }
 public static string GetNightFileName(WeatherIcon icon)
 {
     return(ConvertWeatherIconToId(icon) + "n.png");
 }
 public static string GetDayFileName(WeatherIcon icon)
 {
     return(ConvertWeatherIconToId(icon) + "d.png");
 }
        public static string ConvertWeatherIconToId(WeatherIcon icon)
        {
            string result;

            return(IconIdMap.TryGetValue(icon, out result) ? result : null);
        }
 void fillInfo()
 {
     pivot.Items.Remove(tpWorkout);
     if (!pivot.Items.Contains(tpSummary))
     {
         pivot.Items.Add(tpSummary);
     }
     pivot.SelectedItem = tpSummary;
     if (viewModel.Entry.Duration.HasValue)
     {
         tbSummaryDuration.Text = viewModel.Entry.Duration.Value.ToDisplayDuration().ToString();
     }
     tbSummaryExercise.Text = viewModel.Entry.Exercise.Name;
     if (viewModel.HasDistance)
     {
         tbSummaryDistance.Text = viewModel.Entry.Distance.Value.ToDisplayDistance().ToString("0.##");
     }
     if (viewModel.HasMaxSpeed)
     {
         tbSummaryMaxSpeed.Text = viewModel.Entry.MaxSpeed.Value.ToDisplaySpeed().ToString("0.##");
     }
     if (viewModel.HasAvgSpeed)
     {
         tbSummaryAvgSpeed.Text = viewModel.Entry.AvgSpeed.Value.ToDisplaySpeed().ToString("0.##");
         tbSummaryAvgPace.Text  = WilksFormula.PaceToString((float)viewModel.Entry.AvgSpeed.Value.ToDisplayPace(), true);
     }
     if (viewModel.HasMaxAlt)
     {
         tbSummaryMaxAltitude.Text = viewModel.Entry.MaxAltitude.Value.ToDisplayAltitude().ToString("0.#");
     }
     if (viewModel.HasMinAlt)
     {
         tbSummaryMinAltitude.Text = viewModel.Entry.MinAltitude.Value.ToDisplayAltitude().ToString("0.#");
     }
     if (viewModel.HasCalories)
     {
         tbSummaryCalories.Text = Math.Round(viewModel.Entry.Calories.Value).ToString();
     }
     if (viewModel.HasWeather)
     {
         var image = new BitmapImage(new Uri(string.Format("/Images/Weather/{0}", WeatherIcon.GetIcon(viewModel.Entry.Weather.Condition)), UriKind.RelativeOrAbsolute));
         imgWeather.Source = image;
         if (viewModel.Entry.Weather.Temperature.HasValue)
         {
             tbSummaryTemperature.Text = viewModel.Entry.Weather.Temperature.Value.ToString();
         }
     }
 }