public TestOptionsClass EditToData() { TestOptionsClass to = new TestOptionsClass(); to.manualTreshold = ckFixTreshold.Checked; double mt = StaticFunctionsClass.ToDoubleDef(txtManualTreshold.Text, -1); if (mt <= 0) { ckFixTreshold.Checked = false; txtManualTreshold.Text = "1.0"; to.treshold = 1.0; } else { txtManualTreshold.Text = mt.ToString(); to.treshold = mt; } to.minBoardNr = (int)nmMinBoard.Value; to.maxBoardNr = (int)nmMaxBoard.Value; to.signalA = ckSignalA.Checked; to.signalB = ckSignalB.Checked; return(to); }
public void SetDelay(string delay) { DelayStr = delay.StartsWith("/") ? $@"1{delay}" : delay; if (DelayStr.Contains("/")) { string[] zt = DelayStr.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); int z = StaticFunctionsClass.ToIntDef(zt[0], 0); int t = StaticFunctionsClass.ToIntDef(zt[1], 1); Delay = RefDelay * (((double)z) / ((double)t)); } else if (!string.IsNullOrEmpty(DelayStr)) { double dl = StaticFunctionsClass.ToDoubleDef(DelayStr, 1); Delay = RefDelay * dl; } else { Delay = 1; } Delay *= Statics.NoteDelayFactor; }
public static double GetNoteLength(string noteatt, double unitlength) { int inxsplit = noteatt.IndexOf(Divider); double notelength = 0; if (inxsplit < 0) { notelength = StaticFunctionsClass.ToDoubleDef(noteatt, 0); } else if (inxsplit == 0) { notelength = 1.0 / StaticFunctionsClass.ToIntDef(noteatt.Substring(1), 1); } else { string ddstr = noteatt.Substring(0, inxsplit); string ddstr2 = noteatt.Substring(inxsplit + 1); double d1 = StaticFunctionsClass.ToDoubleDef(ddstr, 1); double d2 = StaticFunctionsClass.ToDoubleDef(ddstr2, 1); notelength = d1 / d2; } return(notelength * unitlength); }
private void button3_Click(object sender, EventArgs e) { float z = (float)StaticFunctionsClass.ToDoubleDef(textBox1.Text, 1.0); DatabaseDesignForm.Instance().SetZoom(z); }