public Form1() { InitializeComponent(); try { device = new LaunchpadDevice(); device.DoubleBuffered = true; } catch { textBox2.Text = ("Launchpad nicht angeschlossen, oder durch ein anderes Programm verwendet!"); return; } for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) device[x, y].TurnOffLight(); device.GetButton(ToolbarButton.Session).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.Left).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.User1).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.User2).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.Reset(); button1.Enabled = true; button2.Enabled = false; button2.Text = "Launchpad erkannt"; hilfe(); }
public MainWindow() { try { device = new LaunchpadDevice(); keyboard = new InputSimulator().Keyboard; data = DataStore.Instance; device.DoubleBuffered = true; device.DoubleBuffered = false; Application.Current.Exit += ClearLaunchpad; device.ButtonPressed += HandleLaunchPadInput; InitializeComponent(); InitData(); RefreshPad(); } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (result == MessageBoxResult.OK) { Application.Current.Shutdown(); } } }
public Snake(LaunchpadDevice device) { mLaunchpadDevice = device; mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed; Restart(); }
public Reversi(LaunchpadDevice device) { mLaunchpadDevice = device; mLaunchpadDevice.DoubleBuffered = false; mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed; mOutputDevice = OutputDevice.InstalledDevices[0]; mOutputDevice.Open(); Restart(); }
public RainSequencer(LaunchpadDevice device) { mLaunchpadDevice = device; mOutputDevice = OutputDevice.InstalledDevices[0]; mOutputDevice.Open(); mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed; /* Random rand = new Random(); for (int y = 0; y < NumRows; y++) for (int x = 0; x < NumRows; x++) if (rand.Next(0, 12) == 0) mSequence[x, y] = true; * */ }
public ToggleGrid(LaunchpadDevice device) { mLaunchpadDevice = device; mLaunchpadDevice.DoubleBuffered = false; mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed; mLaunchpadDevice.GetButton(ToolbarButton.Session).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); /* for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { mLaunchpadDevice[x, y].SetBrightness((ButtonBrightness)x, (ButtonBrightness)y); } } */ }
public ScrollingLetters(LaunchpadDevice device) { mLaunchpadDevice = device; }
internal LaunchpadButton(LaunchpadDevice launchpadDevice, ButtonType type, int index) { mLaunchpadDevice = launchpadDevice; mType = type; mIndex = index; }
internal LaunchpadButton(LaunchpadDevice launchpadDevice, ButtonType type, int index) { mLaunchpadDevice = launchpadDevice; mType = type; mIndex = index; }
public Bulldog(LaunchpadDevice device) { mLaunchpadDevice = device; mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed; }
void clock(LaunchpadDevice device) { Clock warten = new Clock(160); warten.Start(); device[1, 1].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[2, 1].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[1, 2].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[6, 1].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[5, 1].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[6, 2].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[1, 5].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[1, 6].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[2, 6].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[6, 5].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[5, 6].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[6, 6].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); bool stop = false; while (stop == false) { if (warten.Time == 1 || warten.Time == 5) { if (warten.Time >= 3) { stop = true; warten.Stop(); device[3, 4].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[4, 3].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[4, 4].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[3, 3].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); System.Threading.Thread.Sleep(375); device.Reset(); break; } else { device[3, 4].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[4, 3].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[4, 4].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[3, 3].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); } } else if (warten.Time == 2) { device[3, 4].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device[4, 3].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device[4, 4].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device[3, 3].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); } else if (warten.Time == 3) { device[3, 4].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[4, 3].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[4, 4].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); device[3, 3].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); } else if (warten.Time == 4) { device[3, 4].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device[4, 3].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device[4, 4].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device[3, 3].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); } } }
public Warten(LaunchpadDevice alt) { clock(alt); }
public Schach(TextBox TextBox2, TextBox TextBox1, LaunchpadDevice device, PictureBox PicBoxx, PictureBox a1, PictureBox a2, PictureBox a3, PictureBox a4, PictureBox a5, PictureBox a6, PictureBox a7, PictureBox a8, PictureBox b1, PictureBox b2, PictureBox b3, PictureBox b4, PictureBox b5, PictureBox b6, PictureBox b7, PictureBox b8, PictureBox c1, PictureBox c2, PictureBox c3, PictureBox c4, PictureBox c5, PictureBox c6, PictureBox c7, PictureBox c8, PictureBox d1, PictureBox d2, PictureBox d3, PictureBox d4, PictureBox d5, PictureBox d6, PictureBox d7, PictureBox d8, PictureBox e1, PictureBox e2, PictureBox e3, PictureBox e4, PictureBox e5, PictureBox e6, PictureBox e7, PictureBox e8, PictureBox f1, PictureBox f2, PictureBox f3, PictureBox f4, PictureBox f5, PictureBox f6, PictureBox f7, PictureBox f8, PictureBox g1, PictureBox g2, PictureBox g3, PictureBox g4, PictureBox g5, PictureBox g6, PictureBox g7, PictureBox g8, PictureBox h1, PictureBox h2, PictureBox h3, PictureBox h4, PictureBox h5, PictureBox h6, PictureBox h7, PictureBox h8) { initialisieren(); pa1 = a1; pa2 = a2; pa3 = a3; pa4 = a4; pa5 = a5; pa6 = a6; pa7 = a7; pa8 = a8; pb1 = b1; pb2 = b2; pb3 = b3; pb4 = b4; pb5 = b5; pb6 = b6; pb7 = b7; pb8 = b8; pc1 = c1; pc2 = c2; pc3 = c3; pc4 = c4; pc5 = c5; pc6 = c6; pc7 = c7; pc8 = c8; pd1 = d1; pd2 = d2; pd3 = d3; pd4 = d4; pd5 = d5; pd6 = d6; pd7 = d7; pd8 = d8; pe1 = e1; pe2 = e2; pe3 = e3; pe4 = e4; pe5 = e5; pe6 = e6; pe7 = e7; pe8 = e8; pf1 = f1; pf2 = f2; pf3 = f3; pf4 = f4; pf5 = f5; pf6 = f6; pf7 = f7; pf8 = f8; pg1 = g1; pg2 = g2; pg3 = g3; pg4 = g4; pg5 = g5; pg6 = g6; pg7 = g7; pg8 = g8; ph1 = h1; ph2 = h2; ph3 = h3; ph4 = h4; ph5 = h5; ph6 = h6; ph7 = h7; ph8 = h8; mLaunchpadDevice = device; PictureBox1 = PicBoxx; mLaunchpadDevice.DoubleBuffered = false; //GeƤndert..! ausgabe = TextBox2; ausgabetb2 = TextBox1; mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); mLaunchpadDevice.GetButton(ToolbarButton.Session).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); spieleranzeige(); launchpadaus(mLaunchpadDevice); showboard(); mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed; }
public void launchpadaus(LaunchpadDevice device) { for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) device[x, y].TurnOffLight(); }
////////////////////////// e passant! Rochadenproblem (fressen des Turms) private void button2_Click(object sender, EventArgs e) { try { device = new LaunchpadDevice(); device.DoubleBuffered = true; } catch { textBox2.Text = ("Launchpad nicht angeschlossen, oder durch ein anderes Programm verwendet!"); return; } for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) device[x, y].TurnOffLight(); device.GetButton(ToolbarButton.Session).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.Left).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.User1).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.User2).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); device.Reset(); Warten warten = new Warten(device); button1.Enabled = true; button2.Enabled = false; button2.Text = "Launchpad erkannt"; hilfe(); }
protected override void OnClosing(CancelEventArgs e) { e.Cancel = true; try { device = new LaunchpadDevice(); device.DoubleBuffered = true; } catch { System.Windows.Forms.Application.Exit(); } device.Reset(); System.Windows.Forms.Application.Exit(); }