From 1a4b95a7ebef71838bd3eda2c22056bbf0db65ec Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 10 一月 2020 16:39:54 +0800
Subject: [PATCH] 2019阶段备份

---
 HDL_ON/DriverLayer/Control_Bus.cs |   53 ++++++++++++++---------------------------------------
 1 files changed, 14 insertions(+), 39 deletions(-)

diff --git a/HDL_ON/HDL/Operation/Control.cs b/HDL_ON/DriverLayer/Control_Bus.cs
similarity index 92%
rename from HDL_ON/HDL/Operation/Control.cs
rename to HDL_ON/DriverLayer/Control_Bus.cs
index 1384441..3993919 100644
--- a/HDL_ON/HDL/Operation/Control.cs
+++ b/HDL_ON/DriverLayer/Control_Bus.cs
@@ -1,39 +1,28 @@
-using System;
+锘縰sing System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Text;
 using HDL_ON.DAL;
 using HDL_ON.DAL.Net;
-using HDL_ON.UI;
+using HDL_ON.Entity.Enumerative;
 
 namespace HDL_ON
 {
-    public class Control
+    public partial class Control
     {
-        public bool IsCanShowTip;
         public System.DateTime LatestDateTime = System.DateTime.Now;
 
         /// <summary>
         /// 鎵�鏈夊井淇″涓�绔彛鐨勬帶鍒堕兘浼氭斁鍒拌繖涓泦鍚堥噷
         /// </summary>
-        private static System.Collections.Generic.List<Control> controlList = new List<Control>(50);
+        private static List<Control> controlList = new List<Control>(50);
 
         /// <summary>
         /// 鍙戦�佹暟鎹紝绛夊緟鏈夊弽棣�
         /// </summary>
         /// <returns>The bytes send has return.</returns>
-        public static byte[] ControlBytesSendHasReturn(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, bool isShow = true)
+        static byte[] ControlBytesSendHasReturn(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3)
         {
-
-            if (command == Command.ReadDeviceLoopInfo || command == Command.ReadDeviceModul)
-                CommonPage.LocalPhoneFindDevice = true;
-            if (command == Command.ReadGateway || command == Command.ReadGatewayProgrammingMode || command == Command.SetGateway)
-            {
-                CommonPage.FindGateway = true;
-                CommonPage.LocalPhoneFindDevice = true;
-            }
-
-            Control control = new Control() { IsCanShowTip = isShow };
+            Control control = new Control();
             control.Send(new Target()
             {
                 IPEndPoint = CommonPage.EndPoint,
@@ -41,31 +30,21 @@
                 SubnetID = subnetID,
                 DeviceID = deviceID,
                 AddData = gatewayBytes,
-            }, SendCount.Three, true);
+            }, sendCount, true);
             CommonPage.FindGateway = false;
 
             return control.UsefulBytes;
-
         }
-
 
         /// <summary>
         /// 鍙戦�佹暟鎹紝涓嶉渶瑕佺瓑寰呭洖澶�
         /// </summary>
-        public static void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, SendCount sendCount = SendCount.Three, System.Net.IPEndPoint ipEndpoint = null, bool isShowTip = true)
+        static void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3, System.Net.IPEndPoint ipEndpoint = null)
         {
-            if (command == Command.ReadDeviceLoopInfo || command == Command.ReadDeviceModul)
-                CommonPage.LocalPhoneFindDevice = true;
-            if (command == Command.ReadGateway || command == Command.ReadGatewayProgrammingMode
-                || command == Command.SetGateway)
-            {
-                CommonPage.FindGateway = true;
-                CommonPage.LocalPhoneFindDevice = true;
-            }
-            Control control = new Control() { IsCanShowTip = isShowTip };
+            Control control = new Control();
             control.Send(new Target()
             {
-                IPEndPoint = ipEndpoint == null ? CommonPage.EndPoint : ipEndpoint,//new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
+                IPEndPoint = ipEndpoint == null ? CommonPage.EndPoint : ipEndpoint,
                 Command = command,
                 SubnetID = subnetID,
                 DeviceID = deviceID,
@@ -457,7 +436,6 @@
                         }
                         System.Threading.Thread.Sleep(100);
                     }
-
                 }
                 catch (Exception ex)
                 {
@@ -466,10 +444,6 @@
                 finally
                 {
                     allDone.Set();
-                    if (Packet.HaveSendCount == 3 && IsCanShowTip)
-                    {
-                        //MainPage.AddTip (Language.StringByID (SimpleControl.R.MyInternationalizationString.OperationFailed));
-                    }
                 }
             }
         }
@@ -685,10 +659,10 @@
         /// </summary>
         /// <param name="target">鍙戦�佸璞�</param>
         /// <param name="sendCount">閲嶅彂娆℃暟</param>
-        public void Send(Target target, SendCount sendCount, bool isWait)
+        public void Send(Target target, int sendCount, bool isWait)
         {
             Packet = new Packet(target.SendBytes, target.IPEndPoint);
-            Packet.HaveSendCount = 3 - (int)sendCount;
+            Packet.HaveSendCount = 3 - sendCount;
 
             ini(target);
 
@@ -697,5 +671,6 @@
                 this.wait();
             }
         }
+
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0