private void InitData() { // Task 1 _weatherController = new WeatherController(_weatherFiles); _sunConditionController = new SunConditionController(System.IO.Path.GetFullPath(_sunFile)); MeteorogicalAnalysisView.Init(_weatherController, _sunConditionController); Calculate(); MeteorogicalAnalysisView.TimePeriodChanged += Calculate; }
private void SaveMenuItem_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "Збереження"; saveFileDialog.FileName = "Звіт"; saveFileDialog.DefaultExt = ".docx"; saveFileDialog.Filter = "Word files (.doc)|*.docx"; saveFileDialog.InitialDirectory = Environment.CurrentDirectory + @"\saves"; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ReportController reportController = new ReportController { WeatherController = _weatherController, SunConditionController = _sunConditionController, DeviceController = _deviceController, DeviceOpt2Controller = ElectricalLoadScheduleView.OptimizationView.Device2ZoneOptController, DeviceOpt3Controller = ElectricalLoadScheduleView.OptimizationView.Device3ZoneOptController, HouseController = _houseController, WindEnergyController = _windEnergyController, HeatPumpController = _heatPumpController, HeatStoreController = _heatStoreController }; reportController.CopyData(); reportController.Report.ImgDirectory = _imagesDirectory; MeteorogicalAnalysisView.SaveCharts(_weatherChartPaths); reportController.Report.Weather.ImgPaths = _weatherChartPaths; ElectricalLoadScheduleView.SaveCharts(_elLoadChartPaths, _elLoadOpt2ChartPaths, _elLoadOpt3ChartPaths); reportController.Report.ElectricalLoadSchedule.ImgPaths = _elLoadChartPaths; reportController.Report.Opt2ElectricalLoadSchedule.ImgPaths = _elLoadOpt2ChartPaths; reportController.Report.Opt3ElectricalLoadSchedule.ImgPaths = _elLoadOpt3ChartPaths; reportController.Report.ThermalEnergy.CommonImgPaths = _commonHeatingPaths; reportController.Report.ThermalEnergy.IndividualImgPaths = _individualHeatingPaths; ThermalEnergy.SaveCharts(_commonHeatingPaths, _individualHeatingPaths); reportController.Report.Wind.ImgPaths = _windEnergyPaths; WindEnergyView.SaveCharts(_windEnergyPaths); reportController.Report.HeatPump.ImgPaths = _heatPumpPaths; HeatPumpView.SaveCharts(_heatPumpPaths); reportController.Report.HeatStore.ImgPaths = _heatStorePaths; HeatStoreView.SaveCharts(_heatStorePaths); ReportWordController reportWordController = new ReportWordController { Report = reportController.Report }; string path = System.IO.Path.GetFullPath(saveFileDialog.FileName); ProgressBarWindow progressBarWindow = new ProgressBarWindow(reportWordController, path); progressBarWindow.Show(); } }
private void ChooseData() { FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.Description = "Виберіть каталог метеорологічних даних регіону"; folderDialog.SelectedPath = @"киев+\"; if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = folderDialog.SelectedPath; List <string> files = Directory.GetFiles(path, "*.xlsx").ToList(); for (int i = 0; i < files.Count; i++) { files[i] = files[i].Replace(Directory.GetCurrentDirectory(), ".").Replace(".xlsx", ""); } _sunFile = files.Last(x => x.Contains("soldata")); files.Remove(_sunFile); files.Sort(); _weatherFiles = files; ConvertProgressBarWindow progressBarWindow = new ConvertProgressBarWindow(_weatherFiles, _sunFile); progressBarWindow.Show(); Pathes pathes = new Pathes { SunFile = _sunFile, WeatherFiles = _weatherFiles }; BinaryController.WriteDataToBinary(_fileSource, new List <Pathes> { pathes }); MeteorogicalAnalysisView.TimePeriodChanged -= Calculate; //InitData(); // Task 1 _weatherController = new WeatherController(_weatherFiles); //_weatherController.CorrectWeather(); _sunConditionController = new SunConditionController(System.IO.Path.GetFullPath(_sunFile)); //_sunConditionController.CorrectData(_weatherController.Year); MeteorogicalAnalysisView.Init(_weatherController, _sunConditionController); Calculate(); MeteorogicalAnalysisView.TimePeriodChanged += Calculate; } else { Close(); } }