终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 line
1.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Markup;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. using BPA.Communication;
  18. using BPA.Helper;
  19. namespace Test
  20. {
  21. /// <summary>
  22. /// Interaction logic for MainWindow.xaml
  23. /// </summary>
  24. public partial class MainWindow : Window
  25. {
  26. public MainWindow()
  27. {
  28. InitializeComponent();
  29. command = I
  30. modbusTcp.GetConfigPar().IpAddress = "192.168.2.10";
  31. modbusTcp.Connected = new Action(() =>
  32. {
  33. t = modbusTcp.IsConnected();
  34. });
  35. if (t)
  36. {
  37. MessageBox.Show("设备连接成功");
  38. }
  39. }
  40. public ModbusTcp modbusTcp = new ModbusTcp();
  41. bool t;
  42. public ICommand command { get; set; }
  43. private void Button_Click_1(object sender, RoutedEventArgs e)
  44. {
  45. if (t)
  46. {
  47. }
  48. }
  49. }
  50. }