private void HourTimer_Tick(object sender, EventArgs e) { HourTicks++; Weather.WeatherData weatherData = new Weather.WeatherData(InitialDate.AddHours(HourTicks)); weatherData = Weather.generateWeather(weatherData.TimeStamp); Home.HourlyDataList.Add(FlowManager.work(weatherData)); Home.calculate(); updateLabels(Home.HourlyDataList.Last <HourlyData>(), weatherData); }
private void MainWindow_Load(object sender, EventArgs e) { SecondTimer.Enabled = true; HourTimer.Enabled = true; lblTime.Text = $"Czas: {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}"; Weather.WeatherData weatherData = new Weather.WeatherData(InitialDate); weatherData = Weather.generateWeather(weatherData.TimeStamp); Home.HourlyDataList.Add(FlowManager.work(weatherData)); Home.calculate(); updateLabels(Home.HourlyDataList.Last <HourlyData>(), weatherData); }
private void btnMatrix_Click(object sender, EventArgs e) { Matrix matrix = new Matrix(); DialogResult dialogResult = matrix.ShowDialog(); if (dialogResult == DialogResult.OK) { Settings.isMatrixOn = true; SecondTimer.Enabled = true; HourTimer.Enabled = true; PowerCell.MaxCharge = Settings.maxStoredPower; PowerCell.MaxChargingSpeed = Settings.maxChargePower; PowerCell.MaxUsageCharge = Settings.maxUsagePower; setHourTimer(Settings.SimSpeed); Home.HourlyDataList.Clear(); lblSimulation.Visible = true; lblSimulation.Text = $"Symulacja od: {Settings.weatherDatas.First().TimeStamp.ToShortDateString()}"; lblTime.Text = $"Czas: {DateTime.Now.AddDays((Settings.weatherDatas.Last().TimeStamp - DateTime.Now).TotalDays).ToShortDateString()} {DateTime.Now.ToLongTimeString()}"; foreach (Weather.WeatherData weatherData in Settings.weatherDatas) { Home.HourlyDataList.Add(FlowManager.work(weatherData)); Home.calculate(); updateLabels(Home.HourlyDataList.Last <HourlyData>(), weatherData); } } else if (dialogResult == DialogResult.Abort) { lblSimulation.Visible = false; Home.HourlyDataList.Clear(); lblTime.Text = $"Czas: {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}"; Weather.WeatherData weatherData = new Weather.WeatherData(InitialDate); weatherData = Weather.generateWeather(weatherData.TimeStamp); Home.HourlyDataList.Add(FlowManager.work(weatherData)); Home.calculate(); updateLabels(Home.HourlyDataList.Last <HourlyData>(), weatherData); } }