JLChen
2021-01-05 f500e14c0a994487070380c50c85e0929cbc8e63
Crabtree/SmartHome/UI/SimpleControl/Phone/System/SystemRemote.cs
@@ -12,16 +12,32 @@
    {
       static SystemRemote ()
        {
            //如果在远程连接的情况下,就会有定时发送心跳包
            System.Threading.Tasks.Task.Run (() => {
                while (true) {
                    System.Threading.Thread.Sleep (10 * 1000);
                    if (CommonPage.IsRemote) {
                        Control.ControlBytesSend (Command.ReadRemark, 0, 0, new byte [] { }, SendCount.Zero);
                        Console.WriteLine ("心跳包");
                    }
                }
            });
            //后面考虑检测网关是否在线,可以这里修改方法检测
            ////如果在远程连接的情况下,就会有定时发送心跳包
            //System.Threading.Tasks.Task.Run (() => {
            //    while (true) {
            //        System.Threading.Thread.Sleep (10 * 1000);
            //        if (CommonPage.IsRemote) {
            //            Control.ControlBytesSend (Command.ReadRemark, 0, 0, new byte [] { }, SendCount.Zero);
            //            Utlis.WriteLine ("心跳包");
            //        }
            //    }
            //});
            ////如果在远程连接的情况下,就会有定时发送心跳包
            //System.Threading.Tasks.Task.Run (() => {
            //    while (true) {
            //        System.Threading.Thread.Sleep (10 * 1000);
            //        if (CommonPage.IsRemote) {
            //            Utlis.WriteLine ("心跳包");
            //            byte [] backBytes =  Control.ControlBytesSendHasReturn (Command.ReadRemark, 0, 0, new byte [] { });
            //            if (backBytes != null) {
            //                Utlis.WriteLine ("心跳包 收到回复");
            //            }
            //        }
            //    }
            //});
        }
        /// <summary>
        /// 加密算法
@@ -162,7 +178,7 @@
            byte [] bytes = null;
            var dateTime = DateTime.Now;
            System.Threading.Tasks.Task.Run (() => {
                bytes = new System.Net.WebClient { Proxy = null }.DownloadData ("http://www.baidu.com");
                bytes = new System.Net.WebClient { Proxy = null }.DownloadData ("https://smarth-api.havells.com");
            });
            while ((DateTime.Now - dateTime).TotalMilliseconds < 8000) {
                System.Threading.Thread.Sleep (100);
@@ -187,7 +203,7 @@
        {
            bool result = false;
            bool notInternet = false;
            string linkMsg = UserConfig.Instance.CurrentRegion.RegionName + " : ";
            string linkMsg = UserConfig.Instance.CurrentRegion.Name + " : ";
            try {
                if (!checeInternet ()) {
                    MainPage.AddTip (Language.StringByID (R.MyInternationalizationString.CheckInternet));
@@ -261,7 +277,7 @@
                    }
                }
            } catch (Exception ex) {
                Console.WriteLine (ex.Message);
                Utlis.WriteLine (ex.Message);
            } finally {
                if (!result) {
                    Application.RunOnMainThread (() => {