using System; using HDL_ON.UI.Music; using System.Collections.Generic; using Shared; using static HDL_ON.UI.UI2.FuntionControlView.Video.VideoMethod; namespace HDL_ON.UI.UI2.FuntionControlView.Video { public class MainView : FrameLayout { public void Show(List listVideo, List listCall) { this.BackgroundColor = MusicColor.ViewColor; var topView = new TopView(); this.AddChidren(topView.TopFLayoutView()); topView.topNameBtn.Text = "可视对讲"; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); }; var pageView = new PageLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(667 - 64), IsShowPoint = false, }; this.AddChidren(pageView); var view1 = new FrameLayout(); pageView.AddChidren(view1); var view2 = new FrameLayout(); pageView.AddChidren(view2); View1(view1, listVideo); View2(view2, listCall); Button btn11 = new Button { X = Application.GetRealWidth(170), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = MusicColor.SelectedColor, Radius = (uint)Application.GetRealHeight(4), }; view1.AddChidren(btn11); Button btn12 = new Button { X = Application.GetRealWidth(192), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = 0x404484F4, Radius = (uint)Application.GetRealHeight(4), }; view1.AddChidren(btn12); Button btn21 = new Button { X = Application.GetRealWidth(170), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = 0x404484F4, Radius = (uint)Application.GetRealHeight(4), }; view2.AddChidren(btn21); Button btn22 = new Button { X = Application.GetRealWidth(192), Y = Application.GetRealHeight(578), Width = Application.GetRealWidth(14), Height = Application.GetRealHeight(6), BackgroundColor = MusicColor.SelectedColor, Radius = (uint)Application.GetRealHeight(4), }; view2.AddChidren(btn22); pageView.PageChange = (sender, e) => { if (pageView.PageIndex == 0) { topView.topNameBtn.Text = "可视对讲"; } else { topView.topNameBtn.Text = "通话记录"; } }; } /// /// 第一个界面 /// /// 父控件 void View1(FrameLayout view1, List list) { var bjFl = new FrameLayout { Y = Application.GetRealHeight(24), X = Application.GetRealWidth(24), Height = Application.GetRealHeight(526), Width = Application.GetRealWidth(327), BackgroundImagePath = "MusicIcon/playBj.png", }; view1.AddChidren(bjFl); /// /// 汉字 /// Button nameBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(16), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(33), TextColor = MusicColor.MusicTxet14Color, TextSize = TextSize.Text24, TextAlignment = TextAlignment.CenterLeft, Text = "可视对讲", }; bjFl.AddChidren(nameBtn); /// /// 区域名称 /// Button regionBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(53), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(17), TextColor = MusicColor.MusicNoTxetColor, TextSize = TextSize.Text12, TextAlignment = TextAlignment.CenterLeft, Text = "123456" }; bjFl.AddChidren(regionBtn); /// ///收藏图标 /// Button collectIconBtn = new Button { X = Application.GetRealWidth(273), Y = Application.GetRealHeight(14), Width = Application.GetRealWidth(40), Height = Application.GetRealWidth(40), UnSelectedImagePath = "MusicIcon/collect.png", SelectedImagePath = "MusicIcon/collectSelected.png", }; bjFl.AddChidren(collectIconBtn); Button intercomBtnIcon = new Button { X = Application.GetRealWidth(84), Y = Application.GetRealHeight(118), Width = Application.GetRealWidth(160), Height = Application.GetRealWidth(160), UnSelectedImagePath = "VideoIcon/keshiduijiang.png", }; bjFl.AddChidren(intercomBtnIcon); var vv = new VerticalScrolViewLayout { Y = Application.GetRealHeight(306), Height = Application.GetRealHeight(220), Width = Application.GetRealWidth(327), }; bjFl.AddChidren(vv); //数组个数 //int value = 15; //先计算数据所需要的很高度; int l = 0; if (list.Count % 3 == 0) { l = list.Count / 3; } else { l = (list.Count / 3) + 1; } var fL = new FrameLayout { Height = Application.GetRealHeight((48 + 24) * l), }; vv.AddChidren(fL); int line = 0; for (int i = 1, j = 0; i <= list.Count; i++, j++) { var video = list[i - 1]; var fLayout = new FrameLayout { Width = Application.GetRealWidth(50), Height = Application.GetRealWidth(48), X = Application.GetRealWidth(31 + (58 + 50) * j), Y = Application.GetRealHeight(20 + (48 + 24) * line), }; fL.AddChidren(fLayout); var iconBtn = new Button { X = Application.GetRealWidth(11), Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), UnSelectedImagePath = "VideoIcon/weiqiangji.png", }; fLayout.AddChidren(iconBtn); var iconNameBtn = new Button { Y = iconBtn.Bottom + Application.GetRealHeight(6), Width = Application.GetRealWidth(50), Height = Application.GetRealHeight(14), TextSize = TextSize.Text10, TextColor = CSS.CSS_Color.TextualColor, TextAlignment = TextAlignment.Center, Text = video.DeviceName, }; fLayout.AddChidren(iconNameBtn); var clickBtn = new Button { Tag = video }; fLayout.AddChidren(clickBtn); if (i % 3 == 0) { //满一行重置j=0值; j = -1; line += 1; } // GetIconAndText(i, deviceIconBtn, iconNameBtn); clickBtn.MouseUpEventHandler += (sender, e) => { var eSVideoInfo = clickBtn.Tag as ESVideoInfo; ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo); }; } } /// /// 第二个界面 /// /// 父控件 void View2(FrameLayout view2, List listCall) { var bjFl = new FrameLayout { Y = Application.GetRealHeight(24), X = Application.GetRealWidth(24), Height = Application.GetRealHeight(526), Width = Application.GetRealWidth(327), BackgroundImagePath = "MusicIcon/playBj.png", }; view2.AddChidren(bjFl); /// /// 汉字 /// Button nameBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(16), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(33), TextColor = MusicColor.MusicTxet14Color, TextSize = TextSize.Text24, TextAlignment = TextAlignment.CenterLeft, Text = "通话记录", }; bjFl.AddChidren(nameBtn); /// /// 云端照片只保留30天 /// Button regionBtn = new Button { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(53), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(17), TextColor = MusicColor.SelectedColor, TextSize = TextSize.Text12, TextAlignment = TextAlignment.CenterLeft, Text = "*云端照片只保留30天" }; bjFl.AddChidren(regionBtn); var vv = new VerticalScrolViewLayout { X = Application.GetRealWidth(16), Y = Application.GetRealHeight(58), Height = Application.GetRealHeight(458), Width = Application.GetRealWidth(295), }; bjFl.AddChidren(vv); for (int i = 0; i < listCall.Count; i++) { var year = listCall[i]; View.FrameLayout50 frameLayout50 = new View.FrameLayout50(); vv.AddChidren(frameLayout50.FLayoutView()); for (int j = 0; j < year.callList.Count; j++) { var call = year.callList[j]; View.FrameLayout60 frameLayout60 = new View.FrameLayout60(); vv.AddChidren(frameLayout60.FLayoutView()); } } } public string getTime(string str) { var dd = Convert.ToDateTime(str); var time = dd.ToString("HH") + ":" + dd.ToString("mm"); return time; } } }