陈嘉乐
2021-03-22 002bb6950a15e703e2ad6ef7b2b4c5d80c4ee64b
2021-3-22-2

备份代码
10个文件已修改
13602 ■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,19 +1,43 @@
<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="17" Column="33" />
      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" />
      <File FileName="HDL_ON/Common/R.cs" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="37" Column="23" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="159" Column="81" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="1" Column="1" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="20" Column="23" />
      <File FileName="HDL-ON_Android/Application.cs" Line="393" Column="33" />
      <File FileName="../../Application.cs" Line="257" Column="45" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="183" Column="48" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="28" Column="40" />
      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="12" Column="60" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="DAL" expanded="True">
                <Node name="Mqtt" expanded="True" />
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI2" expanded="True">
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="AddFunction" expanded="True" />
                    <Node name="PirDevice" expanded="True">
                      <Node name="EditControl.cs" selected="True" />
                    </Node>
                  </Node>
                </Node>
              </Node>
            </Node>
            <Node name="HDL-ON_Android" expanded="True">
              <Node name="Resources" expanded="True" />
            </Node>
          </Node>
        </State>
      </Pad>
    </Pads>
  </MonoDevelop.Ide.Workbench>
  <MonoDevelop.Ide.DebuggingService.PinnedWatches />
  <DisabledProjects>
@@ -22,7 +46,7 @@
    <String>Shared.IOS/Shared.IOS.csproj</String>
  </DisabledProjects>
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore />
  </MonoDevelop.Ide.DebuggingService.Breakpoints>
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
@@ -33,7 +33,8 @@
                    MainPage.BasePageView.AddChidren(page);
                    page.Show();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    page.BackAction += () => {
                    PirMain.BackAction += () =>
                    {
                        action?.Invoke();
                    };
                });
@@ -272,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());
@@ -317,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>
@@ -378,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>
@@ -446,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 { }
@@ -505,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;
        }