private void ButtonRecipe_Click(object sender, EventArgs e) { // use Btn sender to parse through control lists string txt = ((Button)sender).Name; int index; if (txt.Length == 8) { index = int.Parse(txt.Substring(txt.Length - 1)) - 1; } else { index = int.Parse(txt.Substring(txt.Length - 2)) - 1; } var form = new RecipeEditor <CCRecipe>(BQConn, new CCRecipe(), _samples[index].Text); form.ShowDialog(); _ccRecipe = form.CurrentRecipe; if (_ccRecipe.SampleName != null) { Properties.Settings.Default.Samples[index] = _ccRecipe.SampleName; Properties.Settings.Default.Save(); _samples[index].Text = _ccRecipe.SampleName; _cycleLabels[index].Text = _ccRecipe.CycleNumber.ToString(); _numCells[index].Text = _ccRecipe.NumCells.ToString(); _voc[index].Text = _ccRecipe.CellVoc.ToString(); _tempSensors[index].Text = _ccRecipe.TempSensor.ToString(); _setCurrents[index].Text = _ccRecipe.SetCurrent.ToString(); } }
private void ButtonRecipe_Click(object sender, EventArgs e) { // use Btn sender to parse through control lists string txt = ((Button)sender).Name; int index; if (txt.Length == 8) { index = int.Parse(txt.Substring(txt.Length - 1)) - 1; } else { index = int.Parse(txt.Substring(txt.Length - 2)) - 1; } var form = new RecipeEditor <CCRecipe>(BQConn, new CCRecipe(), _samples[index].Text); form.ShowDialog(); _ccRecipe = form.CurrentRecipe; // set CurrentRecipe values to port GUI values if (_ccRecipe.SampleName != null) { Properties.Settings.Default.Samples[index] = _ccRecipe.SampleName; Properties.Settings.Default.Save(); _samples[index].Text = _ccRecipe.SampleName; _cycleLabels[index].Text = _ccRecipe.CycleNumber.ToString(); _numCells[index].Text = _ccRecipe.NumCells.ToString(); _voc[index].Text = _ccRecipe.CellVoc.ToString(); _tempSensors[index].Text = _ccRecipe.TempSensor.ToString(); _setCurrents[index].Text = _ccRecipe.SetCurrent.ToString(); var samplePath = U.CCDataDir + _ccRecipe.SampleName + "\\"; // if new sample create directory for it to reference later for local recipes if (!Directory.Exists(samplePath)) { Directory.CreateDirectory(samplePath); } } }