private void UpdateProcessInfoDisplay(ProcessInfo Info) { txtDesc.Text = Info.ProcessDescription; DataTable InOutData = new DataTable(); InOutData.Columns.Add("Index"); InOutData.Columns.Add("Sensor"); InOutData.Columns.Add("Actuator"); for (int i = 1; i <= 16; i++) { InOutData.Rows.Add(i, (Info.Sensors[i-1] != null ? Info.Sensors[i-1].SensorRole : "" ), ( Info.Actuators[i-1] != null ? Info.Actuators[i-1].ActuatorRole : "")); ((Button)(groupIOActuators.Controls.Find(String.Format("btnDA{0}", i), true).FirstOrDefault())).Visible = Info.Actuators[i - 1] != null; ((Button)(groupIOSensors.Controls.Find(String.Format("btnDS{0}", i), true).FirstOrDefault())).Visible = Info.Sensors[i - 1] != null; } dataGridInOutVal.DataSource = InOutData; dataGridInOutVal.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
private ProcessInfo GetProcessInfo() { movieInfo = new ProcessInfo(); string ProcessDescription = ""; int ProcessDescriptionIndex = 0; string SensorDescription = ""; int SensorDescriptionIndex = 1; string ActuatorDescription = ""; int ActuatorDescriptionIndex = 1; movieInfo.ProcessDescription = axShockwaveFlash1.GetVariable("EprgName"); //We are going to iterate through the process description variables until we hit and empty one do { //I'm not much for Hungarian, but this means English Program Description ProcessDescription = axShockwaveFlash1.GetVariable(String.Format("EprgLeiras{0}", ProcessDescriptionIndex > 0 ? ProcessDescriptionIndex.ToString() : "")); movieInfo.ProcessDescription += " " + ProcessDescription; ProcessDescriptionIndex++; } while (ProcessDescription != "" && ProcessDescriptionIndex <= 10 ); //Keep up the show for Actuators and Outputs do { SensorDescription = axShockwaveFlash1.GetVariable(String.Format("EDigSens{0}", SensorDescriptionIndex)); if ( SensorDescription != "" ) movieInfo.Sensors[SensorDescriptionIndex-1] = new DigitalSensor(SensorDescription, SensorDescriptionIndex); SensorDescriptionIndex++; } while (SensorDescription != "" && SensorDescriptionIndex <= 16); do { ActuatorDescription = axShockwaveFlash1.GetVariable(String.Format("EDigAct{0}", ActuatorDescriptionIndex)); if (ActuatorDescription != "" ) movieInfo.Actuators[ActuatorDescriptionIndex-1] = new DigitalActuator(ActuatorDescription, ActuatorDescriptionIndex); ActuatorDescriptionIndex++; } while (ActuatorDescription != "" && ActuatorDescriptionIndex <= 16); return movieInfo; }