public MonitorRollback(BaseControlGroup currentPollutant, string currentStat) { InitializeComponent(); _bgc = currentPollutant; _currentStat = currentStat; _monitorRollbackLine = new MonitorModelRollbackLine(); }
public MonitorRollbackSettings2(string currentStat, MonitorModelRollbackLine MonitorModelRollbackLine) { InitializeComponent(); _currentStat = currentStat; _monitorRollbackLine = MonitorModelRollbackLine; _monitorRollbackLine.BenMAPRollbacks = new List <BenMAPRollback>(); _selectedRegions = new List <RowCol>(); }
private string AsyncUpdateMonitorRollbackData(string currentStat, MonitorModelRollbackLine monitorRollbackLine, out int threadId) { threadId = -1; string str = string.Empty; try { if (CommonClass.LstAsynchronizationStates == null) { CommonClass.LstAsynchronizationStates = new List <string>(); } lock (CommonClass.LstAsynchronizationStates) { str = string.Format("{0}{1}", monitorRollbackLine.Pollutant.PollutantName.ToLower(), currentStat); CommonClass.LstAsynchronizationStates.Add(str); if (currentStat != "") { CommonClass.CurrentMainFormStat = currentStat.Substring(0, 1).ToUpper() + currentStat.Substring(1) + " is being created."; } } lock (CommonClass.NodeAnscyStatus) { CommonClass.NodeAnscyStatus = string.Format("{0};{1};on", monitorRollbackLine.Pollutant.PollutantName.ToLower(), _currentStat); } switch (_currentStat) { case "baseline": RollBackDalgorithm.UpdateMonitorDataRollBack(ref _monitorRollbackLine); lock (CommonClass.LstBaseControlGroup) { foreach (BaseControlGroup bc in CommonClass.LstBaseControlGroup) { if (bc.Pollutant.PollutantID == _monitorRollbackLine.Pollutant.PollutantID) { _monitorRollbackLine.ShapeFile = _monitorRollbackLine.Pollutant.PollutantID + "G" + CommonClass.GBenMAPGrid.GridDefinitionID + "B" + _currentStat + ".shp"; string shipFile = string.Format("{0}\\Tmp\\{1}", CommonClass.DataFilePath, _monitorRollbackLine.ShapeFile); bc.Base = _monitorRollbackLine; DataSourceCommonClass.SaveBenMAPLineShapeFile(_monitorRollbackLine.GridType, _monitorRollbackLine.Pollutant, _monitorRollbackLine, shipFile); DataSourceCommonClass.CreateAQGFromBenMAPLine(bc.Base, saveAQGPath); bc.Base.ShapeFile = ""; } } } break; case "control": RollBackDalgorithm.UpdateMonitorDataRollBack(ref _monitorRollbackLine); lock (CommonClass.LstBaseControlGroup) { foreach (BaseControlGroup bc in CommonClass.LstBaseControlGroup) { if (bc.Pollutant.PollutantID == _monitorRollbackLine.Pollutant.PollutantID) { _monitorRollbackLine.ShapeFile = _monitorRollbackLine.Pollutant.PollutantID + "G" + CommonClass.GBenMAPGrid.GridDefinitionID + "C" + _currentStat + ".shp"; string shipFile = string.Format("{0}\\Tmp\\{1}", CommonClass.DataFilePath, _monitorRollbackLine.ShapeFile); bc.Control = _monitorRollbackLine; DataSourceCommonClass.SaveBenMAPLineShapeFile(_monitorRollbackLine.GridType, _monitorRollbackLine.Pollutant, _monitorRollbackLine, shipFile); DataSourceCommonClass.CreateAQGFromBenMAPLine(bc.Control, saveAQGPath); bc.Control.ShapeFile = ""; } } } break; } lock (CommonClass.LstAsynchronizationStates) { CommonClass.LstAsynchronizationStates.Remove(str); if (CommonClass.LstAsynchronizationStates.Count == 0) { CommonClass.CurrentMainFormStat = "Current Setup: " + CommonClass.MainSetup.SetupName; } } lock (CommonClass.NodeAnscyStatus) { CommonClass.NodeAnscyStatus = string.Format("{0};{1};off", monitorRollbackLine.Pollutant.PollutantName.ToLower(), _currentStat); } return(str); } catch (Exception ex) { Logger.LogError(ex); return(string.Empty); } }
private void btnNext_Click(object sender, EventArgs e) { try { if (cboRollbackGridType.SelectedIndex == -1) { MessageBox.Show("Please select rollback grid type first."); return; } if (tabControl1.SelectedIndex == 0) { if (cboMonitorDataSet.SelectedIndex == -1 || cboMonitorLibraryYear.SelectedIndex == -1) { MessageBox.Show("Please select monitor library year."); return; } _monitorRollbackLine.MonitorDirectType = 0; _monitorRollbackLine.MonitorDataSetID = Convert.ToInt32((cboMonitorDataSet.SelectedItem as DataRowView)["MonitorDataSetID"]); _monitorRollbackLine.MonitorLibraryYear = Convert.ToInt32((cboMonitorLibraryYear.SelectedItem as DataRowView)["Yyear"]); _strPath = "Monitor Rollback: libary"; } else if (tabControl1.SelectedIndex == 1) { if (txtMonitorDataFile.Text == "") { MessageBox.Show("Please select monitor data file."); return; } _monitorRollbackLine.MonitorDirectType = 1; _monitorRollbackLine.MonitorDataFilePath = txtMonitorDataFile.Text; _strPath = "Monitor Rollback: " + txtMonitorDataFile.Text; } _monitorRollbackLine.RollbackGrid = _monitorRollbackGrid; _monitorRollbackLine.GridType = CommonClass.GBenMAPGrid; _monitorRollbackLine.Pollutant = _bgc.Pollutant; MonitorRollbackSettings2 frm = new MonitorRollbackSettings2(_currentStat, _monitorRollbackLine); frm.Bgc = _bgc; DialogResult rtn = frm.ShowDialog(); if (rtn != DialogResult.OK) { return; } _monitorRollbackLine = frm._monitorRollbackLine; if (MonitorRollbackSettings3.MakeBaselineGrid == "F") { switch (_currentStat) { case "baseline": _bgc.Base = _monitorRollbackLine; break; case "control": _bgc.Control = _monitorRollbackLine; break; } } else { _bgc.Control = _monitorRollbackLine; } this.DialogResult = DialogResult.OK; } catch (Exception ex) { Logger.LogError(ex); } }