void StartButton_Activated(object sender, EventArgs e) { // handle button state if (running) { if (artnet != null) { artnet.Stop(); } running = false; startButton.Title = "Start"; interfaceText.Enabled = true; } else { running = true; startButton.Title = "Stop"; interfaceText.Enabled = false; } // Artnet artnet.Address = IPAddress.Parse(interfaceText.StringValue); artnet.Start(); }
public static void Main(string[] args) { var subUni = 0; var running = true; Console.WriteLine("ArtDotNet Client"); var controller = new ArtNetController(); controller.Address = IPAddress.Loopback; controller.DmxPacketReceived += (s, p) => { if (p.SubUni != subUni) { return; } Console.Clear(); Console.WriteLine("ArtNet Universe " + subUni); for (int i = 0; i < p.Length; i++) { if (i % 24 == 0) { Console.WriteLine(); } Console.Write(string.Format("{000:00} ", p.Data[i])); } }; controller.Start(); while (running) { var key = Console.ReadKey(true); if (key.Key == ConsoleKey.UpArrow) { subUni++; } if (key.Key == ConsoleKey.DownArrow) { subUni--; } if (key.Key == ConsoleKey.Escape) { running = false; } Console.Title = ("ArtNet Universe " + subUni); } controller.Stop(); }