wxr
2022-10-27 bbd6b592a6b883e013ff1e0a574976ceba5009ea
HDL_ON/Common/ApiUtlis.cs
@@ -43,6 +43,15 @@
            }
        }
        /// <summary>
        /// 读取设备功能数据完成
        /// </summary>
        bool complateDevice = false;
        /// <summary>
        /// 读取场景数据完成
        /// </summary>
        bool complateScene = false;
        /// <summary>
        /// 校验网关是否在线
        /// </summary>
        public bool GatewayOnlineVerification()
@@ -79,6 +88,8 @@
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            string code = StateCode.SUCCESS;
            Inverter.Ins.H5Page = null;//重置光伏页面
            var downloadDataThread = new System.Threading.Thread(() =>
            {
@@ -152,7 +163,13 @@
                    {
                        MainPage.Log($"读取房间数据失败:Code:{roomResult.Code}; msg:{roomResult.message}");
                    }
                    //===================设备=======================
                    new System.Threading.Thread(() =>
                    {
                        try
                        {
                            complateDevice = false;
                    var deviceResult = Ins.HttpRequest.GetDeviceList("30","1");
                    if (deviceResult.Code == StateCode.SUCCESS)
                    {
@@ -177,9 +194,14 @@
                                    deviceList.list.AddRange(deviceList2.list);
                                }
                            }
                        }catch(Exception ex)
                                }
                                catch (Exception ex)
                        {
                                }
                                finally
                                {
                                    complateDevice = true;
                        }
                        string delFile = "";
@@ -218,8 +240,23 @@
                    {
                        MainPage.Log($"读取云端设备数据失败:Code:{deviceResult.Code};  Msg:{deviceResult.message}");
                    }
                        }catch (Exception ex)
                        {
                            MainPage.Log($"============设备============{ex.Message}");
                        }
                        finally
                        {
                            complateDevice = true;
                        }
                    })
                    { IsBackground = true }.Start();
                    //===================场景==========================
                    new System.Threading.Thread(() =>
                    {
                        try
                        {
                            complateScene = true;
                    var pack = Ins.HttpRequest.GetSceneList();
                    if (pack.Code == StateCode.SUCCESS)
                    {
@@ -271,9 +308,19 @@
                    {
                        MainPage.Log($"读取云端场景数据失败:Code:{pack.Code}; Msg:{pack.message}");
                    }
                        }catch(Exception ex)
                        {
                            MainPage.Log($"===场景==={ex.Message}");
                        }
                        finally
                        {
                            complateScene = true;
                        }
                    })
                    { IsBackground = true }.Start();
                    //===================读取逻辑列表==========================
                    UI.UI2.Intelligence.Automation.MainView.GetLogicList();
                    UI.UI2.Intelligence.Automation.MainView.GetLogicList(true);
                    //===================读取可视对讲数据==========================
                    //判断是否有可视对讲数据,有则显示可视对讲icon
@@ -358,6 +405,9 @@
                    //======================安防====================
                    GetSecurityList();
                    //======================注册推送====================
                    httpRequest.RegisteredPush();
                }
                catch (Exception ex)
@@ -394,15 +444,11 @@
                {
                    while (endTime > DateTime.Now)
                    {
                        if (DownloadDataComplete)
                        if (DownloadDataComplete && complateDevice && complateScene)
                        {
                            break;
                        }
                        System.Threading.Thread.Sleep(100);
                    }
                    if (!DownloadDataComplete)
                    {
                        //downloadDataThread.Abort();
                    }
                    DownloadDataComplete = true;
                    Application.RunOnMainThread(() =>
@@ -413,9 +459,6 @@
                            waitPage = null;
                        }
                    });
                    //初始化数据
                    //SpatialInfo.CurrentSpatial.Clear();
                }
                catch { }
                finally
@@ -433,6 +476,37 @@
                }
            })
            { IsBackground = true }.Start();
            ////下载光伏数据
            //new System.Threading.Thread(() => {
            //    try
            //    {//00
            //        HttpServerRequest http = new HttpServerRequest();
            //        var packData = http.GetInverterList();
            //        if (packData != null)
            //        {
            //            if (packData.Code == StateCode.SUCCESS)
            //            {
            //                var inverterList = JsonConvert.DeserializeObject<List<InverterInfo>>(packData.Data.ToString());
            //                if (inverterList!= null)
            //                {
            //                    FunctionList.List.InverterList = inverterList;
            //                }
            //            }
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MainPage.Log($"读取光伏数据异常:{ex.Message}");
            //    }
            //}) { IsBackground = true }.Start();
        }
        /// <summary>