|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using BPASmartClient.AGV.Feedback;
- using BPASmartClient.HubHelper;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
-
- namespace FryPot_DosingSystem.View
- {
- /// <summary>
- /// MainWindow.xaml 的交互逻辑
- /// </summary>
- public partial class MainWindow : Window
- {
- ScrollViewer scrollViewer;
- double lastPointX;
- double distance;
- public MainWindow()
- {
- InitializeComponent();
- Initialize();
- HubHelper.GetInstance.Report = new Action<object>((o) =>
- {
- var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
- });
-
- HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
- {
- var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
- });
-
- HubHelper.GetInstance.Connect("192.168.1.40", 8089);
- }
-
- protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
- {
- base.OnMouseLeftButtonDown(e);
- // 获取鼠标相对控件位置 (grid_main为控件Name)
- Point position = Mouse.GetPosition(grid_main);
- // 如果鼠标位置在控件内,允许拖动
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- if (position.X >= 0 && position.X < grid_main.ActualWidth && position.Y >= 0 && position.Y < grid_main.ActualHeight)
- {
- this.DragMove();
- }
- }
- }
-
- private void Initialize()
- {
- this.ButClose.Click += (obj, e) =>
- {
- MessageBoxResult res = MessageBox.Show("确定关闭上位机软件?", "警告", MessageBoxButton.OKCancel);
- if (res == MessageBoxResult.OK)
- {
- this.Close();
- }
- };
-
-
-
- }
-
-
- }
- }
|