2 using System.Collections.Generic;
19 private bool OutputActive =
false;
22 InitializeComponent();
33 if (OCD.ShowDialog() == DialogResult.OK)
41 Pinball =
new Pinball();
59 Pinball.
Table.
TableElements.
Sort((TE1, TE2) => (TE1.TableElementType == TE2.TableElementType ? TE1.Number.CompareTo(TE2.Number) : TE1.TableElementType.CompareTo(TE2.TableElementType)));
61 TableElements.Rows.Clear();
65 int RowIndex = TableElements.Rows.Add();
66 TableElements.Rows[RowIndex].Tag = TE;
68 TableElements[TEName.Name, RowIndex].Value = (TE.
Name.IsNullOrWhiteSpace() ?
"" : TE.
Name);
69 TableElements[TENumber.Name, RowIndex].Value = TE.
Number;
70 TableElements[TEValue.Name, RowIndex].Value = TE.
Value;
71 TableElements[TEActivate.Name, RowIndex].Value = (TE.
Value > 0 ?
"Deactivate" :
"Activate");
72 TableElements[TEPulse.Name, RowIndex].Value = (TE.
Value > 0 ?
@"Pulse ¯\_/¯" :
@"Pulse _/¯\_");
81 private void ConfigTester_FormClosed(
object sender, FormClosedEventArgs e)
86 private void ConfigTester_FormClosing(
object sender, FormClosingEventArgs e)
96 private void ConfigTester_Load(
object sender, EventArgs e)
104 private void TableElements_CellClick(
object sender, DataGridViewCellEventArgs e)
107 if (e.ColumnIndex >= 0 && e.ColumnIndex < TableElements.ColumnCount)
109 if (e.RowIndex >= 0 && e.RowIndex < TableElements.RowCount)
111 if (TableElements.Columns[e.ColumnIndex].Name == TEActivate.Name)
114 int.TryParse(TableElements[TEValue.Name, e.RowIndex].Value.ToString(), out OrgValue);
115 int NewValue = (OrgValue > 0 ? 0 : 1);
116 TableElements[TEValue.Name, e.RowIndex].Value = NewValue;
118 else if (TableElements.Columns[e.ColumnIndex].Name == TEPulse.Name)
121 int.TryParse(TableElements[TEValue.Name, e.RowIndex].Value.ToString(),out OrgValue);
122 int PulseValue = (OrgValue > 0 ? 0 : 1);
124 TableElements[TEValue.Name, e.RowIndex].Value = PulseValue;
126 TableElements[TEValue.Name, e.RowIndex].Value = OrgValue;
132 private void TableElements_CellValueChanged(
object sender, DataGridViewCellEventArgs e)
134 if (e.ColumnIndex >= 0 && e.ColumnIndex < TableElements.ColumnCount)
136 if (e.RowIndex >= 0 && e.RowIndex < TableElements.RowCount)
138 if (TableElements.Columns[e.ColumnIndex].Name == TEValue.Name)
140 object Value = TableElements[TEValue.Name, e.RowIndex].Value;
141 int NumericValue = 0;
142 if (!
int.TryParse(Value.ToString(), out NumericValue))
144 MessageBox.Show(
"The value entered is not a valid number.\nWill set the value to 0.",
"Invalid value entered", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
145 TableElements[TEValue.Name, e.RowIndex].Value = 0;
153 D.
Value = NumericValue;
157 TableElements[TEActivate.Name, e.RowIndex].Value = (NumericValue > 0 ?
"Deactivate" :
"Activate");
158 TableElements[TEPulse.Name, e.RowIndex].Value = (NumericValue > 0 ?
@"Pulse ¯\_/¯" :
@"Pulse _/¯\_");
165 private void PulseDurationInput_ValueChanged(
object sender, EventArgs e)
170 private void ActivateAllButton_Click(
object sender, EventArgs e)
172 for (
int RowIndex = 0; RowIndex < TableElements.Rows.Count; RowIndex++)
174 TableElements[TEValue.Name, RowIndex].Value = 1;
178 private void DeactivateAllButton_Click(
object sender, EventArgs e)
180 for (
int RowIndex = 0; RowIndex < TableElements.Rows.Count; RowIndex++)
182 TableElements[TEValue.Name, RowIndex].Value = 0;
186 private void LoadConfigButton_Click(
object sender, EventArgs e)
191 private void ShowFrontEndButton_Click(
object sender, EventArgs e)
void Setup(string GlobalConfigFilename="", string TableFilename="", string RomName="")
Configures the Pinball object. Loads the global config, table config and cabinet config ...
int Number
Number of the TableElement.
void Sort()
Sorts the ExtList.
Pinball is the main object of the DirectOutput framework. It holds all objects required to process P...
Table.Table Table
Gets or sets the table object for the Pinball object.
int Value
The value of the table element.
void Finish()
Finishes the Pinball object.
static Settings LoadSettings()
string Name
Name of the TableElement. Triggers NameChanged if value is changed.
TableElementList TableElements
Lists the TableElement objects for the Table. This list is automaticaly extend with new TableElement...
Data representing the state of a table emlement
void Init()
Initializes/starts the Pinball object
void ReceiveData(char TableElementTypeChar, int Number, int Value)
Receives the table element data from the calling app (e.g. B2S.Server providing data through the plug...
void DisplayTableElements()
TableElementData GetTableElementData()
Gets a TableElementData object containing the current data for the TableElement.
string GlobalConfigFilename
static void Open(Pinball Pinball, Form Owner=null)
The Table namespace contains all table specific classes like the Table class itself, TableElement and effect assigment classes.
TableElementTypeEnum TableElementType
Type of the TableElement.
Represents a element (e.g. Switch, Solenoid) of a pinball table
int Value
Value of the TableElement. Triggers ValueChanged if the value is changed.