陈嘉乐
2021-03-12 16277f0b999eb1b2c6bbcf710be04cadaf2a07fa
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -19,7 +19,8 @@
            topView.topNameBtn.TextID = StringId.shebeigaunli;
            topView.topIconBtn.Visible = true;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => {
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                action();
                this.RemoveFromParent();
            };
@@ -32,14 +33,14 @@
                //关闭刷新View;
                vv.EndHeaderRefreshing();
                //获取列表
                Method.GetPirDeviceList(this,() =>
                {
                    Application.RunOnMainThread(() =>
                    {
                Method.GetPirDeviceList(this, () =>
                 {
                     Application.RunOnMainThread(() =>
                     {
                        //刷新界面
                        UIView(vv);
                    });
                });
                     });
                 });
            };
            #endregion
@@ -164,14 +165,17 @@
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = TextSize.text12,
                    TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
                    SelectedTextColor =CSS.CSS_Color.textRedColor,
                    SelectedTextColor = CSS.CSS_Color.textRedColor,
                    IsBold = true,
                };
                devfLayout.AddChidren(stateTextBtn);
                if (pirDevice.online) {
                if (pirDevice.online)
                {
                    stateIconBtn.IsSelected = true;
                    stateTextBtn.IsSelected = true;
                } else {
                }
                else
                {
                    stateIconBtn.IsSelected = false;
                    stateTextBtn.IsSelected = false;
                }
@@ -291,54 +295,58 @@
                    }
                    delBtn.MouseUpEventHandler += (sender, e) =>
                    {
                        var Function = delBtn.Tag as Entity.Function;
                        //加载log
                        Loading loading = new Loading();
                        this.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?";
                        TipPopView tipPopView = new TipPopView();
                        tipPopView.TipBox(StringId.tip, text, (dialog) =>
                        {
                            try
                            //加载log
                            Loading loading = new Loading();
                            dialog.AddChidren(loading);
                            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                            loading.Start();
                            new System.Threading.Thread(() =>
                            {
                                responsePackNew = PirSend.DeleteDevice(Function.deviceId);
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() =>
                                try
                                {
                                    loading.Hide();
                                    try
                                    responsePackNew = PirSend.DeleteDevice(Function.deviceId);
                                }
                                catch { }
                                finally
                                {
                                    Application.RunOnMainThread(() =>
                                    {
                                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                        loading.Hide();
                                        try
                                        {
                                            var function = pirDevice.FunctioList.Find((c)=>c.sid== Function.sid);
                                            if (function != null)
                                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                            {
                                                pirDevice.FunctioList.Remove(Function);
                                                if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid)
                                                dialog.Close();
                                                var function = pirDevice.FunctioList.Find((c) => c.sid == Function.sid);
                                                if (function != null)
                                                {
                                                    Pir.currPir.FunctioList = pirDevice.FunctioList;
                                                    pirDevice.FunctioList.Remove(Function);
                                                    if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid)
                                                    {
                                                        Pir.currPir.FunctioList = pirDevice.FunctioList;
                                                    }
                                                }
                                                UIView(vv);
                                            }
                                            UIView(vv);
                                            else
                                            {
                                                Method method = new Method();
                                                method.ErrorShow(responsePackNew);
                                            }
                                        }
                                        catch { }
                                        else
                                        {
                                            Method method = new Method();
                                            method.ErrorShow(responsePackNew);
                                        }
                                    }
                                    catch { }
                                    });
                                }
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                            })
                            { IsBackground = true }.Start();
                        }, () => { }, false);
                    };
                    EventHandler<MouseEventArgs> editClick = (sender, e) =>
                    {
@@ -358,8 +366,6 @@
                    areaBtn.MouseUpEventHandler += editClick;
                    nextIconBtn.MouseUpEventHandler += editClick;
                }
            }
        }
@@ -383,14 +389,14 @@
                    {
                        list.Add(Pir.pirDeviceList[b].name);
                    }
                    Method methodView = new Method();
                    Method methodView = new Method();
                    methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) =>
                    {
                        pirclick.name = name;
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        //加载log
                        Loading loading = new Loading();
                        view.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        {
@@ -420,9 +426,10 @@
                        })
                        { IsBackground = true }.Start();
                    },()=> {
                    }, () =>
                    {
                        NewSwitchView(pirclick, vv);
                    },false);
                    }, false);
                }
                else
@@ -431,10 +438,10 @@
                    TipPopView tipPopView = new TipPopView();
                    tipPopView.TipBox(StringId.tip, text, (dialog) =>
                    {
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        //加载log
                        Loading loading = new Loading();
                        dialog.AddChidren(loading);
                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                        loading.Start();
                        new System.Threading.Thread(() =>
                        {
@@ -474,6 +481,6 @@
            });
        }
    }
}