private async void SerialProgrammerFunc() { _serialProgrammerStarted = true; cancellationTokenSerialProgrammer = new CancellationToken(false); try { await Task.Run(() => SerialProgrammer.GetInstance.SerialProgrammerProcess()); } catch { } SerialProgrammerCheck = false; _serialProgrammerStarted = false; _serial_programmer_parameters.Write("Firmware Path", pathFWtemp, "Programmer"); _serial_programmer_parameters.Write("FlashBaud", FlashBaudRate, "Programmer"); }
private void saveWizardParams() { string path = "\\MotorController\\Wizard\\"; path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + path; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string _file_name = "WizardParameters.ini"; iniFile _wizard_parameters_file = new iniFile(path + _file_name); string _section = "Wizard"; #region Save_Parameters _wizard_parameters_file.Write("Motor Type", MotorType, _section); #endregion Save_Parameters #region Advanced_Configuration #endregion Advanced_Configuration for (int i = 0; i < GetInstance.OperationList.Count; i++) { if (GetInstance.OperationList.ElementAt(i).Value.CommandName != "Load Default" && GetInstance.OperationList.ElementAt(i).Value.CommandName != "Save" && GetInstance.OperationList.ElementAt(i).Value.CommandName != "Reset" && GetInstance.OperationList.ElementAt(i).Value.CommandName != "Synchronisation Command") { _wizard_parameters_file.Write(GetInstance.OperationList.ElementAt(i).Value.CommandName, GetInstance.OperationList.ElementAt(i).Value.CommandValue, _section); } } for (int i = 0; i < GetInstance.OperationList.Count; i++) { if (GetInstance.OperationList.ElementAt(i).Value.CommandName != "Load Default" && GetInstance.OperationList.ElementAt(i).Value.CommandName != "Save" && GetInstance.OperationList.ElementAt(i).Value.CommandName != "Reset" && GetInstance.OperationList.ElementAt(i).Value.CommandName != "Synchronisation Command") { Debug.WriteLine(GetInstance.OperationList.ElementAt(i).Value.CommandName + ": " + _wizard_parameters_file.Read(GetInstance.OperationList.ElementAt(i).Value.CommandName, _section)); } } }
private void saveSettings(string flag1, string flag2) { iF_S = new iniFile(gVars.ovs_local); data = ""; i1 = 0; i2 = 0; if (flag1 == "singular") { if (flag2 == "mlaser_ids") { foreach (GroupBox gb1 in gBoxes) { foreach (GroupBox gb2 in gb1.Controls) { foreach (Control con in gb2.Controls) { if (con is TextBox) { if (i1 == 1) { data = data + "-" + con.Text; } else { data = data + con.Text; i1++; } } } if (i2 < gb2.Controls.Count) { data = data + ","; i1 = 0; i2++; } if (i2 == gb2.Controls.Count) { data = data + ";"; i2 = 0; } } } MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //iF_S.Write("mlidrstr", data, "itemid"); } else if (flag2 == "ship_ids") { //Reform the ID string from group box elements foreach (GroupBox gb in gBoxes) { foreach (Control con in gb.Controls) { if (con is TextBox) { if (i1 == 1) { data = data + "-" + con.Text; } else { data = data + con.Text; i1++; } } } if (i2 < gb.Controls.Count) { data = data + ","; i1 = 0; i2++; } } //MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); iF_S.Write("sidrstr", data, "itemid"); } else if (flag2 == "sship_ids") { //Reform the ID string from group box elements foreach (GroupBox gb in gBoxes) { foreach (Control con in gb.Controls) { if (con is TextBox) { if (i1 == 1) { data = data + "-" + con.Text; } else { data = data + con.Text; i1 += 1; } } } } //MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); iF_S.Write("ssrstr", data, "itemid"); } else if (flag2 == "weap_ids") { foreach (GroupBox gb1 in gBoxes) { foreach (GroupBox gb2 in gb1.Controls) { foreach (Control con in gb2.Controls) { if (con is TextBox) { if (i1 == 1) { data = data + "-" + con.Text; } else { data = data + con.Text; i1++; } } } if (i2 < gb2.Controls.Count) { data = data + ","; i1 = 0; i2++; } if (i2 == gb2.Controls.Count) { data = data + ";"; i2 = 0; } } } MessageBox.Show(null, data, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //iF_S.Write("widrstr", data, "itemid"); } } else if (flag1 == "compact") { if (flag2 == "mlaser_ids") { iF_S.Write("mlidrstr", tb_SESC_C.Text, "itemid"); } else if (flag2 == "ship_ids") { iF_S.Write("sidrstr", tb_SESC_C.Text, "itemid"); } else if (flag2 == "sship_ids") { iF_S.Write("ssrstr", tb_SESC_C.Text, "itemid"); } if (flag2 == "weap_ids") { iF_S.Write("widrstr", tb_SESC_C.Text, "itemid"); } } }