示例#1
0
 void Toggle_Button_Click(object sender, RoutedEventArgs e, TCPSocket client, string command)
 {
     if (client.connected == true)
     {
         if (command == "Ign")
         {
             if (IgnTOG_Button.Content.Equals("Ignition OFF"))
             {
                 client.sendMessage("2");
             }
             else
             {
                 client.sendMessage("3");
             }
         }
         else if (command == "Val")
         {
             if (ValTOG_Button.Content.Equals("Valve Closed"))
             {
                 client.sendMessage("4");
             }
             else
             {
                 client.sendMessage("5");
             }
         }
     }
     else
     {
         MessageBox.Show("No Connection Established", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#2
0
 void Button_Click(object sender, RoutedEventArgs e, TCPSocket client, string command)
 {
     if (client.connected == true)
     {
         client.sendMessage(command);
     }
     else
     {
         MessageBox.Show("No Connection Established", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#3
0
 void Confirm_Button_Click(object sender, RoutedEventArgs e, TCPSocket client, string message, string command)
 {
     if (client.connected == true)
     {
         MessageBoxResult result = MessageBox.Show("Are you sure you wish to " + message + "?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             client.sendMessage(command);
         }
     }
     else
     {
         MessageBox.Show("No Connection Established", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
示例#4
0
 void Connect_Button_Click(object sender, RoutedEventArgs e, TCPSocket client, DispatcherTimer timer)
 {
     if (client.connected == false)
     {
         MessageBoxResult result = MessageBox.Show("Are you sure you wish to Connect?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             client.init();
             if (client.connected == true)
             {
                 client.sendMessage("Hello");
                 timer.Start();
                 MessageBox.Show("Connection Established", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
             }
         }
     }
     else
     {
         MessageBox.Show("Connection Already Established", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }