private void ReadSelectionsFromScenarioTable() { var scenarioTable = GetScenarioTable(); var checkBox = GetCheckBoxes(); string[] opModels = UrgsimUtilitycs.OperationModels(); foreach (GCM_CheckBox cb in checkBox) { cb.Checked = false; string projectionName = GetClimateProjectionName(cb); foreach (string om in opModels) { string sn = om + "/" + projectionName; var row = GetScenarioTableRowsByName(scenarioTable, sn); if (row.Checked) { cb.Checked = true; } } } // select operation models. var som = (from r in scenarioTable.AsEnumerable() where r.Checked && r.Name.IndexOf("/") > 0 select r.Name.Substring(0, r.Name.IndexOf("/"))).Distinct().ToArray(); opModelSelector.SelectModels(som); }
public void SaveChanges() { var scenarioTable = GetScenarioTable(); var checkBox = GetCheckBoxes(); var som = opModelSelector.SelectedOperationModels(); if (!ValidateModelSelection()) { return; } string[] opModels = UrgsimUtilitycs.OperationModels(); foreach (GCM_CheckBox cb in checkBox) { foreach (string om in opModels) { string scenarioName = om + "/" + GetClimateProjectionName(cb); var row = GetScenarioTableRowsByName(scenarioTable, scenarioName); bool ck = (cb.Checked && Array.IndexOf(som, om) >= 0); row.Checked = ck; } } SaveScenarioTable(scenarioTable); }
private void AddURGSIM_Click(object sender, EventArgs e) { if (!DB.DeleteFolderByName("URGSiM", CurrentFolder, true)) { return; } DB.SuspendTreeUpdates(); ShowAsBusy("Reading URGSiM projections and variables"); UrgsimUtilitycs.CreateTree(DB, CurrentFolder); UrgsimUtilitycs.LoadScenarioTable(DB); SetupScenarioSelector(); DatabaseChanged(); ShowAsReady("Done with URGSiM import"); DB.ResumeTreeUpdates(); }