private static void inputMenu() { ISCPSocket.SendPacket(Input.Status); Thread.Sleep(250); if (!HGJConsole.Regions["inputselect"].Visible) { HGJConsole.Regions["inputselect"].Visible = true; } writeInputMenu(); ConsoleKeyInfo cki = default(ConsoleKeyInfo); while (cki.Key != ConsoleKey.Escape) { cki = HGJConsole.Regions["inputselect"].GetChar(14); switch (cki.Key) { case ConsoleKey.V: ISCPSocket.SendPacket(Input.Video1); break; case ConsoleKey.S: ISCPSocket.SendPacket(Input.Video2); break; case ConsoleKey.G: ISCPSocket.SendPacket(Input.Video3); break; case ConsoleKey.A: ISCPSocket.SendPacket(Input.Video4); break; case ConsoleKey.B: ISCPSocket.SendPacket(Input.Video5); break; case ConsoleKey.P: ISCPSocket.SendPacket(Input.Video6); break; case ConsoleKey.D: ISCPSocket.SendPacket(Input.DVD); break; case ConsoleKey.T: ISCPSocket.SendPacket(Input.Tape1); break; case ConsoleKey.H: ISCPSocket.SendPacket(Input.Phono); break; case ConsoleKey.C: ISCPSocket.SendPacket(Input.CD); break; case ConsoleKey.F: ISCPSocket.SendPacket(Input.FM); break; case ConsoleKey.L: ISCPSocket.SendPacket(Input.DLNA); break; case ConsoleKey.N: ISCPSocket.SendPacket(Input.Network); break; } writeInputMenu(); } HGJConsole.Regions["inputselect"].Visible = false; HGJConsole.Draw(true); }
private static void Main(string[] args) { //Setup console-regions HGJConsole.Reset(); HGJConsole.BackgroundColor = ConsoleColor.Blue; HGJConsole.Regions.Add("input1", new ConsoleRegion(new ConsolePoint(1, 1), 4, 35, "Input", true)); HGJConsole.Regions.Add("recv", new ConsoleRegion(new ConsolePoint(1, 6), 4, 35, "Recieved", false)); HGJConsole.Regions.Add("status", new ConsoleRegion(new ConsolePoint(1, 11), 3, 35, "Status", true)); HGJConsole.Regions.Add("menu", new ConsoleRegion(new ConsolePoint(40, 1), 13, 35, "Menu", false)); HGJConsole.Regions.Add("device", new ConsoleRegion(new ConsolePoint(1, 15), 3, 74, "Device-info", false)); HGJConsole.Regions.Add("inputselect", new ConsoleRegion(new ConsolePoint(7, 2), 16, 60, "Input-select", false)); HGJConsole.Draw(true); //Connect while (!connect()) { Thread.Sleep(5000); } //Write menu to console-region writeMenu(); //Loop input characters... bool shouldstop = false; while (!shouldstop) { ConsoleKeyInfo cki = HGJConsole.Regions["input1"].GetChar(2); if (cki.Modifiers == ConsoleModifiers.Shift) { switch (cki.Key) { case ConsoleKey.Add: case ConsoleKey.OemPlus: case ConsoleKey.Subtract: case ConsoleKey.OemMinus: ISCPSocket.SendPacket(MasterVolume.Status); break; case ConsoleKey.V: ISCPSocket.SendPacket(MasterVolume.Status); break; case ConsoleKey.P: ISCPSocket.SendPacket(Power.Status); break; case ConsoleKey.M: ISCPSocket.SendPacket(Muting.Status); break; case ConsoleKey.A: ISCPSocket.SendPacket(Audio.Status); break; } } else { switch (cki.Key) { case ConsoleKey.Add: case ConsoleKey.OemPlus: ISCPSocket.SendPacket(MasterVolume.Up); break; case ConsoleKey.Subtract: case ConsoleKey.OemMinus: ISCPSocket.SendPacket(MasterVolume.Down); break; case ConsoleKey.I: inputMenu(); break; case ConsoleKey.P: ISCPSocket.SendPacket(Power.Status, true); ISCPSocket.SendPacket(_powerStatus ? Power.Off : Power.On); break; case ConsoleKey.M: ISCPSocket.SendPacket(Muting.Toggle); break; case ConsoleKey.H: ISCPSocket.SendPacket(OSD.Home); break; case ConsoleKey.UpArrow: ISCPSocket.SendPacket(OSD.Up); break; case ConsoleKey.DownArrow: ISCPSocket.SendPacket(OSD.Down); break; case ConsoleKey.RightArrow: ISCPSocket.SendPacket(OSD.Right); break; case ConsoleKey.LeftArrow: ISCPSocket.SendPacket(OSD.Left); break; case ConsoleKey.X: ISCPSocket.SendPacket(OSD.Exit); break; case ConsoleKey.Enter: ISCPSocket.SendPacket(OSD.Enter); break; case ConsoleKey.Q: shouldstop = true; break; } } } HGJConsole.Regions["status"].WriteContent("... Press any key to exit ..."); Console.ReadKey(); ISCPSocket.Dispose(); }