Esempio n. 1
0
        private void TableElements_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0 && e.ColumnIndex < TableElements.ColumnCount)
            {
                if (e.RowIndex >= 0 && e.RowIndex < TableElements.RowCount)
                {
                    if (TableElements.Columns[e.ColumnIndex].Name == TEValue.Name)
                    {
                        object Value        = TableElements[TEValue.Name, e.RowIndex].Value;
                        int    NumericValue = 0;
                        if (!int.TryParse(Value.ToString(), out NumericValue))
                        {
                            MessageBox.Show("The value entered is not a valid number.\nWill set the value to 0.", "Invalid value entered", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            TableElements[TEValue.Name, e.RowIndex].Value = 0;
                            NumericValue = 0;
                        }
                        if (OutputActive)
                        {
                            TableElement TE = (TableElement)TableElements.Rows[e.RowIndex].Tag;

                            TableElementData D = TE.GetTableElementData();
                            D.Value = NumericValue;
                            Pinball.ReceiveData(D);
                        }

                        TableElements[TEActivate.Name, e.RowIndex].Value = (NumericValue > 0 ? "Deactivate" : "Activate");
                        TableElements[TEPulse.Name, e.RowIndex].Value    = (NumericValue > 0 ? @"Pulse ¯\_/¯" : @"Pulse _/¯\_");
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// This method is called, when Hyperpin sends new data to DirectOutput.<br/>
 /// HyperPin does only send a IDNumber and a value. These values are fed to DirectOutput as updates on EMTable elements (TableElementType character E).<br/>
 /// The IHyperpinPlugin interface requires the implementation of this method.
 /// </summary>
 /// <param name="Number">The received IdNumber.</param>
 /// <param name="Value">The received value.</param>
 public void DataReceive(int Number, int Value)
 {
     Pinball.ReceiveData('E', Number, Value);
 }
Esempio n. 3
0
 /// <summary>
 /// This method is called, when the hosting application sends new data to DirectOutput.<br />
 /// The IPlugin interface requires the implementation of this method.<br/>
 /// </summary>
 /// <param name="TableElementTypeChar">Char identifying the type of the table element. For a list of valid char, check to docu on the TableElementTypeEnum in DirectOutput.</param>
 /// <param name="Number">The received Number.</param>
 /// <param name="Value">The received value.</param>
 public void DataReceive(char TableElementTypeChar, int Number, int Value)
 {
     Pinball.ReceiveData(TableElementTypeChar, Number, Value);
 }