| | |
| | | Tag = "Logic"; |
| | | } |
| | | |
| | | public void Show(string titelText,bool edit,int index) |
| | | public void Show(string titelText, bool edit, int index) |
| | | { |
| | | #region 界面布局 |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | | topView.frameLayout.Height = Application.GetRealHeight(64+20); |
| | | topView.frameLayout.Height = Application.GetRealHeight(64 + 20); |
| | | this.AddChidren(topView.FLayoutView()); |
| | | Button locationBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(18), |
| | | Height = Application.GetRealWidth(18), |
| | | X = Application.GetRealWidth(208), |
| | | Y = Application.GetRealHeight(34), |
| | | UnSelectedImagePath = "LogicIcon/location.png", |
| | | |
| | | }; |
| | | topView.frameLayout.AddChidren(locationBtn); |
| | | |
| | | Button textBtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(14), |
| | | Y = Application.GetRealHeight(57), |
| | | TextSize =LogicView.TextSize.text10, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | Text = "广东广州市番禺区石楼镇", |
| | | }; |
| | | topView.frameLayout.AddChidren(textBtn); |
| | | topView.topNameBtn.Text = titelText; |
| | | topView.Location(); |
| | | topView.clickBackBtn.MouseUpEventHandler += (e, sen) => |
| | | { |
| | | RemoveFromParent(); |
| | | }; |
| | | topView.topNameBtn.Text=titelText; |
| | | |
| | | FrameLayout viewLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(64+20), |
| | | Y = Application.GetRealHeight(64 + 20), |
| | | Width = Application.GetRealWidth(LogicView.TextSize.view375), |
| | | Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64-20), |
| | | Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 20), |
| | | BackgroundColor = CSS.CSS_Color.viewMiddle, |
| | | }; |
| | | this.AddChidren(viewLayout); |
| | | #endregion |
| | | |
| | | //(日出时,日落时,正午时) |
| | | string str1 = ""; |
| | | //(提前,延时) |
| | | string str2 = ""; |
| | | //(提前,延时多少分钟) |
| | | string value = ""; |
| | | if (edit) |
| | | { |
| | | new SpeciaTime().GetText(index, (s1, s2, s3) => |
| | | { |
| | | str1 = s1; |
| | | str2 = s2; |
| | | value = s3; |
| | | }); |
| | | |
| | | |
| | | } |
| | | var list = new List<string> { |
| | | Language.StringByID(StringId.punctually), |
| | | Language.StringByID(StringId.advanced), |
| | |
| | | timeView.btnLine.X = Application.GetRealWidth(16); |
| | | timeView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); |
| | | timeView.btnText.Text = list[i]; |
| | | timeView.btnClick.Tag= list[i]; |
| | | if (i==0) { |
| | | timeView.btnClick.Tag = list[i]; |
| | | if (i == 0) |
| | | { |
| | | timeView.btnNextIcon.Visible = false; |
| | | } |
| | | viewLayout.AddChidren(timeView.FLayoutView()); |
| | | //判断是(日出,日落,正午) |
| | | if (str1 == titelText) |
| | | { |
| | | //判断是(提前,延时) |
| | | if (str2 == list[i]) |
| | | { |
| | | string s = ""; |
| | | if (value != "0") |
| | | { |
| | | if (value == "30") |
| | | { |
| | | s = value + Language.StringByID(StringId.s); |
| | | } |
| | | else |
| | | { |
| | | s =value + Language.StringByID(StringId.minute); |
| | | } |
| | | } |
| | | timeView.btnState.Visible = true; |
| | | timeView.btnState.Text = s; |
| | | } |
| | | |
| | | } |
| | | viewLayout.AddChidren(timeView.FLayoutView()); |
| | | timeView.btnClick.MouseUpEventHandler += (sen, e) => |
| | | { |
| | | string clickText = timeView.btnClick.Tag.ToString(); |
| | |
| | | } |
| | | else |
| | | { |
| | | //提前/延时 |
| | | //定义一个局部变量 |
| | | string stateValue = ""; |
| | | //判断是(日出,日落,正午) |
| | | if (str1 == titelText) |
| | | { |
| | | //判断是(提前,延时) |
| | | if (str2 == clickText) |
| | | { |
| | | string s = ""; |
| | | if (value != "0") |
| | | { |
| | | if (value == "30") |
| | | { |
| | | s = value + " s"; |
| | | } |
| | | else |
| | | { |
| | | s = value + " min"; |
| | | } |
| | | } |
| | | //更新值stateValue |
| | | //为了显示之前的状态 |
| | | stateValue = s; |
| | | } |
| | | |
| | | } |
| | | |
| | | PublicInterface timePublicInterface = new PublicInterface(); |
| | | var timelist = timePublicInterface.GetViewList("time"); |
| | | timePublicInterface.SingleSelectionShow(this, timelist, clickText, "" |
| | | , (value) => |
| | | timePublicInterface.SingleSelectionShow(this, timelist, clickText, stateValue |
| | | , (value1) => |
| | | { |
| | | string timeValue = value.Split(" ")[0]; |
| | | string timeValue = value1.Split(" ")[0]; |
| | | AddDic(keyValue, timeValue, edit, index); |
| | | |
| | | }); |
| | |
| | | |
| | | }; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | { |
| | | |
| | | string keyValue = ""; |
| | | if (clickText == Language.StringByID(StringId.advanced)) |
| | | if (titelText == Language.StringByID(StringId.sunrise) + Language.StringByID(StringId.h)) |
| | | { |
| | | if (titelText == Language.StringByID(StringId.sunrise) + Language.StringByID(StringId.h)) |
| | | if (clickText == Language.StringByID(StringId.advanced)) |
| | | { |
| | | keyValue = "before_sunrise"; |
| | | |
| | | } |
| | | else if (titelText == Language.StringByID(StringId.sunset) + Language.StringByID(StringId.h)) |
| | | else if (clickText == Language.StringByID(StringId.delayLogic)) |
| | | { |
| | | keyValue = "before_sunset"; |
| | | keyValue = "after_sunrise"; |
| | | } |
| | | else |
| | | { |
| | | keyValue = "at_sunrise"; |
| | | keyValue = "after_sunrise"; |
| | | } |
| | | } |
| | | else if (titelText == Language.StringByID(StringId.sunset) + Language.StringByID(StringId.h)) |
| | | { |
| | | |
| | | |
| | | if (clickText == Language.StringByID(StringId.advanced)) |
| | | { |
| | | keyValue = "before_sunset"; |
| | | |
| | | } |
| | | else if (clickText == Language.StringByID(StringId.delayLogic)) |
| | | { |
| | | keyValue = "after_sunset"; |
| | | } |
| | | else |
| | | { |
| | | keyValue = "after_sunset"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (clickText == Language.StringByID(StringId.advanced)) |
| | | { |
| | | keyValue = "before_noon"; |
| | | |
| | | if (titelText == Language.StringByID(StringId.sunrise) + Language.StringByID(StringId.h)) |
| | | { |
| | | keyValue = "after_sunrise"; |
| | | } |
| | | else if (titelText == Language.StringByID(StringId.sunset) + Language.StringByID(StringId.h)) |
| | | else if (clickText == Language.StringByID(StringId.delayLogic)) |
| | | { |
| | | keyValue = "“after_sunset"; |
| | | keyValue = "after_noon"; |
| | | } |
| | | else |
| | | { |
| | | keyValue = "at_sunset"; |
| | | |
| | | keyValue = "after_noon"; |
| | | } |
| | | |
| | | } |
| | | return keyValue; |
| | | } |
| | |
| | | private void AddDic(string keyValue, string value, bool edit, int index) |
| | | { |
| | | Input inputTime = new Input(); |
| | | inputTime.sid = LogicMethod.NewSid(); |
| | | inputTime.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | inputTime.condition_type = "1"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.dictionary(dic, "key", keyValue); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", value); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | inputTime.condition.Add(dic); |
| | | AddCondition(inputTime, edit, index); |
| | | } |
| | |
| | | //添加一个新的时间条件 |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | LogicMethod.CurrLogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |