JLChen
2020-12-09 e87985ec1dcb69beedaf9f95e8e7aba14b7c08d6
HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -35,7 +35,8 @@
                topView.setBtn.Visible = true;
                topView.clickSetBtn.Visible = true;
            }
            topView.clickSetBtn.MouseUpEventHandler += (sender,e) => {
            topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
            {
                Set set = new Set();
                MainPage.BasePageView.AddChidren(set);
                set.Show();
@@ -43,7 +44,7 @@
            };
           VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout
            VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
@@ -97,6 +98,7 @@
            LogicView.LogicTypeTitleView titleOutpu = new LogicView.LogicTypeTitleView();
            titleOutpu.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            titleOutpu.btnText.TextID = StringId.theFollowingActions;
            titleOutpu.btnNextIcon.Visible = false;
            viewLayout.AddChidren(titleOutpu.FLayoutView());
            //目标处理方法
            InpOrOutLogicMethod.OutputTarget(this, viewLayout);
@@ -122,7 +124,7 @@
            LogicView.LogicTypeTitleView cyclicTitle = new LogicView.LogicTypeTitleView();
            cyclicTitle.frameLayout.Height = Application.GetRealHeight(50);
            cyclicTitle.frameLayout.Radius = (uint)Application.GetRealHeight(12);
            cyclicTitle.btnText.TextID = StringId.days;
            cyclicTitle.btnText.Text = MainView.GetWeekText(Logic.currlogic);
            viewLayout.AddChidren(cyclicTitle.FLayoutView());
            cyclicTitle.btnClick.MouseUpEventHandler += (sender, e) =>
            {
@@ -138,21 +140,26 @@
            #endregion
            #region  执行推送 发送通知
            ///上下间隔12像素
            viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
            ///执行推送iew
            LogicView.LogicTypeTitleView push = new LogicView.LogicTypeTitleView();
            push.frameLayout.Height = Application.GetRealHeight(50);
            push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            push.btnText.TextID = StringId.push;
            viewLayout.AddChidren(push.FLayoutView());
            ///发送通知View
            LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView();
            notification.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            notification.btnText.TextID = StringId.notification;
            viewLayout.AddChidren(notification.FLayoutView());
            ///上下间隔62像素
            viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(62) });
            /////上下间隔12像素
            //viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) });
            /////执行推送iew
            //LogicView.LogicTypeTitleView push = new LogicView.LogicTypeTitleView();
            //push.frameLayout.Height = Application.GetRealHeight(50);
            //push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            //push.btnText.TextID = StringId.push;
            //push.btnNextIcon.Width = Application.GetMinRealAverage(36);
            //push.btnNextIcon.Height = Application.GetMinRealAverage(36);
            //push.btnNextIcon.X = Application.GetRealWidth(305);
            //push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png";
            //push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png";
            //viewLayout.AddChidren(push.FLayoutView());
            /////发送通知View
            //LogicView.LogicTypeTitleView notification = new LogicView.LogicTypeTitleView();
            //notification.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            //notification.btnText.TextID = StringId.notification;
            //viewLayout.AddChidren(notification.FLayoutView());
            /////上下间隔62像素
            //viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(62) });
            #endregion
            #region  保存
@@ -173,19 +180,33 @@
                    {
                        Logic.currlogic.name = logicName;
                        Logic.currlogic.sid = LogicMethod.NewSid();
                        Logic.LogicList.Add(Logic.currlogic);
                        LogicMethod.RemoveAllView();
                        MainView.MainShow();
                        //发送新加修改逻辑命令;
                        var responsePackNew = Send.AddLogic(Logic.currlogic);
                        if (responsePackNew.Code == "0")
                        {
                            Logic.LogicList.Add(Logic.currlogic);
                            LogicMethod.RemoveAllView();
                            MainView.MainShow();
                        }
                        else {
                            new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                        }
                    });
                }
                else
                {
                    LogicMethod.RemoveAllView();
                    MainView.MainShow();
                    //发送新加修改逻辑命令;
                    var responsePackNew = Send.updateLogic(Logic.currlogic);
                    if (responsePackNew.Code == "0")
                    {
                        LogicMethod.RemoveAllView();
                        MainView.MainShow();
                    }
                    else {
                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                    }
                }
            };
@@ -211,7 +232,7 @@
            //定义一个局部变量记录选中文本状态
            string weekName = "";
            //定义一个局部Btn用来记录选中Btn;
            var selecetdBtn = new Button();
            var selecetdBtn = new Button() { Text=""};
            for (int i = 0; i < 4; i++)
            {
                LogicView.SelectTypeView dateTypeView = new LogicView.SelectTypeView();
@@ -224,6 +245,7 @@
                dateTypeView.btnLine.Width = Application.GetRealWidth(303);
                dateView.frameLayout.AddChidren(dateTypeView.FLayoutView());
                dateTypeView.btnClick.Tag = i;//标记类型
                switch (i)
                {
                    case 0:
@@ -298,35 +320,31 @@
                {
                    dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor;
                    selecetdBtn = dateTypeView.btnText;
                }
                else if (button.Text == weekName)
                {
                    dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor;
                    selecetdBtn = dateTypeView.btnText;
                }
            }
            //确定保存
            dateView.btnConfirm.MouseUpEventHandler += (sender3, e3) =>
            {
                if (weekName == Language.StringByID(StringId.monthly)|| weekName== Language.StringByID(StringId.weekly)) {
                if (selecetdBtn.Text == Language.StringByID(StringId.monthly)|| selecetdBtn.Text == Language.StringByID(StringId.weekly)) {
                    //提示:还未选
                    return;
                }
                if (weekName == Language.StringByID(StringId.performA))
                if (selecetdBtn.Text == Language.StringByID(StringId.performA))
                {
                    //执行一次
                    Logic.currlogic.cycle.type = "once";
                }
                else if (weekName == Language.StringByID(StringId.days))
                else if (selecetdBtn.Text == Language.StringByID(StringId.days))
                {
                    //每天
                    Logic.currlogic.cycle.type = "day";
                }
                //选中保存之后显示文本
                button.Text = weekName;
                button.Text = selecetdBtn.Text;
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
@@ -485,9 +503,9 @@
            {
                Button monTextBtn = new Button
                {
                    Width = Application.GetMinRealAverage(30),
                    Height = Application.GetMinRealAverage(30),
                    Radius = (uint)Application.GetRealHeight(15),
                    Width = Application.GetRealWidth(30),
                    Height = Application.GetRealWidth(30),
                    Radius = (uint)Application.GetRealWidth(15),
                    Text = i.ToString(),
                    TextSize = LogicView.TextSize.text14,
                    TextColor = CSS.CSS_Color.textColor,
@@ -556,7 +574,6 @@
                fLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 满足条件
        /// </summary>