wxr
2021-03-23 09bde2ffef953fa5e78a4320aa8bbe03276ed7c5
Merge branch 'WJC' into temp-wxr
9个文件已修改
13576 ■■■■ 已修改文件
HDL-ON_Android/Application.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/Resource.designer.cs 13323 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Application.cs
@@ -28,12 +28,11 @@
            application.StartActivity(intent);
            Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
        }
        public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { }
        public override void OnCreate()
        {
            //注册未处理异常事件
            Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "cb89f20750");
            if (Shared.Application.Activity != null)
            {
@@ -47,6 +46,7 @@
            initAll();
        }
        /// <summary>
        /// 所有初始化全部在这个方法实现
        /// </summary>
@@ -60,7 +60,8 @@
            //隐藏虚拟按键
            BaseActivity.IsHideVirualButtons = true;
            //实现安卓返回按键
            BaseActivity.BackKeyAction = () => {
            BaseActivity.BackKeyAction = () =>
            {
                try
                {
                    var result = MainPage.LoadEvent_BackAction();
@@ -97,7 +98,7 @@
                {
                    Language.CurrentLanguage = "English";
                }
                //获取极光推送ID
                GetJPushRegistrationID(activity);
@@ -133,7 +134,7 @@
            BaseActivity.OnResumeAction += (activity) =>
            {
                checkSomeInfo();
            };
            BaseActivity.OnDestroyAction += (activity) =>
            {
@@ -142,7 +143,7 @@
                //UserInfo.Current.unlockTime = DateTime.Now;
            };
            HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider");
@@ -157,14 +158,14 @@
                    //关闭定位服务
                    Shared.Application.StopGPSLocationService();
                }
                  catch(Exception ex)
                catch (Exception ex)
                {
                    Utlis.WriteLine("GetCityInfo catch"+ ex.Message);
                    Utlis.WriteLine("GetCityInfo catch" + ex.Message);
                }
                MainPage.Log($"经纬度:::{lon}:{lat}");
            };
        }
        /// <summary>
@@ -173,6 +174,7 @@
        /// <param name="activity"></param>
        void GetJPushRegistrationID(BaseActivity activity)
        {
            try
            {
                //保存获取的极光服务器上的注册ID到本地文件
HDL-ON_Android/Resources/Resource.designer.cs
Diff too large
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs
@@ -150,7 +150,7 @@
                    switch (device.spk)
                    {
                        case SPK.IrModule:
                            new UI2.PersonalCenter.PirDevice.Method().MainView(this, device,()=> { });
                            new UI2.PersonalCenter.PirDevice.Method().MainView(this, device,()=> {});
                            break;
                    }
                };
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -159,7 +159,7 @@
                                var view = MainPage.BasePageView.GetChildren(i);
                                if (view.GetType() == typeof(AddControl))
                                {
                                    new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
                                    //new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiachenggong));
                                    view.RemoveFromParent();
                                }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -90,13 +90,13 @@
            this.AddChidren(namePatchView.FLayoutView());
            namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
            namePatchView.btnText2.Text = control.name;
            //所属区域
            View.PatchView quyuPatchView = new View.PatchView();
            quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
            this.AddChidren(quyuPatchView.FLayoutView());
            quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
            quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function);
            quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
            //继续添加
            Button addBtn = new Button
@@ -154,11 +154,13 @@
                if (bool_library)
                {
                    this.RemoveFromParent();
                    RefreshView();
                }
                else
                {
                    Method method = new Method();
                    method.AddControl(this, (controlDevice) => {
                    method.AddControl(this, (controlDevice) =>
                    {
                        AddButton addButton = new AddButton();
                        MainPage.BasePageView.AddChidren(addButton);
                        addButton.Show(controlDevice);
@@ -171,16 +173,24 @@
            {
                //移除所有界面
                MainPage.BasePageView.RemoveViewByTag("PirView");
                //移除红外宝根界面
                MainPage.BasePageView.RemoveViewByTag("PirMain");
                //重新加载界面
                var page = new PirMain();
                MainPage.BasePageView.AddChidren(page);
                page.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                RefreshView();
            };
            #endregion
        }
        /// <summary>
        /// 刷新红外宝主界面
        /// </summary>
        void RefreshView()
        {
            //移除红外宝根界面
            MainPage.BasePageView.RemoveViewByTag("PirMain");
            //重新加载界面
            var page = new PirMain();
            MainPage.BasePageView.AddChidren(page);
            page.Show();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -12,10 +12,10 @@
            Tag = "PirView";
        }
      
        public void Show(List<Brand> brandList,List<Library> libraryList,string spk)
        public void Show(List<Brand> brandList, List<Library> libraryList,string spk)
        {
           
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
@@ -108,7 +108,7 @@
                X = Application.GetRealWidth(136),
                Width = Application.GetRealWidth(104),
                Height = Application.GetRealHeight(17),
                Text = "(1/20)",
                Text = $"(1/{libraryList.Count})",
                TextSize = TextSize.text12,
                TextColor = CSS.CSS_Color.textCancelColor,
            };
@@ -160,7 +160,7 @@
            {
                if (index>1) {
                    index--;
                    sumBtn.Text = "(" + index.ToString() + "/20)";
                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                }
                code = 1;
                GetBtnText(testBtn, code, spk);
@@ -168,10 +168,10 @@
            //右
            rightIconBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (index < 20)
                if (index < libraryList.Count)
                {
                    index++;
                    sumBtn.Text = "(" + index.ToString() + "/20)";
                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                }
                code = 1;
                GetBtnText(testBtn, code, spk);
@@ -192,12 +192,12 @@
            //控制失败
            failedBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (index < 20)
                if (index < libraryList.Count)
                {
                    //先加
                    index++;
                    //更新文本
                    sumBtn.Text = "(" + index.ToString() + "/20)";
                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                }
                code = 1;
                //更新状态
@@ -214,7 +214,7 @@
                GetBtnText(testBtn, code, spk);
                if (if_bool)
                {
                    var library = libraryList[index];
                    var library = libraryList[index-1];
                    var control = GetControl(spk, testBtn.TextID, library);
                    Method method = new Method();
                    //发送库添加遥控器命令
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -9,12 +9,13 @@
    public class Method
    {
        /// <summary>
        /// 程序主入口
        /// 红外宝程序主入口
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="function"></param>
        public void MainView(FrameLayout frame, Entity.Function function,Action action)
        {
            Pir pirDevice = new Pir();
            if (function != null)
            {//数据转换
@@ -32,7 +33,8 @@
                    MainPage.BasePageView.AddChidren(page);
                    page.Show();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    page.BackAction += () => {
                    PirMain.BackAction += () =>
                    {
                        action?.Invoke();
                    };
                });
@@ -211,25 +213,10 @@
                                var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                if (pirJosn != null)
                                {
/* 项目“HDL-ON_iOS”的未合并的更改
在此之前:
                                    if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
在此之后:
                                    if (null == list.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
*/
                                    if (null == PirDevice.Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
                                    {
/* 项目“HDL-ON_iOS”的未合并的更改
在此之前:
                                        Pir.pirDeviceList.Add(pirJosn);
在此之后:
                                        list.pirDeviceList.Add(pirJosn);
*/
                                    {
                                        PirDevice.Pir.pirDeviceList.Add(pirJosn);
                                    }
                                }
                            }
@@ -286,7 +273,7 @@
                        var pirDevice = Pir.pirDeviceList[i];
                        try
                        {
                            var responsePackNew = PirSend.ControlList(pirDevice);
                            var responsePackNew = PirSend.ControlList(pirDevice.deviceId);
                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                            {
                                var jArray = JArray.Parse(responsePackNew.Data.ToString());
@@ -331,57 +318,27 @@
        /// 获取单个红外宝遥控器列表
        /// </summary>
        /// <param name="action">回调函数</param>
        public static void GetControlList(FrameLayout frame ,Action action, Pir pirDevice)
        public static void GetControlList(FrameLayout frame, Action action, Pir pirDevice)
        {
            Loading loading = new Loading();
            frame.AddChidren(loading);
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    try
                    {
                        var responsePackNew = PirSend.ControlList(pirDevice);
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        {
                            var jArray = JArray.Parse(responsePackNew.Data.ToString());
                            for (int a = 0; a < jArray.Count; a++)
                            {
                                var jay = jArray[a];
                                //数据返序列化为Logic对象
                                var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
                                if (pirJosn != null)
                                {
                                    if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
                                    {
                                        pirDevice.FunctioList.Add(pirJosn);
                                    }
                                }
                            }
                        }
                    }
                    catch { }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        action();
                    });
                }
            })
            { IsBackground = true }.Start();
            ThreadSend(new Control { deviceId = pirDevice.deviceId }, (responsePackNew) =>
             {
                 var jArray = JArray.Parse(responsePackNew.Data.ToString());
                 for (int a = 0; a < jArray.Count; a++)
                 {
                     var jay = jArray[a];
                     //数据返序列化为Logic对象
                     var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                     var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
                     if (pirJosn != null)
                     {
                         if (null == pirDevice.FunctioList.Find((c) => c.deviceId == pirJosn.deviceId))
                         {
                             pirDevice.FunctioList.Add(pirJosn);
                         }
                     }
                 }
                 action();
             }, "获取遥控器列表", "frame", frame, null);
        }
        /// <summary>
@@ -392,37 +349,12 @@
        /// <param name="action">回调函数</param>
        public void GetControl(FrameLayout frame, Control control, Action<Entity.Function> action)
        {
            Entity.Function function = null;
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            loading.Start();
            new System.Threading.Thread(() =>
            ThreadSend(control, (responsePackNew) =>
            {
                try
                {
                    // 获取设备详情通过(spk,sid)
                    var responsePackNew = PirSend.GetinfoBySid(control);
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        //var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString());
                        function = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(responsePackNew.Data.ToString());
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        action(function);
                    });
                }
            })
            { IsBackground = true }.Start();
                var function = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(responsePackNew.Data.ToString());
                action(function);
            }, "获取设备详情", "frame", frame, null);
        }
        /// <summary>
        /// 发送命令线程
        /// </summary>
@@ -460,8 +392,18 @@
                        responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
                    }
                    else if (str == "删除按键") {
                       // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
                    else if (str == "删除按键")
                    {
                        // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
                    }
                    else if (str == "获取设备详情")
                    {
                        // 获取设备详情通过(spk,sid)
                        responsePackNew = PirSend.GetinfoBySid(control);
                    }
                    else if (str == "获取遥控器列表")
                    {
                        responsePackNew = PirSend.ControlList(control.deviceId);
                    }
                }
                catch { }
@@ -519,7 +461,7 @@
                    str = buttondata;
                }
                if (!string.IsNullOrEmpty(controldata))
                if (!string.IsNullOrEmpty(str))
                {
                    try
                    {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -14,7 +14,11 @@
        /// <summary>
        /// 回调
        /// </summary>
        public Action BackAction;
        public static Action BackAction;
        /// <summary>
        ///
        /// </summary>
        Button addDevice;
        /// <summary>
        /// 临时储存设备类型列表
        /// </summary>
@@ -26,9 +30,12 @@
            topView.topNameBtn.TextID = StringId.hongwaiyaokong;
            topView.topIconBtn.Visible = true;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => {
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                BackAction();
                this.RemoveFromParent(); };
                BackAction = null;
                this.RemoveFromParent();
            };
            FrameLayout middFLayout = new FrameLayout();
            middFLayout.Y = Application.GetRealHeight(64);
@@ -38,19 +45,22 @@
            VerticalRefreshLayout vv = new VerticalRefreshLayout();
            middFLayout.AddChidren(vv);
            //加号图标
            Button addDevice = new Button
            addDevice = new Button
            {
                Y = Application.GetRealHeight(480),
                X = Application.GetRealWidth(293),
                Width = Application.GetRealWidth(82),
                Height = Application.GetRealWidth(84),
                UnSelectedImagePath = "PirIcon/add.png",
            };
                Visible=false,
            };
            middFLayout.AddChidren(addDevice);
            if (Pir.currPir.FunctioList.Count < 10)
            {
                //10个遥控器就会隐藏添加图标
                middFLayout.AddChidren(addDevice);
                // middFLayout.AddChidren(addDevice);
                addDevice.Visible = true;
            }
            vv.BeginHeaderRefreshingAction += () =>
@@ -77,7 +87,7 @@
                MainPage.BasePageView.AddChidren(setPir);
                setPir.Show(() =>
                {
                    BackAction();
                    //BackAction();
                    ////刷新界面
                    UIView(vv);
                });
@@ -267,7 +277,12 @@
                                Pir.currPir.FunctioList.Remove(Function);
                            }
                            UIView(vv);
                            if (Pir.currPir.FunctioList.Count < 10)
                            {
                                //10个遥控器就会隐藏添加图标
                                // middFLayout.AddChidren(addDevice);
                                addDevice.Visible = true;
                            }
                        }, "删除", "dialog", null, dialog);
                    }, () => { }, false);
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -79,9 +79,9 @@
        /// <summary>
        /// 获取遥控器列表
        /// </summary>
        public static ResponsePackNew ControlList(Pir pir)
        public static ResponsePackNew ControlList(string deviceId)
        {
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } };
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId} };
            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List);
            return responsePackNew;
        }