using System; using System.Collections.Generic; using Shared; namespace HDL_ON.UI.UI2.Intelligence.Automation { public class WeatherCondition : FrameLayout { public WeatherCondition() { Tag = "Logic"; } public void Show(bool edit = false, int index=-1) { #region 界面布局 LogicView.TopView topView = new LogicView.TopView(); topView.frameLayout.Height = Application.GetRealHeight(64 + 20); this.AddChidren(topView.FLayoutView()); topView.topNameBtn.TextID = StringId.selectionCondition; //获取宽度 int widthValue= topView.topNameBtn.GetTextWidth(); int textWidth =(Application.GetRealWidth(255)- widthValue) / 2; Button locationBtn = new Button { Width = Application.GetRealWidth(18), Height = Application.GetRealWidth(18), X = Application.GetRealWidth(60+4)+ textWidth + widthValue, Y = Application.GetRealHeight(34+1), 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.clickBackBtn.MouseUpEventHandler += (e, sen) => { RemoveFromParent(); }; FrameLayout viewLayout = new FrameLayout { Y = Application.GetRealHeight(64+20), Width = Application.GetRealWidth(LogicView.TextSize.view375), Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64-20), BackgroundColor = CSS.CSS_Color.viewMiddle, }; this.AddChidren(viewLayout); #endregion var list = new List { Language.StringByID(StringId.clearday), Language.StringByID(StringId.cloudy), Language.StringByID(StringId.rain), }; for (int i = 0; i < list.Count; i++) { LogicView.SelectTypeView view = new LogicView.SelectTypeView(); view.frameLayout.Y = Application.GetRealHeight(i * 50); view.btnIcon.Visible = false; view.btnNextIcon.Visible = false; view.btnText.X = Application.GetRealWidth(16); view.btnLine.X = Application.GetRealWidth(16); view.btnLine.Width = Application.GetRealWidth(375 - 16 - 16); view.btnText.Text = list[i]; view.btnClick.Tag = list[i]; viewLayout.AddChidren(view.FLayoutView()); view.btnClick.MouseUpEventHandler += (sen, e) => { string text = view.btnClick.Tag.ToString(); if (text == Language.StringByID(StringId.clearday)) { } else if (text == Language.StringByID(StringId.cloudy)) { } else if (text == Language.StringByID(StringId.rain)) { } }; } } } }