public void TestWeatherAlongARouteWithSingapore() { var request = new WeatherData <PointToPointRouteData>(); var route = new PointToPointRouteData(2); route.Waypoints[0].Position = new ServiceCartographic { Altitude = 100, Latitude = 1.353811, Longitude = 103.659532 }; route.Waypoints[0].Time = new DateTimeOffset(2019, 4, 16, 6, 30, 0, 0, new TimeSpan(0)); route.Waypoints[1].Position = new ServiceCartographic { Altitude = 100, Latitude = 1.291218, Longitude = 103.887249 }; route.Waypoints[1].Time = new DateTimeOffset(2019, 4, 16, 8, 0, 0, 0, new TimeSpan(0)); route.OutputSettings.Step = 900; request.Path = route; request.Provider = WeatherProviderType.AviationDotGov; var weather = WeatherServices.GetWeatherAlongARoute(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 4); }
public void TestWeatherAlongARoute() { var request = new WeatherData <PointToPointRouteData>(); var route = new PointToPointRouteData(2); route.Waypoints[0].Position = new ServiceCartographic { Altitude = 2000, Latitude = 39.07096, Longitude = -104.78509 }; route.Waypoints[0].Time = DateTimeOffset.Now.AddDays(-2); route.Waypoints[1].Position = new ServiceCartographic { Altitude = 1800, Latitude = 39.743635, Longitude = -104.607925 }; route.Waypoints[1].Time = DateTimeOffset.Now.AddDays(-2).AddHours(2.5); route.OutputSettings.Step = 900; request.Path = route; var weather = WeatherServices.GetWeatherAlongARoute(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 7); }
public void TestWeatherAlongARouteWithAviationDotGov() { var request = new WeatherData <PointToPointRouteData>(); var route = new PointToPointRouteData(2); route.Waypoints[0].Position = new ServiceCartographic { Altitude = 2000, Latitude = 39.07096, Longitude = -104.78509 }; route.Waypoints[0].Time = new DateTimeOffset(2019, 4, 16, 14, 30, 0, 0, new TimeSpan(0)); route.Waypoints[1].Position = new ServiceCartographic { Altitude = 1800, Latitude = 39.743635, Longitude = -104.607925 }; route.Waypoints[1].Time = new DateTimeOffset(2019, 4, 16, 16, 30, 0, 0, new TimeSpan(0)); route.OutputSettings.Step = 900; request.Path = route; request.Provider = WeatherProviderType.AviationDotGov; var weather = WeatherServices.GetWeatherAlongARoute(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 5); }
public HistoryWeatherPage(WeatherHistoryViewModel vm) { InitializeComponent(); ws = new WeatherServices(); BindingContext = this.viewModel = vm; }
public HistoryWeatherPage() { InitializeComponent(); ws = new WeatherServices(); viewModel = new WeatherHistoryViewModel(); BindingContext = viewModel; }
/// <summary> /// Factory method, return the requested WeatherDataService object thats implements IWeatherDataService. /// </summary> /// <param name="ws">WeatherServices - optional service</param> /// <returns>IWeatherDataService</returns> public IWeatherDataService GetWeatherDataService(WeatherServices ws) { IWeatherDataService weatherDataService; switch (ws) { case WeatherServices.OPEN_WEATHER_MAP: weatherDataService = OpenWeatherMapService.Instance; break; default: throw new WeatherDataServiceException("No Service Found"); } return(weatherDataService); }
public void TestWeatherAtASite() { var request = new WeatherData <SiteData>(); request.Path = new SiteData(); request.Path.Location.Latitude = 39.0; request.Path.Location.Longitude = -104.77; request.Path.Location.Altitude = 1910; request.AnalysisStart = new DateTime(2019, 4, 22, 12, 0, 0); request.AnalysisStop = new DateTime(2019, 4, 22, 13, 0, 0); var weather = WeatherServices.GetWeatherAtASite(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 3); }
public void TestWeatherAtASite() { var request = new WeatherData <SiteData>(); request.Path = new SiteData(); request.Path.Location.Latitude = 39.0; request.Path.Location.Longitude = -104.77; request.Path.Location.Altitude = 1910; request.AnalysisStart = DateTime.Now.AddDays(-2); request.AnalysisStop = DateTime.Now.AddDays(-2).AddHours(2.5); var weather = WeatherServices.GetWeatherAtASite(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 6); }
private async void GetWeatherButton_Click(object sender, RoutedEventArgs e) { if (!String.IsNullOrEmpty(nameEntry.Text)) { Weather weather = await WeatherServices.GetWeather(nameEntry.Text); locationText.Text = weather.Title; tempText.Text = weather.Temperature; windText.Text = weather.Wind; visibilityText.Text = weather.Visibility; humidityText.Text = weather.Humidity; sunriseText.Text = weather.Sunrise; sunsetText.Text = weather.Sunset; weatherBtn.Content = "Search Again"; } }
private async void Button_Click(object sender, EventArgs e) { EditText nameEntry = FindViewById <EditText>(Resource.Id.zipCodeEntry); if (!String.IsNullOrEmpty(nameEntry.Text)) { Weather weather = await WeatherServices.GetWeather(nameEntry.Text); if (weather != null) { FindViewById <TextView>(Resource.Id.locationText).Text = weather.Title; FindViewById <TextView>(Resource.Id.tempText).Text = weather.Temperature; FindViewById <TextView>(Resource.Id.windText).Text = weather.Wind; FindViewById <TextView>(Resource.Id.visibilityText).Text = weather.Visibility; FindViewById <TextView>(Resource.Id.humidityText).Text = weather.Humidity; FindViewById <TextView>(Resource.Id.sunriseText).Text = weather.Sunrise; FindViewById <TextView>(Resource.Id.sunsetText).Text = weather.Sunset; } } }
public ServiceManager() { this.googleServices = new GoogleServices(); this.googleServices.LatestCalendarEvent += (sender, calendar) => { this.CalendarStatusEvent?.Invoke(this, calendar); }; this.googleServices.LatestEmailsEvent += (sender, mail) => { this.LatestEmailsEvent?.Invoke(this, mail); }; this.googleMapsServices = new GoogleMapsServices(); this.googleMapsServices.TrafficUpdateEvent += (sender, traffic) => { this.TrafficUpdateEvent?.Invoke(this, traffic); }; this.newsServices = new NewsServices(); this.newsServices.LatestNewsEvent += (sender, newsmodel) => { this.LatestNewsEvent?.Invoke(this, newsmodel); }; this.weatherServices = new WeatherServices(this.lat, this.logt); this.weatherServices.WeatherUpdateEvent += (sender, weather) => { this.WeatherUpdateEvent?.Invoke(this, weather); }; this.quoteServices = new QuoteServices(); this.quoteServices.QuoteUpdateEvent += (sender, quote) => { this.QuoteUpdateEvent?.Invoke(this, quote); }; this.dateTimeServices = new DateTimeServices(); this.dateTimeServices.TimerUpdateEvent += (sender, time) => { this.TimerUpdateEvent?.Invoke(this, time); }; }
public CheckForWeatherUpdates(WeatherServices services, IHubContext <WeatherHub, IWeatherHub> hub) { Hub = hub; Services = services; }
public WeatherController(WeatherServices services, IHubContext <WeatherHub, IWeatherHub> hub) { _services = services; _hub = hub; }
public WeatherController(WeatherContext context, ConverterService converterService) { _context = context; service = new WeatherServices(_context); converter = converterService; }
private void timer1_Tick(object sender, EventArgs e) { UpdateScreenData(); if (checkGroundTime >= 150) { if (FSUIPCConnection.IsOpen) { try { FSUIPCConnection.Process(); if (GlobalData.COM1act != COM1act.Value) { GlobalData.COM1act = COM1act.Value; } if (GlobalData.COM1sby != COM1sby.Value) { GlobalData.COM1sby = COM1sby.Value; } ATCID = aircraftID.Value; int fpm = 0; if (ATCID != OldCraft) { imageList1.Images.Clear(); Console.WriteLine("Changing Image..."); ATCID = aircraftID.Value; ATCTYPE = aircraftType.Value; label10.Text = $"{ATCID} - {ATCTYPE}"; string urlAddress = "https://www.airplane-pictures.net/registration.php?p=" + ATCID; Console.WriteLine(urlAddress); WebClient client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); int lineis = 0; bool Found = false; bool count = false; string image = ""; int permline = 0; client.DownloadFile(urlAddress, Environment.CurrentDirectory + @"\Data\AircraftConfig.tmp"); string[] Page_AppGet = File.ReadAllLines(Environment.CurrentDirectory + @"\Data\AircraftConfig.tmp"); foreach (string line in Page_AppGet) { lineis = lineis + 1; if (Found == false) { if (line.Contains("<img src='")) { Found = true; } } else { if (count == false) { permline = lineis - 1; count = true; } } } string Line = GetLine(File.ReadAllText(Environment.CurrentDirectory + @"\Data\AircraftConfig.tmp"), permline); if (Line != "0x359") { string before = Regex.Split(Line, "<img src='")[1]; string Images = Regex.Split(before, "'")[0]; string Type = Images.Split('.')[1]; client.DownloadFile(Images, Environment.CurrentDirectory + @"\Data\AircraftImage.lco"); imageList1.Images.Add(Image.FromFile(Environment.CurrentDirectory + @"\Data\AircraftImage.lco")); imageList1.ImageSize = new Size(191, 125); pictureBox1.Image = imageList1.Images[0]; File.Delete(Environment.CurrentDirectory + @"\Data\AircraftConfig.tmp"); } else { try { imageList1.Images.Clear(); Console.WriteLine("Failed.."); } catch { } } } OldCraft = ATCID; if (!ongrnd) { double verticalSpeedMPS = verticalSpeed.Value / 256d; double verticalSpeedFPM = verticalSpeedMPS * 60d * 3.28084d; var vsFPM = Convert.ToInt32(verticalSpeedFPM); ATCTYPE = aircraftType.Value; label10.Text = $"{ATCID} - {ATCTYPE}"; fpm = vsFPM; VSRate.Text = "Feet Per Minute: " + vsFPM.ToString(); timer1.Enabled = timerOn; double airspeedKnots = (double)airspeed.Value / 128d; airspd = Convert.ToInt32(airspeedKnots).ToString(); SpeedLabel.Text = "Speed: " + airspd; var plnPitch = (double)pitch.Value * 360 / 4294967296 * -1; WeatherServices ws = FSUIPCConnection.WeatherServices; FsWeather weather = ws.GetWeatherAtAircraft(); if (weather.WindLayers.Count > 0) { FsWindLayer windLayer = weather.WindLayers[0]; windHdg = windLayer.Direction.ToString("000"); windSpd = windLayer.SpeedKnots.ToString("F0"); WiSpLabel.Text = "Wind Speed: " + windLayer.SpeedKnots.ToString("F0"); WiDiLabel.Text = "Wind Direction: " + windLayer.Direction.ToString("000"); } tmp = Convert.ToInt32(plnPitch); if (tmp >= 0) { PitchLabel.Text = "Pitch: " + tmp.ToString() + "▲"; } if (tmp < 0) { tmp = tmp * -1; PitchLabel.Text = "Pitch: " + tmp.ToString() + "▼"; } var plnBank = (double)roll.Value * 360 / 4294967296; var planebnk = ""; if (plnBank >= 0) { planebnk = Convert.ToInt32(plnBank).ToString() + "L"; } if (plnBank < 0) { planebnk = Convert.ToInt32(plnBank * -1).ToString() + "R"; } plnbnk = planebnk; BankLabel.Text = "Bank: " + planebnk; timer1.Interval = RefreshRate; } string onGroundText = this.onGround.Value > 0 ? "Y" : "N"; if (onGroundText == "Y") { checkGroundTime = 0; if (GlobalData.LoggedIn) { if (rptask) { checkBox1.Show(); rptask = false; } } if (!GlobalData.LoggedIn) { if (rptask) { checkBox1.Hide(); rptask = true; } } if (rptOnGround) { if (checkBox1.Checked) { SendData(fpm.ToString(), airspd, tmp.ToString(), plnbnk, windSpd, windHdg, ATCID, ATCTYPE); } rptOnGround = false; label8.Text = "Landed!"; ongrnd = true; fpmstringscore(fpm); if (Rate.Text != "") { LandingStats ls = new LandingStats(); ls.FPM = fpm.ToString(); ls.Speed = airspd; ls.Score = Rate.Text; ls.Roll = plnbnk; ls.Pitch = PitchLabel.Text.Replace("Pitch: ", ""); ls.WindSpeed = windSpd; ls.WindDirection = windHdg; LRMDatabase.AddStat(ls); } } } if (onGroundText == "N") { label8.Text = "Airborn"; ongrnd = false; rptOnGround = true; } } catch (FSUIPCException ex) { FSUIPCConnection.Close(); timer1.Enabled = false; GlobalData.ErrorLogInput(ex, "ERROR"); MessageBox.Show("Error, Cannot read game data: " + ex.Message + ", please Disconnect"); return; } } } else { checkGroundTime++; } }
public WeatherController() { unitOfWork = new UnitOfWork(); weatherService = new WeatherServices(unitOfWork); }