private void OKBtn_Click(object sender, EventArgs e) { result = new string[3] { SongNameBox.Text, AuthorBox.Text, "nochange" }; try { List <Notedata.TimeSigChange> timesigs = new List <Notedata.TimeSigChange>(); foreach (DataGridViewRow row in TimesigsGrid.Rows) //DataGridViewRowCollection { try { Notedata.TimeSigChange sig = new Notedata.TimeSigChange { StartBar = int.Parse(row.Cells[0].Value.ToString()), StartTick = int.Parse(row.Cells[1].Value.ToString()), Numerator = int.Parse(row.Cells[2].Value.ToString()), Denominator = int.Parse(row.Cells[3].Value.ToString()) }; timesigs.Add(sig); } catch { } } result[2] = Notedata.MakeTimesigChangesString(timesigs.ToArray()); } catch { result[2] = "nochange"; // don't change if not valid } this.Close(); }
public ChartInfoDialog(Skinning.Skin skin, string songname, string author, string timesigs) { InitComponentNew(); Skinning.SetBackCol(this, skin.UIColours[UIColours.UIColourDefs.Form_BG.TypeName]); Skinning.SetForeCol(this, skin.UIColours[UIColours.UIColourDefs.Form_Text.TypeName]); Skinning.SetUIStyle(this, skin.UIStyle); TimesigsGrid.DefaultCellStyle.ForeColor = SystemColors.ControlText; // reset these because they inherit incorrectly TimesigsGrid.DefaultCellStyle.BackColor = SystemColors.Window; SongNameBox.Text = songname; AuthorBox.Text = author; Notedata.TimeSigChange[] timesigsconverted = Notedata.ReadTimesigChangesFromString(timesigs); if (timesigsconverted != null) { foreach (Notedata.TimeSigChange sig in timesigsconverted) { TimesigsGrid.Rows.Add(new object[] { sig.StartBar, sig.StartTick, sig.Numerator, sig.Denominator }); } } }