private void OkButton_Click(object sender, EventArgs e) { if (xtriggersDataGridView.Rows.Count > 1) { DisplayedXTriggers = new List<XTrigger>(); foreach (DataGridViewRow row in xtriggersDataGridView.Rows) { if (string.IsNullOrEmpty(row.Cells[0].Value as string)) { continue; } XTrigger xtrigger = new XTrigger() { id = row.Cells[0].Value as string, chance = Convert.ToInt32(row.Cells[1].Value) > 0 ? Convert.ToInt32(row.Cells[1].Value) : (int?)null, level = Convert.ToInt32(row.Cells[2].Value) > 0 ? Convert.ToInt32(row.Cells[2].Value) : (int?)null, morpheffect = row.Cells[3].Value as string }; // row.Cells[0] -> id // row.Cells[1] -> chance // row.Cells[2] -> level // row.Cells[3] -> morphEffect DisplayedXTriggers.Add(xtrigger); } } Close(); }
private void okButton_Click(object sender, EventArgs e) { if (xtriggersDataGridView.Rows.Count > 1) { displayedXTriggers = new List <XTrigger>(); foreach (DataGridViewRow row in xtriggersDataGridView.Rows) { if (row.Cells[0].Value as string == null || row.Cells[0].Value as string == "") { continue; } XTrigger xtrigger = new XTrigger() { id = row.Cells[0].Value as string, chance = row.Cells[1].Value as int?, level = row.Cells[2].Value as int?, morphEffect = row.Cells[3].Value as string }; // row.Cells[0] -> id // row.Cells[1] -> chance // row.Cells[2] -> level // row.Cells[3] -> morphEffect displayedXTriggers.Add(xtrigger); } } Close(); }
/// <summary>Writes documentation for this function by adding to the list of documentation tags.</summary> /// <param name="tags">The list of tags to add to.</param> /// <param name="headingLevel">The level (e.g. H2) of the headings.</param> /// <param name="indent">The level of indentation 1, 2, 3 etc.</param> public override void Document(List <AutoDocumentation.ITag> tags, int headingLevel, int indent) { // write memos. foreach (IModel memo in Apsim.Children(this, typeof(Memo))) { memo.Document(tags, -1, indent); } // get description and units. string description = AutoDocumentation.GetDescription(Parent, Name); if (description != string.Empty) { tags.Add(new AutoDocumentation.Paragraph(description, indent)); } tags.Add(new AutoDocumentation.Paragraph("<i>" + Name + "</i> is calculated as a function of <i>" + StringUtilities.RemoveTrailingString(XProperty, ".Value()") + "</i>", indent)); tags.Add(new AutoDocumentation.Paragraph("<i>Trigger value" + XTrigger.ToString() + " Gradient " + Slope.ToString() + "</i>", indent)); }
/// <summary>Writes documentation for this function by adding to the list of documentation tags.</summary> /// <param name="tags">The list of tags to add to.</param> /// <param name="headingLevel">The level (e.g. H2) of the headings.</param> /// <param name="indent">The level of indentation 1, 2, 3 etc.</param> public void Document(List <AutoDocumentation.ITag> tags, int headingLevel, int indent) { if (IncludeInDocumentation) { // write memos. foreach (IModel memo in this.FindAllChildren <Memo>()) { AutoDocumentation.DocumentModel(memo, tags, headingLevel + 1, indent); } // get description and units. string description = AutoDocumentation.GetDescription(Parent, Name); if (description != string.Empty) { tags.Add(new AutoDocumentation.Paragraph(description, indent)); } tags.Add(new AutoDocumentation.Paragraph("<i>" + Name + "</i> is calculated as a function of <i>" + StringUtilities.RemoveTrailingString(XProperty, ".Value()") + "</i>", indent)); tags.Add(new AutoDocumentation.Paragraph("<i>Trigger value" + XTrigger.ToString() + " Gradient " + Slope.ToString() + "</i>", indent)); } }