Exemplo n.º 1
0
		static void Main(string[] args)
		{
			if (args.Length < 2 || args.Length > 3)
			{
				Console.WriteLine("DeskIOCLI <ip> <command> <duration (optional)>");
				return;
			}

			var deskIp = IPAddress.Parse(args[0]);
			var desk = new Desk(deskIp);

			var command = args[1].ToLower();
			
			var duration = -1;
			if (args.Length == 3)
				duration = int.Parse(args[2]);

			switch (command)
			{
				case "up":
					desk.Raise(duration);
					break;
				case "down":
					desk.Lower(duration);
					break;
				case "stop":
					desk.Stop();
					break;
				default:
					Console.WriteLine("Invalid command: " + args[1]);
					break;
			}
			
			desk.Disconnect();
		}
Exemplo n.º 2
0
		private void ConnectButton_MouseClick(object sender, MouseEventArgs e)
		{
			IPAddress deskAddress;

			if (!IPAddress.TryParse(IPAddressTextBox.Text, out deskAddress))
			{
				MessageBox.Show("Invalid IP address entered", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

			_desk = new Desk(deskAddress);
			DownArrow.Enabled = true;
			UpButton.Enabled = true;
		}