using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FCC_Uber_MDX_Configurator { public partial class COM_Setup_Executable_CommandForm : Form { public GlobalStaticClass.COM_Execution_Object_Class.COM_Execution_Object_Command_IDs_Class _command; public GlobalStaticClass.COM_Execution_Object_Class _ExecClass; public COM_Setup_Executable_CommandForm(ref GlobalStaticClass.COM_Execution_Object_Class input_ExecClass) { _ExecClass = input_ExecClass; SetupForm(); } public COM_Setup_Executable_CommandForm(ref GlobalStaticClass.COM_Execution_Object_Class input_ExecClass, GlobalStaticClass.COM_Execution_Object_Class.COM_Execution_Object_Command_IDs_Class input_command) { _ExecClass = input_ExecClass; _command = input_command; SetupForm(); TXT_ID.Text = _command.internal_Command; TXT_EXTERNAL_ID.Text = _command.external_Command; TXT_PARAMETERS.Text = ""; int i = 0; foreach (GlobalStaticClass.COM_Execution_Object_Class.COM_External_Executable_Parameter_Class _p in _command.external_Command_Parameters) { TXT_PARAMETERS.Text += _p._param; i++; if (i < _command.external_Command_Parameters.Count) { TXT_PARAMETERS.Text += ","; } } } private void SetupForm() { InitializeComponent(); } private void BTN_SAVE_Click(object sender, EventArgs e) { string _internalID = TXT_ID.Text, _externalID = TXT_EXTERNAL_ID.Text; if (_internalID == "" || _externalID == "") { (new ErrorForm("Invalid ID", "You must enter a value for the Command's IDs")).ShowDialog(); return; } string[] _params = TXT_PARAMETERS.Text.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries); List _pList = new List(); for(int i = 0; i < _params.Length; i++) { _pList.Add(new GlobalStaticClass.COM_Execution_Object_Class.COM_External_Executable_Parameter_Class(i, _params[i])); } if (_command == null) { _command = new GlobalStaticClass.COM_Execution_Object_Class.COM_Execution_Object_Command_IDs_Class(_externalID, _internalID, _pList); _ExecClass.COM_Commands.Add(_command); } else { int _index = _ExecClass.COM_Commands.IndexOf(_command); _ExecClass.COM_Commands[_index] = new GlobalStaticClass.COM_Execution_Object_Class.COM_Execution_Object_Command_IDs_Class(_externalID, _internalID, _pList); } this.DialogResult = DialogResult.OK; } private void BTN_CANCEL_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } } }