using System; using Shared; using System.Collections.Generic; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View { public class HeigthChangeView { /// /// 背景 /// FrameLayout fLayout = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; /// /// /// FrameLayout iconFLyout = new FrameLayout { X = Application.GetRealWidth(205), Y = Application.GetRealHeight(314), Width = Application.GetRealWidth(160), Height = Application.GetRealHeight(21 + 44), //BackgroundImagePath = "LogicIcon/bjicon.png", }; /// /// /// FrameLayout textFLyout = new FrameLayout { X = Application.GetRealWidth(8), Y = Application.GetRealHeight(14), Width = Application.GetRealWidth(144), Height = Application.GetRealHeight(44), }; /// /// /// VerticalScrolViewLayout vv = new VerticalScrolViewLayout { X = Application.GetRealWidth(8), Y = Application.GetRealHeight(14), Width = Application.GetRealWidth(144), Height = Application.GetRealHeight(44 * 4), }; /// /// View方法 /// /// /// /// public void Show(FrameLayout frame, List list, Action action) { frame.AddChidren(fLayout); fLayout.AddChidren(iconFLyout); fLayout.MouseUpEventHandler += (sender1, e1) => { fLayout.RemoveFromParent(); }; if (list.Count > 4) { iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4); iconFLyout.AddChidren(vv); iconFLyout.BackgroundImagePath = "PirIcon/4.png"; } else { iconFLyout.AddChidren(textFLyout); iconFLyout.Height = Application.GetRealHeight(21 + 44 * list.Count); textFLyout.Height = Application.GetRealHeight(44 * list.Count); iconFLyout.BackgroundImagePath = $"PirIcon/{list.Count}.png"; } for (int i = 0; i < list.Count; i++) { var pirJson = list[i]; View.PirNameView pirNameView = new View.PirNameView(); if (list.Count > 4) { vv.AddChidren(pirNameView.FLayoutView()); } else { pirNameView.frameLayout.Y = Application.GetRealHeight(i * 44); textFLyout.AddChidren(pirNameView.FLayoutView()); } pirNameView.btnName.Text = pirJson.name; pirNameView.btnClick.Tag = pirJson; pirNameView.btnClick.MouseUpEventHandler += (sender2, e2) => { var pir = pirNameView.btnClick.Tag as Pir; action(pir); fLayout.RemoveFromParent(); //deviceNameBtn.Text = pirJson.name; //Pir.currPir = pirJson; }; if (list.Count - 1 == i) { ///改变最后那条一个线的颜色,界面显示效果作用; pirNameView.btnLine.BackgroundColor = CSS.CSS_Color.view; } } } } }