internal static void Hide() { Form.Hide(); Form.Dispose(); Form = null; }
private static void Form_FormClosing(object sender, FormClosingEventArgs e) { SongPlayer.Stop(); Timer.Change(-1, -1); Timer.Dispose(); Form = null; Power.Reset(); }
internal static void Show() { Power.AlwaysOn(); Form = new SongForm(); Form.Text = Song.Name + " - Midi Hero v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(2); Form.SpeedLabel.Text = "Speed: " + SongPlayer.Speed.ToString("P0"); Form.FormClosing += Form_FormClosing; Form.PlayButton.Click += PlayButton_Click; Form.PauseButton.Click += PauseButton_Click; Form.RestartButton.Click += RestartButton_Click; Form.IncreaseSpeedButton.Click += IncreaseSpeedButton_Click; Form.DecreaseSpeedButton.Click += DecreaseSpeedButton_Click; Form.Show(); Panels = new Panel[Guitar.Tuning.Length, 24]; for (var x = 0; x < Guitar.Tuning.Length; x++) { for (var y = 0; y < 24; y++) { var panel = new Panel(); panel.Location = new Point(y == 0 ? 32 : (y * 40) + 16, (x * 32) + 280); panel.Size = new Size(y == 0 ? 16 : 39, 31); panel.BackColor = Frets[y]; Form.Controls.Add(panel); Panels[x, y] = panel; } } Next = 0; Timer = new System.Threading.Timer(Timer_Callback, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10)); }
internal static void Show() { Power.AlwaysOn(); Form = new SongForm(); Form.Text = Song.Name + " - Midi Hero v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(2); Form.SpeedLabel.Text = "Speed: " + SongPlayer.Speed.ToString("P0"); Form.FormClosing += Form_FormClosing; Form.PlayButton.Click += PlayButton_Click; Form.PauseButton.Click += PauseButton_Click; Form.RestartButton.Click += RestartButton_Click; Form.IncreaseSpeedButton.Click += IncreaseSpeedButton_Click; Form.DecreaseSpeedButton.Click += DecreaseSpeedButton_Click; Form.Show(); Panels = new Panel[88]; var panels = new List <Panel>(); for (var x = 0; x < Panels.Length; x++) { var panel = new Panel(); var key = x % 12; var octave = x / 12; switch (key) { case 0: panel.Location = new Point(20 + (octave * 140) + 0, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 1: panel.Location = new Point(20 + (octave * 140) + 13, 280); panel.Size = new Size(13, 55); panel.BackColor = Color.DarkGray; Form.Controls.Add(panel); break; case 2: panel.Location = new Point(20 + (octave * 140) + 20, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 3: panel.Location = new Point(20 + (octave * 140) + 40, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 4: panel.Location = new Point(20 + (octave * 140) + 53, 280); panel.Size = new Size(13, 55); panel.BackColor = Color.DarkGray; Form.Controls.Add(panel); break; case 5: panel.Location = new Point(20 + (octave * 140) + 60, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 6: panel.Location = new Point(20 + (octave * 140) + 73, 280); panel.Size = new Size(13, 55); panel.BackColor = Color.DarkGray; Form.Controls.Add(panel); break; case 7: panel.Location = new Point(20 + (octave * 140) + 80, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 8: panel.Location = new Point(20 + (octave * 140) + 100, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 9: panel.Location = new Point(20 + (octave * 140) + 113, 280); panel.Size = new Size(13, 55); panel.BackColor = Color.DarkGray; Form.Controls.Add(panel); break; case 10: panel.Location = new Point(20 + (octave * 140) + 120, 280); panel.Size = new Size(19, 100); panel.BackColor = Color.White; panels.Add(panel); break; case 11: panel.Location = new Point(20 + (octave * 140) + 133, 280); panel.Size = new Size(13, 55); panel.BackColor = Color.DarkGray; Form.Controls.Add(panel); break; } Panels[x] = panel; } Form.Controls.AddRange(panels.ToArray()); Next = 0; Timer = new System.Threading.Timer(Timer_Callback, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10)); }
internal static void Show() { Power.AlwaysOn(); Form = new SongForm(); Form.Text = Song.Name + " - Midi Hero v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(2); Form.SpeedLabel.Text = "Speed: " + SongPlayer.Speed.ToString("P0"); Form.FormClosing += Form_FormClosing; Form.PlayButton.Click += PlayButton_Click; Form.PauseButton.Click += PauseButton_Click; Form.RestartButton.Click += RestartButton_Click; Form.IncreaseSpeedButton.Click += IncreaseSpeedButton_Click; Form.DecreaseSpeedButton.Click += DecreaseSpeedButton_Click; Form.Show(); Panels = new Panel[8]; // Bass Drum Panels[0] = new Ellipse(); Panels[0].Location = new Point(412, 500); Panels[0].Size = new Size(180, 180); Panels[0].BackColor = Color.Gray; Form.Controls.Add(Panels[0]); // Snare Drum Panels[1] = new Ellipse(); Panels[1].Location = new Point(430, 430); Panels[1].Size = new Size(120, 60); Panels[1].BackColor = Color.Gray; Form.Controls.Add(Panels[1]); // Tom 1 Panels[2] = new Ellipse(); Panels[2].Location = new Point(410, 340); Panels[2].Size = new Size(80, 55); Panels[2].BackColor = Color.Gray; Form.Controls.Add(Panels[2]); // Tom 2 Panels[3] = new Ellipse(); Panels[3].Location = new Point(510, 350); Panels[3].Size = new Size(100, 70); Panels[3].BackColor = Color.Gray; Form.Controls.Add(Panels[3]); // Tom 3 Panels[4] = new Ellipse(); Panels[4].Location = new Point(600, 440); Panels[4].Size = new Size(140, 90); Panels[4].BackColor = Color.Gray; Form.Controls.Add(Panels[4]); // Hi Hat Panels[5] = new Ellipse(); Panels[5].Location = new Point(300, 450); Panels[5].Size = new Size(100, 35); Panels[5].BackColor = Color.Gray; Form.Controls.Add(Panels[5]); // Crash Cymbal Panels[6] = new Ellipse(); Panels[6].Location = new Point(305, 270); Panels[6].Size = new Size(150, 30); Panels[6].BackColor = Color.Gray; Form.Controls.Add(Panels[6]); // Ride Cymbal Panels[7] = new Ellipse(); Panels[7].Location = new Point(545, 270); Panels[7].Size = new Size(150, 30); Panels[7].BackColor = Color.Gray; Form.Controls.Add(Panels[7]); Next = 0; Timer = new System.Threading.Timer(Timer_Callback, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5)); }