public async Task RePosition( double latitude, double longitude, [Option(ShortName = "r")] RetryPolicyKey retryPolicyKey = RetryPolicyKey.NoRetry, [Option(ShortName = "c")] CachePolicyKey cachePolicyKey = CachePolicyKey.NoCache) { _battery.RePosition(latitude, longitude); var retryPolicy = _policyRegistry.Get <IAsyncPolicy>(retryPolicyKey.ToString()); var cachePolicy = _policyRegistry.Get <IAsyncPolicy>(cachePolicyKey.ToString()); var meteoPolicy = Policy.WrapAsync(cachePolicy, retryPolicy); var coords = new Coordinate(latitude, longitude); var meteoPolicyResult = await meteoPolicy.ExecuteAndCaptureAsync( _ => GetMeteo(coords), new Context("Get meteo")); if (meteoPolicyResult.Outcome == OutcomeType.Successful) { _meteo = meteoPolicyResult.Result; } else { _console.Out.WriteLine($"Get meteo failed: {meteoPolicyResult.FinalException.Message}"); } var inPositionPolicyResult = await retryPolicy.ExecuteAndCaptureAsync( _ => ReportPosition(coords), new Context("In position.")); if (inPositionPolicyResult.Outcome == OutcomeType.Failure) { _console.Out.WriteLine($"Re-position failed: {inPositionPolicyResult.FinalException.Message}"); } }
public MoteurJeu(MoteurSysteme moteurSysteme, MoteurPhysique moteurPhysique) { statusJeu = Status.MenuAccueil; meteo = Meteo.Neige; menuManager = new MenuManager(this); this.moteurPhysique = moteurPhysique; this.moteurSysteme = moteurSysteme; evenementUtilisateur = new EvenementUtilisateur(); menuAccueuilFond = new Sprite(new Rectangle(0, 0, Constante.WindowWidth, Constante.WindowHeight)); carte = new Carte(moteurPhysique, moteurSysteme.carteArray, Vector2.Zero, 64, 64, 32, 16); carte.SetCarte(); personnage = new Personnage("Meta", new Vector2(3, 3), moteurPhysique.collisionCarte); monstres.Add(new Monstre(MonstreType.rondoudou, new Vector2(10, 8), moteurPhysique.collisionCarte)); //monstres.Add(new Monstre(MonstreType.brasegali, new Vector2(3, 5), moteurPhysique.collisionCarte)); hud = new HUD(personnage); animations.Add(new Animation()); combat = new Combat(moteurPhysique, evenementUtilisateur); }
public void montrerMeteo(List <Meteo> listeMeteo) { Meteo meteo1 = listeMeteo[0]; this.temp.Text = this.temp.Text + meteo1.description; Console.WriteLine("Meteo ajouter dans la TextBox"); }
private bool ConditionArrosage() { bool humTerreIns = false; // Verification humidite de la terre if (humTerre < seuilMinHumTerre) { humTerreIns = true; } // Verification meteo Meteo meteo = listMeteo[getDate()]; Releve releveMoyenne = meteo.getMoyenneReleve(); // On test le "degre" de la metoe local switch (getTypeMeteoLocal(releveMoyenne)) { case 2: testVal2 = 2; return(humTerreIns); // Si = 2, alors on arrose uniquement si la terre n'est pas assez humide case 3: testVal2 = 3; return(humTerreIns); // Si = 3, idem case 4: testVal2 = 4; return(true); // Si = 4, alors on arrose toujours par précotion meme si la terre est assez humide default: testVal2 = -1; return(false); } }
static void Main(string[] args) { //Inversor i = new Inversor(true, true, "192.168.0.222", 8899); //i.Inicia(); //Console.Read(); //Ini(); var dsi = new Meteo(); dsi.Inicia(); //dsi.AnalizaRespuesta(res); ////res = System.Net.WebUtility.HtmlDecode(res); ////var lec = res.Substring(res.IndexOf("{t}") + 3, res.LastIndexOf("{t}")-3); ////var nlec = Regex.Split(lec, "{s}"); ////foreach(var item in nlec ) ////{ //// if (item != string.Empty) //// { //// var lecd = item.Substring(0, item.LastIndexOf("{e}")); //// } ////} //var s1 = Stopwatch.StartNew(); //var ls = BuscaDispositivos(987); //s1.Stop(); //Console.WriteLine(s1.ElapsedMilliseconds); Console.Read(); }
public void VerifyAverageTemperatureBasedOnMaxValues() { double expectedAverage = 10.17; double averageTemp = Meteo.CalculateAverageTemperatureBasedOnMaxValues(temp); Assert.AreEqual(expectedAverage, averageTemp); }
private void RaiseWeatherChange(Meteo value) { var handler = WeatherChange; if (handler != null) { MeteoEventArgs args = new MeteoEventArgs(value); handler(this, args); } }
/// <summary> /// Constructeur d'un Trajet. /// </summary> /// <param name="date">Date du trajet</param> /// <param name="depart">Lieu de départ du trajet</param> /// <param name="arrivee">Lieu d'arrivée du trajet</param> /// <param name="duree">Durée du trajet</param> /// <param name="km">Nombre de kilomètres parcourus durant le trajet</param> /// <param name="voiture">Voiture utilisée lors du trajet</param> /// <param name="meteo">Météo durant le trajet</param> /// <param name="trafic">Trafic sur la route durant le trajet</param> /// <param name="remarque">Remarques à ajouter sur le trajet (ex : Accident sur la route)</param> public Trajet(DateTime date, string depart, string arrivee, TimeSpan duree, int km, Voiture voiture, Meteo meteo, Trafic trafic, string remarque) { Date = date; Depart = depart; Arrivee = arrivee; Duree = duree; Km = km; Voiture = voiture; Meteo = meteo; Trafic = trafic; Remarque = remarque; }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } treesList = new HashSet <TreeMesh>(); }
static void Main(string[] args) { Meteo met = new Meteo(); string cesta = "CCCCCCMMMCCCCCMMMCCCCCCTTCCCCCMMMCCCCCCTTCCCCCCCCCCTTCCCCCCC"; Autonomvz auto = new Autonomvz(100, cesta); vypsat vyp = new vypsat(); vyp.Sub(auto); RC rc = new RC(); rc.Sub(auto); auto.Drive(); }
static void MenuGetAllCities() { Console.Clear(); Spacer(); List <WeatherForecast> cities = Meteo.GetAllCities(); foreach (WeatherForecast city in cities) { Console.WriteLine("Miasto: " + city.CityName); } Spacer(); }
public Environnement(GameWindow window) { meteo = Meteo.Beau; phaseJournee = PhaseJournee.Jour; ambient = 1f; heure = 15; minute = 50; compteur = 0; hauteur = window.ClientBounds.Height; largeur = window.ClientBounds.Width; particularEngine = new ParticularEngine(); }
public void Prova4() { //Arrange Meteo MyMeteo = new Meteo(); int temp = 30; int pluja = 12; bool vent_fort = false; //Act bool Max = MyMeteo.alerta_incendi(temp, pluja, vent_fort); //Assert Assert.AreEqual(false, Max); }
private async void ViewMeteo() { Meteo meteo = await CoreMeteo.GetMeteo(); Temperature.Text = meteo.Temperature; VentDirectionImage.Source = meteo.VentDirectionImage; VentVitesseMoyenne.Text = meteo.VentVitesseMoyenne; VentVitesseRafales.Text = meteo.VentVitesseRafales; Humidite.Text = meteo.Humidite; Pression.Text = meteo.Pression; Conditions.Text = meteo.Conditions; ConditionsImage.Source = meteo.ConditionsImage; HoraireLeverSoleil.Text = meteo.LeverSoleil; HoraireCoucherSoleil.Text = meteo.CoucherSoleil; }
static void Main(string[] args) { #region user input int userInput; string userChoice; string city_name; #endregion do { MenuItems(); Console.Write("Wybierz pozycję z menu [1-4]: "); userChoice = Console.ReadLine(); // check if is number if (!Int32.TryParse(userChoice, out userInput)) { continue; } if (userChoice == "4") { Environment.Exit(0); } if (userChoice == "3") { CreatedBy(); } if (userChoice == "2") { MenuGetAllCities(); } if (userChoice == "1") { Console.Clear(); Spacer(); Console.Write("Podaj nazwę miasta bez spacji i polskich znaków [np. ZielonaGora]: "); city_name = Console.ReadLine(); MeteoResponse(Meteo.GetData(city_name)); } Anykey(); }while (true); }
public MeteoController(ILogger <MeteoController> logger) { _logger = logger; dbMeteo = new Meteo(); if (dbMeteo.Campioni.Count() == 0) { dbMeteo.Campioni.Add(new Campione { Data = DateTime.Now, Previsione = "Afoso", Temperatura = 28 }); dbMeteo.Campioni.Add(new Campione { Data = DateTime.Now.Subtract(TimeSpan.FromHours(1)), Previsione = "Fresco", Temperatura = 20 }); dbMeteo.SaveChanges(); } }
//public int[] GetWeather(int nb) public void GetWeather(int nb) { //int[] weatherStats = new int[nb]; for (int i = 0; i <= nb; i++) { //weatherStats[i] = random.Next(0, 101); //weatherStats[i].SayWeather(); int n = random.Next(0, 101); Meteo meteo = n.SayWeather(); MeteoActuelle = meteo; if (MeteoActuelle == Meteo.soleil) { countSun++; } } //return weatherStats; }
public void ObtenirLaMeteoDuJour_AvecUnBouchon_RetourneSoleil() { Meteo fausseMeteo = new Meteo { Temperature = 25, Temps = Temps.Soleil }; Mock <IDal> mock = new Mock <IDal>(); mock.Setup(dal => dal.ObtenirLaMeteoDuJour()).Returns(fausseMeteo); IDal fausseDal = mock.Object; Meteo meteoDuJour = fausseDal.ObtenirLaMeteoDuJour(); Assert.AreEqual(25, meteoDuJour.Temperature); Assert.AreEqual(Temps.Soleil, meteoDuJour.Temps); }
static void Main(string[] args) { Meteo laMeteoDuJour = new Meteo(); //abonnement a l'evenement //laMeteoDuJour.LeSoleilVientDapparaitre += LaMeteoDuJour_LeSoleilVientDapparaitre; //Thread.Sleep(1000); //laMeteoDuJour.ChangeLetemps(); laMeteoDuJour.LaTemperatureAChanger += LaTemperatureAChanger; Thread.Sleep(1000); laMeteoDuJour.ChangerTemperature(20m); Console.Read(); }
public void WhenLaMeteoDuJour_ThenRetourneSoleil() { //GIVEN Meteo fausseMeteo = new Meteo { Temperature = 25, Temps = Temps.Soleil }; mock.Setup(dal => dal.ObtenirLaMeteoDuJour()).Returns(fausseMeteo); IDal fausseDal = mock.Object; //When Meteo meteoDuJour = fausseDal.ObtenirLaMeteoDuJour(); //Then Assert.AreEqual(25, meteoDuJour.Temperature); Assert.AreEqual(Temps.Soleil, meteoDuJour.Temps); }
public void VerifyTheWarmestDaysOrMaxValues() { Meteo.Temperature[] expectedDaysWithMaxValues = new Meteo.Temperature[] { new Meteo.Temperature { day = 6, tempMax = 15, tempMin = -1 }, new Meteo.Temperature { day = 7, tempMax = 15, tempMin = 2 }, new Meteo.Temperature { day = 25, tempMax = 15, tempMin = 0 } }; Meteo.Temperature[] daysWithMaxValues = Meteo.ReturnDaysWithMaxTemp(temp); Assert.AreEqual(expectedDaysWithMaxValues.Length, daysWithMaxValues.Length); CollectionAssert.AreEqual(expectedDaysWithMaxValues, daysWithMaxValues); }
public void VerifyTheMaxDifferencesBetweenMinValuesAndMaxValue() { Meteo.Temperature[] expectedDays = new Meteo.Temperature[] { new Meteo.Temperature { day = 4, tempMax = 13, tempMin = -3 }, new Meteo.Temperature { day = 6, tempMax = 15, tempMin = -1 } }; int exxpectedMaxDiff = 16; int maxDiff = Meteo.ReturnMaxDiff(temp); Meteo.Temperature[] days = Meteo.ReturnDaysWithMaxDiffBetweenMinValAndMaxVal(temp); Assert.AreEqual(exxpectedMaxDiff, maxDiff); Assert.AreEqual(expectedDays.Length, days.Length); CollectionAssert.AreEqual(expectedDays, days); }
public void TestMaxTemp() { //Arrange Meteo MyMeteo = new Meteo(); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(8); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); MyMeteo.temperatures.Add(1); //Act int Max = MyMeteo.MaxTemp(); //Assert Assert.AreEqual(8, Max); }
public ActionResult Forecasting(Meteo meteo) { var forecast = Tools.MeteoToForecast(meteo); var x = new List <string>() { "Нет риска болезни", "Бурая ржавчина", "Пыльная головня", "Карликовая головня", "Черный бактериоз пшеницы", "Офиоболезная корневая гниль" }; var y = new List <double>() { forecast.None, forecast.BurRz, forecast.PilnGol, forecast.KarlGol, forecast.ChernBakt, forecast.KornGnil }; Chart theChart = new Chart(width: 300, height: 200) .AddSeries( chartType: "bar", legend: "Income", xValue: x, yValues: y); theChart.ToWebImage().Save("~/Content/chart", "PNG"); return(View(forecast)); }
public void VerifyTheColdestDaysOrMinValues() { Meteo.Temperature[] expectedDaysWithMinValues = new Meteo.Temperature[] { new Meteo.Temperature { day = 4, tempMax = 13, tempMin = -3 }, new Meteo.Temperature { day = 15, tempMax = 9, tempMin = -3 }, new Meteo.Temperature { day = 19, tempMax = 7, tempMin = -3 }, new Meteo.Temperature { day = 27, tempMax = 6, tempMin = -3 } }; Meteo.Temperature[] daysWithMinValues = Meteo.ReturnDaysWithMinTemp(temp); Assert.AreEqual(expectedDaysWithMinValues.Length, daysWithMinValues.Length); CollectionAssert.AreEqual(expectedDaysWithMinValues, daysWithMinValues); }
private void SorceressSkill_VisibleChanged(object sender, EventArgs e) { FireVolt.SetSkillPoints = "0"; Wram.SetSkillPoints = "0"; Inferno.SetSkillPoints = "0"; Blaze.SetSkillPoints = "0"; FireBall.SetSkillPoints = "0"; FireWall.SetSkillPoints = "0"; Inchent.SetSkillPoints = "0"; Meteo.SetSkillPoints = "0"; FireMastary.SetSkillPoints = "0"; Hydra.SetSkillPoints = "0"; FireVolt.setTextBoxColor(); Wram.setTextBoxColor(); Inferno.setTextBoxColor(); Blaze.setTextBoxColor(); FireBall.setTextBoxColor(); FireWall.setTextBoxColor(); Inchent.setTextBoxColor(); Meteo.setTextBoxColor(); FireMastary.setTextBoxColor(); Hydra.setTextBoxColor(); }
public MeteoEventArgs(Meteo meteo) { Meteo = meteo; }
public async Task <MeteoConditions> GetMeteoConditionsWithValuesAsync(Meteo meteo, bool allowCache = true) { return(await GetMeteoConditionsWithValuesAsync(meteo.Uuid, allowCache)); }
public void VerifyThatNewValuesForAnotherDayWereAdded() { Meteo.Temperature[] expectedNewDays = new Meteo.Temperature[] { new Meteo.Temperature { day = 1, tempMax = 10, tempMin = 0 }, new Meteo.Temperature { day = 2, tempMax = 9, tempMin = 2 }, new Meteo.Temperature { day = 3, tempMax = 12, tempMin = 0 }, new Meteo.Temperature { day = 4, tempMax = 13, tempMin = -3 }, new Meteo.Temperature { day = 5, tempMax = 10, tempMin = 2 }, new Meteo.Temperature { day = 6, tempMax = 15, tempMin = -1 }, new Meteo.Temperature { day = 7, tempMax = 15, tempMin = 2 }, new Meteo.Temperature { day = 8, tempMax = 7, tempMin = 0 }, new Meteo.Temperature { day = 9, tempMax = 6, tempMin = 0 }, new Meteo.Temperature { day = 10, tempMax = 12, tempMin = 2 }, new Meteo.Temperature { day = 11, tempMax = 6, tempMin = 1 }, new Meteo.Temperature { day = 12, tempMax = 13, tempMin = 0 }, new Meteo.Temperature { day = 13, tempMax = 13, tempMin = 0 }, new Meteo.Temperature { day = 14, tempMax = 11, tempMin = 1 }, new Meteo.Temperature { day = 15, tempMax = 9, tempMin = -3 }, new Meteo.Temperature { day = 16, tempMax = 8, tempMin = 0 }, new Meteo.Temperature { day = 17, tempMax = 6, tempMin = 2 }, new Meteo.Temperature { day = 18, tempMax = 12, tempMin = 2 }, new Meteo.Temperature { day = 19, tempMax = 7, tempMin = -3 }, new Meteo.Temperature { day = 20, tempMax = 10, tempMin = 0 }, new Meteo.Temperature { day = 21, tempMax = 13, tempMin = 1 }, new Meteo.Temperature { day = 22, tempMax = 6, tempMin = -2 }, new Meteo.Temperature { day = 23, tempMax = 13, tempMin = 2 }, new Meteo.Temperature { day = 24, tempMax = 10, tempMin = -1 }, new Meteo.Temperature { day = 25, tempMax = 15, tempMin = 0 }, new Meteo.Temperature { day = 26, tempMax = 8, tempMin = -2 }, new Meteo.Temperature { day = 27, tempMax = 6, tempMin = -3 }, new Meteo.Temperature { day = 28, tempMax = 9, tempMin = 1 }, new Meteo.Temperature { day = 29, tempMax = 10, tempMin = 0 }, new Meteo.Temperature { day = 30, tempMax = 11, tempMin = -1 }, new Meteo.Temperature { day = 31, tempMax = 18, tempMin = -4 } }; Meteo.Temperature[] newDays = Meteo.AddNewEntry(temp, 31, 18, -4); Assert.AreEqual(expectedNewDays.Length, newDays.Length); CollectionAssert.AreEqual(expectedNewDays, newDays); }
public Tennisspieler(string namen, string vornamen) : base(namen, vornamen) { Meteo.GetInstance().Register(this); }
public void Update() { #region Jour/Nuit if (heure >= 20 || heure <= 8) { phaseJournee = PhaseJournee.Nuit; } else { phaseJournee = PhaseJournee.Jour; } #endregion #region GestionHeure compteur++; if (compteur >= 60) { if (minute + 1 >= 60) { if (heure + 1 >= 24) { heure = 0; } else { heure++; } minute = 0; } else { minute++; } compteur = 0; } #endregion #region GestionIntensiteNuit if (phaseJournee == PhaseJournee.Nuit) { if (heure <= 4 || heure >= 20) { if (compteur == 0) if(ambient > 0.36f) ambient -= 0.01f; } else { if (compteur == 0) if(ambient < 1f) ambient += 0.01f; } } #endregion #region Meteo if (meteo == Meteo.Beau) { if (compteurmeteo == 0) { duree = new Random().Next(4000, 10000); } compteurmeteo++; if (compteurmeteo >= duree) { compteurmeteo = 0; int choix = new Random().Next(1, 3); if (choix == 1) { meteo = Meteo.Beau; } else if (choix == 2) { meteo = Meteo.Pluie; particularEngine.Active_Pluie(); } else { } } } else if (meteo == Meteo.Pluie) { if (compteurmeteo == 0) { duree = new Random().Next(4000, 10000); } compteurmeteo++; particularEngine.Update_Rain(hauteur, largeur); if (compteurmeteo >= duree) { compteurmeteo = 0; int choix = new Random().Next(1, 3); if (choix == 1) { meteo = Meteo.Beau; particularEngine.Desactive_Pluie(); } else if (choix == 2) { meteo = Meteo.Pluie; } else { } } } else { } #endregion }
private RadioManager() { musics = Seeder.GetMusics(); meteo = Meteo.GetData(); npcs = NPC.GetData(); }
public Surfer(string namen, string vornamen) : base(namen, vornamen) { Meteo.GetInstance().Register(this); }