终端一体化运控平台
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

79 linhas
2.2 KiB

  1. using BPASmartClient.AGV.Feedback;
  2. using BPASmartClient.HubHelper;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Shapes;
  18. namespace FryPot_DosingSystem.View
  19. {
  20. /// <summary>
  21. /// MainWindow.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class MainWindow : Window
  24. {
  25. ScrollViewer scrollViewer;
  26. double lastPointX;
  27. double distance;
  28. public MainWindow()
  29. {
  30. InitializeComponent();
  31. Initialize();
  32. HubHelper.GetInstance.Report = new Action<object>((o) =>
  33. {
  34. var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
  35. });
  36. HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
  37. {
  38. var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
  39. });
  40. HubHelper.GetInstance.Connect("192.168.1.40", 8089);
  41. }
  42. protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
  43. {
  44. base.OnMouseLeftButtonDown(e);
  45. // 获取鼠标相对控件位置 (grid_main为控件Name)
  46. Point position = Mouse.GetPosition(grid_main);
  47. // 如果鼠标位置在控件内,允许拖动
  48. if (e.LeftButton == MouseButtonState.Pressed)
  49. {
  50. if (position.X >= 0 && position.X < grid_main.ActualWidth && position.Y >= 0 && position.Y < grid_main.ActualHeight)
  51. {
  52. this.DragMove();
  53. }
  54. }
  55. }
  56. private void Initialize()
  57. {
  58. this.ButClose.Click += (obj, e) =>
  59. {
  60. MessageBoxResult res = MessageBox.Show("确定关闭上位机软件?", "警告", MessageBoxButton.OKCancel);
  61. if (res == MessageBoxResult.OK)
  62. {
  63. this.Close();
  64. }
  65. };
  66. }
  67. }
  68. }