WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
MainMenu.cs
Go to the documentation of this file.
1 using System;
2 using System.Windows.Forms;
3 
4 
5 namespace DirectOutput.Frontend
6 {
7  public partial class MainMenu : Form
8  {
9  private Pinball Pinball { get; set; }
10 
11 
12  private MainMenu(Pinball Pinball)
13  {
14 
15 
16  this.Pinball = Pinball;
17  InitializeComponent();
18 
19  Version V = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
20  DateTime BuildDate = new DateTime(2000, 1, 1).AddDays(V.Build).AddSeconds(V.Revision * 2);
21 
22  Version.Text = "Version {0} as of {1}".Build(V.ToString(), BuildDate.ToString("yyyy.MM.dd HH:mm"));
23 
24  TableName.Text = (Pinball.Table.TableName.IsNullOrWhiteSpace() ? "<No table name set>" : Pinball.Table.TableName);
25  TableFilename.Text = (Pinball.Table.TableFilename.IsNullOrWhiteSpace() ? "<No table file name set>" : Pinball.Table.TableFilename);
26  TableRomname.Text = (Pinball.Table.RomName.IsNullOrWhiteSpace() ? "<No rom name set>" : Pinball.Table.RomName);
27  DOFPath.Text = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory.FullName;
28 
29  GlobalConfigFilename.Text = (Pinball.GlobalConfig.GlobalConfigFilename.IsNullOrWhiteSpace() ? "<no global config file set>" : (Pinball.GlobalConfig.GetGlobalConfigFile().Exists ? Pinball.GlobalConfig.GlobalConfigFilename : "<no global config file found>"));
30 
31 
32  switch (Pinball.Table.ConfigurationSource)
33  {
34  case DirectOutput.Table.TableConfigSourceEnum.TableConfigurationFile:
35  TableConfigFilename.Text = Pinball.Table.TableConfigurationFilename;
36  break;
37  case DirectOutput.Table.TableConfigSourceEnum.IniFile:
38  TableConfigFilename.Text = "Table config parsed from LedControl file(s).";
39  break;
40  default:
41  TableConfigFilename.Text = "<no config file loaded>";
42  break;
43  }
44 
45 
46  if (Pinball.Cabinet.CabinetConfigurationFilename.IsNullOrWhiteSpace())
47  {
48  CabinetConfigFilename.Text = "<no config file loaded>";
49  }
50  else
51  {
52  CabinetConfigFilename.Text = Pinball.Cabinet.CabinetConfigurationFilename;
53  }
54 
55  }
56 
57 
58  public static void Open(Pinball Pinball, Form Owner=null)
59  {
60 
61 
62  foreach (Form F in Application.OpenForms)
63  {
64  if (F.GetType() == typeof(MainMenu))
65  {
66  F.BringToFront();
67  F.Focus();
68  return;
69  }
70  }
71 
72  MainMenu M = new MainMenu(Pinball);
73 
74  if (Owner == null)
75  {
76  M.Show();
77  }
78  else
79  {
80  M.StartPosition = FormStartPosition.CenterParent;
81  M.Show(Owner);
82  }
83  }
84 
85  private void ShowCabinetConfiguration_Click(object sender, EventArgs e)
86  {
87  foreach (Form F in Application.OpenForms)
88  {
89  if (F.GetType() == typeof(CabinetInfo))
90  {
91  F.BringToFront();
92  F.Focus();
93  return;
94  }
95  }
96  CabinetInfo CI = new CabinetInfo(Pinball.Cabinet);
97  CI.StartPosition = FormStartPosition.CenterParent;
98  CI.Show(this);
99 
100  }
101 
102  private void ShowTableConfiguration_Click(object sender, EventArgs e)
103  {
104  foreach (Form F in Application.OpenForms)
105  {
106  if (F.GetType() == typeof(TableInfo))
107  {
108  F.BringToFront();
109  F.Focus();
110  return;
111  }
112  }
113  TableInfo CI = new TableInfo(Pinball);
114  CI.StartPosition = FormStartPosition.CenterParent;
115  CI.Show(this);
116  }
117 
118 
119 
120 
121  private void button1_Click(object sender, EventArgs e)
122  {
123  foreach (Form F in Application.OpenForms)
124  {
125  if (F.GetType() == typeof(AvailableToysInfo))
126  {
127  F.BringToFront();
128  F.Focus();
129  return;
130  }
131  }
132  AvailableToysInfo CI = new AvailableToysInfo();
133  CI.StartPosition = FormStartPosition.CenterParent;
134  CI.Show(this);
135  }
136 
137  private void button2_Click(object sender, EventArgs e)
138  {
139  foreach (Form F in Application.OpenForms)
140  {
141  if (F.GetType() == typeof(AvailableEffectsInfo))
142  {
143  F.BringToFront();
144  F.Focus();
145  return;
146  }
147  }
148  AvailableEffectsInfo CI = new AvailableEffectsInfo();
149  CI.StartPosition = FormStartPosition.CenterParent;
150  CI.Show(this);
151  }
152 
153  //private void ShowSystemMonitor_Click(object sender, EventArgs e)
154  //{
155  // foreach (Form F in Application.OpenForms)
156  // {
157  // if (F.GetType() == typeof(SystemMonitor))
158  // {
159  // F.BringToFront();
160  // F.Focus();
161  // return;
162  // }
163  // }
164  // SystemMonitor CI = new SystemMonitor(Pinball);
165  // CI.StartPosition = FormStartPosition.CenterParent;
166  // CI.Show(this);
167  //}
168 
169 
170 
171 
172  }
173 }
GlobalConfig GlobalConfig
Gets the global config for the Pinnball object.
Definition: Pinball.cs:85
Pinball is the main object of the DirectOutput framework. It holds all objects required to process P...
Definition: Pinball.cs:23
Cabinet Cabinet
Gets or sets the Cabinet object for the Pinball object.
Definition: Pinball.cs:55
Table.Table Table
Gets or sets the table object for the Pinball object.
Definition: Pinball.cs:42
static void Open(Pinball Pinball, Form Owner=null)
Definition: MainMenu.cs:58
The Table namespace contains all table specific classes like the Table class itself, TableElement and effect assigment classes.
Definition: Table.cs:14