陈嘉乐
2020-11-27 4653dfad25810d9365e1be43df791df12de0a872
HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -17,14 +17,23 @@
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            LogicView.TopView topView = new LogicView.TopView();
            topView.setBtn.Visible = true;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
             {
                 RemoveFromParent();
             };
            topView.topNameBtn.TextID = StringId.newAutomation;
            if (string.IsNullOrEmpty(Logic.currlogic.sid))
            {
                topView.topNameBtn.TextID = StringId.newAutomation;
            }
            else
            {
                topView.topNameBtn.TextID = StringId.editAutomation;
            }
            topView.setBtn.MouseUpEventHandler += (sender,e) => { };
            VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout
           VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(LogicView.TextSize.view375),
@@ -132,15 +141,21 @@
            this.AddChidren(saveView.FLayoutView());
            saveView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                Logic.LogicList.Add(Logic.currlogic);
                if (string.IsNullOrEmpty(Logic.currlogic.sid))
                {
                    Logic.currlogic.sid = LogicMethod.NewSid();
                    Logic.LogicList.Add(Logic.currlogic);
                }
                else
                {
                }
                LogicMethod.RemoveAllView();
                MainView.MainShow();
                //发送新加修改逻辑命令;
            };
            //saveView.frameLayout.Y = this.Height - saveView.frameLayout.Height;
            #endregion
        }
        /// <summary>
@@ -259,7 +274,7 @@
            //确定保存
            dateView.btnConfirm.MouseUpEventHandler += (sender3, e3) =>
            {
                if (weekName == Language.StringByID(StringId.monthly)|| weekName!= Language.StringByID(StringId.weekly)) {
                if (weekName == Language.StringByID(StringId.monthly)|| weekName== Language.StringByID(StringId.weekly)) {
                    //提示:还未选
                    return;
@@ -404,7 +419,7 @@
                }
                Logic.currlogic.cycle.type = "week";
                Logic.currlogic.cycle.value = weekList;
                button.Text = GetWeekString(weekList);
                button.Text = MainView.GetWeekString(weekList);
                fLayout.RemoveFromParent();
            };
@@ -503,70 +518,11 @@
                }
                Logic.currlogic.cycle.type = "mon";
                Logic.currlogic.cycle.value = monList;
                button.Text = GetMonString(monList);
                button.Text = MainView.GetMonString(monList);
                fLayout.RemoveFromParent();
            };
        }
        /// <summary>
        /// 获取星期的字符串
        /// </summary>
        /// <param name="weekList"></param>
        /// <returns></returns>
        public string GetWeekString(List<string> weekList)
        {
            string weekTextName = "";
            if (weekList.Contains("0"))
            {
                weekTextName += Language.StringByID(StringId.monday) + ",";
            }
            if (weekList.Contains("1"))
            {
                weekTextName += Language.StringByID(StringId.tuesday) + ",";
            }
            if (weekList.Contains("2"))
            {
                weekTextName += Language.StringByID(StringId.wednesday) + ",";
            }
            if (weekList.Contains("3"))
            {
                weekTextName += Language.StringByID(StringId.thursday) + ",";
            }
            if (weekList.Contains("4"))
            {
                weekTextName += Language.StringByID(StringId.friday) + ",";
            }
            if (weekList.Contains("5"))
            {
                weekTextName += Language.StringByID(StringId.saturday) + ",";
            }
            if (weekList.Contains("6"))
            {
                weekTextName += Language.StringByID(StringId.sunday) + ",";
            }
            if (weekTextName == "")
            {
                return "";
            }
            return weekTextName.TrimEnd(',');
        }
        /// <summary>
        /// 获取每月的字符串
        /// </summary>
        /// <param name="monList"></param>
        /// <returns></returns>
        public string GetMonString(List<string> monList)
        {
            string monTextName = Language.StringByID(StringId.monthly);
            for (int i = 1; i < 32; i++)
            {
                if (monList.Contains(i.ToString()))
                {
                    monTextName += i.ToString() + ",";
                }
            }
            return monTextName.TrimEnd(',');
        }
    }
}