终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Markup;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. using BPA.Communication;
  17. using BPA.Helper;
  18. namespace Test
  19. {
  20. /// <summary>
  21. /// Interaction logic for MainWindow.xaml
  22. /// </summary>
  23. public partial class MainWindow : Window
  24. {
  25. public MainWindow()
  26. {
  27. InitializeComponent();
  28. }
  29. ICommunication mySiemens = new Siemens();
  30. byte bit = 0;
  31. private void Button_Click_1(object sender, RoutedEventArgs e)
  32. {
  33. mySiemens.WithSiemens(CpuType.S71200, "192.168.100.162").UseConnected(() =>
  34. {
  35. MessageBox.Show("设备连接成功");
  36. //System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
  37. byte[] bytes = Encoding.Unicode.GetBytes(textBox.Text);
  38. mySiemens.Write<byte[]>("DB1.DBB0", bytes);
  39. });
  40. }
  41. }
  42. }