wei
2021-08-27 eda3fb873e59544ff36301b51e05aef64f87b0f9
HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
@@ -35,8 +35,8 @@
            nameView.btnText.Height = Application.GetRealHeight(22);
            nameView.btnText.TextID = StringId.namelogic;
            nameView.btnIcon.Visible = false;
            nameView.btnNextIcon.Height = Application.GetMinRealAverage(28);
            nameView.btnNextIcon.Width = Application.GetMinRealAverage(28);
            nameView.btnNextIcon.Height = Application.GetRealWidth(28);
            nameView.btnNextIcon.Width = Application.GetRealWidth(28);
            nameView.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
            viewLayout.AddChidren(nameView.FLayoutView());
@@ -61,12 +61,13 @@
                    list.Add(logic.name);
                }
                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view
                    ) =>
                {
                    btnAutomationName.Text = logicName;
                    Logic.currlogic.name = logicName;
                });
                },()=> { });
            };
            nameView.btnClick.MouseUpEventHandler += editClick;
            btnAutomationName.MouseUpEventHandler += editClick;
@@ -95,21 +96,47 @@
            EventHandler<MouseEventArgs> delClick = (sender, e) =>
            {
                Loading loading = new Loading();
                this.AddChidren(loading);
                HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                new LogicView.TipPopView().TipBox(StringId.tip, StringId.delAutomation, () =>
                {
                  var responsePackNew=  Send.delLogic(Logic.currlogic);
                    if (responsePackNew.Code == "0")
                    loading.Start();
                    new System.Threading.Thread(() =>
                    {
                        LogicMethod.RemoveAllView();
                        Logic.LogicList.Remove(Logic.currlogic);
                        MainView.MainShow();
                        //发送删除逻辑命令;
                    }
                    else
                    {
                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
                    }
                        try
                        {
                            //发送删除逻辑命令;
                            responsePackNew = Send.DelLogic(Logic.currlogic);
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                loading.Hide();
                                if (responsePackNew != null && responsePackNew.Code == "0")
                                {
                                    LogicMethod.CurrLogicMethod.RemoveAllView();
                                    Logic.LogicList.Remove(Logic.currlogic);
                                    MainView.MainShow();
                                    //发送删除逻辑命令;
                                }
                                else if (responsePackNew != null && responsePackNew.Code == "14005")
                                {
                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
                                }
                                else
                                {
                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail));
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                });
            };