using System; using System.Collections.Generic; using HDL_ON.UI.Music; using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView; using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; using Shared; using static HDL_ON.UI.UI2.FuntionControlView.Aks.AksPage; namespace HDL_ON.UI.UI2.FuntionControlView.Aks { /// ///虚拟遥控器界面 /// public class YkqPage : BaseFramLayout { /// /// /// /// 遥控器对象 /// 时序器列表 public YkqPage(RemoteControlEntity remoteControlEntity, List sequencerList) { this.remoteControl = remoteControlEntity; this.sequencerList = sequencerList; } /// /// 时序器列表 /// private List sequencerList; /// /// 当前的遥控器对象 /// private RemoteControlEntity remoteControl; public Action action; /// /// 切换设备容器 /// TypeMultiFramLayout typeMultiFramLayout; TypeSingleFramLayout tyySingleFramLayout; Button switchBtn; CustomFrameLayout xinxiFL; CustomFrameLayout shoucangFL; CustomFrameLayout dianyingFL; CustomFrameLayout yuleFL; CustomFrameLayout dianshiFL; CustomFrameLayout redFL; CustomFrameLayout yellowFL; CustomFrameLayout blueFL; CustomFrameLayout number1FL; CustomFrameLayout number2FL; CustomFrameLayout number3FL; CustomFrameLayout number4FL; CustomFrameLayout number5FL; CustomFrameLayout number6FL; CustomFrameLayout number7FL; CustomFrameLayout number8FL; CustomFrameLayout number9FL; CustomFrameLayout yinguiFL; CustomFrameLayout number0FL; CustomFrameLayout zimuFL; CustomFrameLayout jingyinFL; CustomFrameLayout toupingFL; CustomFrameLayout zhuyeFL; FrameLayout okFl; Button btnLeft; Button btnShang; Button btnRight; Button btnXia; Button btnOk; Button btnYingliangjia; Button btnYingliangjian; Button btnPindaojia; Button btnPindaojian; CustomFrameLayout caidanFL; CustomFrameLayout fanhuiFL; CustomFrameLayout shanyibuFL; CustomFrameLayout bofangFL; CustomFrameLayout xiayibuFL; CustomFrameLayout kuaituiFL; CustomFrameLayout zantingFL; CustomFrameLayout kusinjinFL; CustomFrameLayout dengguanFL; CustomFrameLayout tingzhiFL; CustomFrameLayout dankongdengFL; public void Show() { //初始化UI this.InitUI(); //初始化事件监听器 this.EventListener(); //读取数据 this.ReadData(); } private void ReadData() { } /// /// 事件监听器 /// private void EventListener() { //开关 switchBtn.MouseUpEventHandler += (senser, e) => { KeyControl("on_off", "开/关"); this.SetButtonIsSelected(switchBtn); }; //信息 xinxiFL.SetClickListener(() => { KeyControl("info", "信息"); }); //收藏 shoucangFL.SetClickListener(() => { KeyControl("collect", "收藏"); }); //电影 dianyingFL.SetClickListener(() => { KeyControl("movie", "电影"); }); //娱乐 yuleFL.SetClickListener(() => { KeyControl("recreation", "娱乐"); }); //电视 dianshiFL.SetClickListener(() => { KeyControl("tv", "电视"); }); //红色 redFL.SetClickListener(() => { KeyControl("red", "红色"); }); //黄色 yellowFL.SetClickListener(() => { KeyControl("yellow", "黄色"); }); //蓝色 blueFL.SetClickListener(() => { KeyControl("blue", "蓝色"); }); //1 number1FL.SetClickListener(() => { KeyControl("number_1", "1"); }); //2 number2FL.SetClickListener(() => { KeyControl("number_2", "2"); }); //3 number3FL.SetClickListener(() => { KeyControl("number_3", "3"); }); //4 number4FL.SetClickListener(() => { KeyControl("number_4", "4"); }); //5 number5FL.SetClickListener(() => { KeyControl("number_5", "5"); }); //6 number6FL.SetClickListener(() => { KeyControl("number_6", "6"); }); //7 number7FL.SetClickListener(() => { KeyControl("number_7", "7"); }); //8 number8FL.SetClickListener(() => { KeyControl("number_8", "8"); }); //9 number9FL.SetClickListener(() => { KeyControl("number_9", "9"); }); //音轨 yinguiFL.SetClickListener(() => { KeyControl("audio_track", "音轨"); }); //0 number0FL.SetClickListener(() => { KeyControl("number_0", "0"); }); //字幕 zimuFL.SetClickListener(() => { KeyControl("subtitle", "字幕"); }); //静音 jingyinFL.SetClickListener(() => { KeyControl("mute", "静音"); }); //投屏 toupingFL.SetClickListener(() => { KeyControl("main", "投屏"); }); //主页 zhuyeFL.SetClickListener(() => { KeyControl("home", "主页"); }); //左 btnLeft.MouseUpEventHandler += (sender, e) => { KeyControl("key_left", "左"); this.SetHighlightImagePath(okFl, "AksIcon/ykq_left_selected.png", "AksIcon/ykq_ok.png"); }; //上 btnShang.MouseUpEventHandler += (sender, e) => { KeyControl("key_up", "上"); this.SetHighlightImagePath(okFl, "AksIcon/ykq_shang_selected.png", "AksIcon/ykq_ok.png"); }; //右 btnRight.MouseDownEventHandler += (sender, e) => { KeyControl("key_right", "右"); this.SetHighlightImagePath(okFl, "AksIcon/ykq_right_selected.png", "AksIcon/ykq_ok.png"); }; //下 btnXia.MouseUpEventHandler += (sender, e) => { KeyControl("key_down", "下"); this.SetHighlightImagePath(okFl, "AksIcon/ykq_xia_selected.png", "AksIcon/ykq_ok.png"); }; //OK btnOk.MouseDownEventHandler += (sender, e) => { KeyControl("key_ok", "确定"); this.SetHighlightImagePath(okFl, "AksIcon/ykq_ok_selected.png", "AksIcon/ykq_ok.png"); }; //音量+ btnYingliangjia.MouseUpEventHandler += (sen, e) => { KeyControl("volume_up", "音量+"); this.SetButtonIsSelected(btnYingliangjia); }; //音量- btnYingliangjian.MouseUpEventHandler += (sen, e) => { KeyControl("volume_down", "音量-"); this.SetButtonIsSelected(btnYingliangjian); }; //频道+ btnPindaojia.MouseUpEventHandler += (sen, e) => { KeyControl("ch_up", "频道+"); this.SetButtonIsSelected(btnPindaojia); }; //频道- btnPindaojian.MouseUpEventHandler += (sen, e) => { KeyControl("ch_down", "频道-"); this.SetButtonIsSelected(btnPindaojian); }; //菜单 caidanFL.SetClickListener(() => { KeyControl("menu", "菜单"); }); //返回 fanhuiFL.SetClickListener(() => { KeyControl("cancel", "返回"); }); //上一部 shanyibuFL.SetClickListener(() => { KeyControl("part_up", "上一部"); }); //播放 bofangFL.SetClickListener(() => { KeyControl("play", "播放"); }); //下一部 xiayibuFL.SetClickListener(() => { KeyControl("part_down", "下一部"); }); //快退 kuaituiFL.SetClickListener(() => { KeyControl("fast_rewind", "快退"); }); //暂停 zantingFL.SetClickListener(() => { KeyControl("pause", "暂停"); }); //快进 kusinjinFL.SetClickListener(() => { KeyControl("fast_forward", "快进"); }); //灯关 dengguanFL.SetClickListener(() => { KeyControl("lamp", "灯关"); }); //停止 tingzhiFL.SetClickListener(() => { KeyControl("stop", "停止"); }); //单控灯 dankongdengFL.SetClickListener(() => { KeyControl("lamp_plc", "单控灯"); }); if (typeMultiFramLayout != null) { //时序器 typeMultiFramLayout.SetLeftFlClickListener((f) => { SxqPage sxqPage = new SxqPage(this.sequencerList, this.remoteControl.deviceId); MainPage.BasePageView.AddChidren(sxqPage); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; sxqPage.Show(); }); //设备切换 typeMultiFramLayout.SetRightFlClickListener((f) => { action?.Invoke(IntType.Control); }); } if (tyySingleFramLayout != null) { tyySingleFramLayout.SetClickListener((f) => { action?.Invoke(IntType.Control); }); } } /// /// 初始化界面 /// private void InitUI() { this.BackgroundColor = MusicColor.ViewColor; Button btnTitle = new Button { Y = Application.GetRealHeight(16), X = Application.GetRealWidth(16), Height = Application.GetRealHeight(22), Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.CenterLeft, TextColor = MusicColor.TextColor, TextSize = TextSize.Text16, Text = this.remoteControl.name, IsBold = true, }; this.AddChidren(btnTitle); FrameLayout bottomLayout = new FrameLayout { Y = btnTitle.Bottom + Application.GetRealHeight(16), Width = Application.GetRealWidth(240), Height = Application.GetRealHeight(1095 - 122 - 60),//遥控器固定高度 Radius = (uint)Application.GetRealHeight(17), BackgroundColor = 0xff798394, Gravity = Gravity.CenterHorizontal, }; this.AddChidren(bottomLayout); FrameLayout layout = new FrameLayout { Y = btnTitle.Bottom + Application.GetRealHeight(16), //X = Application.GetRealWidth(71), Width = Application.GetRealWidth(232), Height = Application.GetRealHeight(1095 - 122 - 60),//遥控器固定高度 Radius = (uint)Application.GetRealHeight(17), BackgroundColor = 0xff19181E, Gravity = Gravity.CenterHorizontal, }; this.AddChidren(layout); FrameLayout switchFl = new FrameLayout() { Y = Application.GetRealHeight(32), Height = Application.GetRealWidth(48), Width = Application.GetRealWidth(48), Gravity = Gravity.CenterHorizontal, BackgroundColor = 0xff201F25, Radius = (uint)Application.GetRealWidth(24), }; layout.AddChidren(switchFl); switchBtn = new Button { Height = Application.GetRealWidth(48), Width = Application.GetRealWidth(48), Gravity = Gravity.Center, UnSelectedImagePath = "AksIcon/ykq_kai.png", SelectedImagePath = "AksIcon/ykq_kaiguang_selected.png" }; switchFl.AddChidren(switchBtn); switchBtn.MouseDownEventHandler += (senser, e) => { switchBtn.IsSelected = true; }; switchBtn.MouseUpOutsideEventHandler += (senser, e) => { switchBtn.IsSelected = false; }; int h = 49 - 6; int offset = 28;//x轴偏移量 int septal = 36;//间隔 #region var line1Fl = new FrameLayout { Y = switchFl.Bottom + Application.GetRealHeight(12), Height = Application.GetRealHeight(h), }; layout.AddChidren(line1Fl); xinxiFL = new CustomFrameLayout(); line1Fl.AddChidren(xinxiFL); xinxiFL.X = Application.GetRealWidth(offset); xinxiFL.AddImageView(); xinxiFL.AddTextButtonView(); xinxiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_xinxi.png"; xinxiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_xinxi_selected.png"; xinxiFL.GetTextButton().Text = "信息"; xinxiFL.AddClickView(); shoucangFL = new CustomFrameLayout(); line1Fl.AddChidren(shoucangFL); shoucangFL.X = xinxiFL.Right + Application.GetRealWidth(110); shoucangFL.AddImageView(); shoucangFL.AddTextButtonView(); shoucangFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_shoucang.png"; shoucangFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_shoucang_selected.png"; shoucangFL.GetTextButton().Text = "收藏"; shoucangFL.AddClickView(); var line2Fl = new FrameLayout { Y = line1Fl.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(h), }; layout.AddChidren(line2Fl); dianyingFL = new CustomFrameLayout(); line2Fl.AddChidren(dianyingFL); dianyingFL.X = Application.GetRealWidth(offset); dianyingFL.AddImageView(); dianyingFL.AddTextButtonView(); dianyingFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_dianying.png"; dianyingFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_dianying_selected.png"; dianyingFL.GetTextButton().Text = "电影"; dianyingFL.AddClickView(); yuleFL = new CustomFrameLayout(); line2Fl.AddChidren(yuleFL); yuleFL.X = dianyingFL.Right + Application.GetRealWidth(septal); yuleFL.AddImageView(); yuleFL.AddTextButtonView(); yuleFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_yule.png"; yuleFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_yule_selected.png"; yuleFL.GetTextButton().Text = "娱乐"; yuleFL.AddClickView(); dianshiFL = new CustomFrameLayout(); line2Fl.AddChidren(dianshiFL); dianshiFL.X = yuleFL.Right + Application.GetRealWidth(septal); dianshiFL.AddImageView(); dianshiFL.AddTextButtonView(); dianshiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_dianshi.png"; dianshiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_dianshi_selected.png"; dianshiFL.GetTextButton().Text = "电视"; dianshiFL.AddClickView(); var line3Fl = new FrameLayout { Y = line2Fl.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(h), }; layout.AddChidren(line3Fl); redFL = new CustomFrameLayout(); line3Fl.AddChidren(redFL); redFL.X = Application.GetRealWidth(offset); redFL.AddColorButtonView(); redFL.GetColorButto().BackgroundColor = MusicColor.RedColor; redFL.AddClickView(); yellowFL = new CustomFrameLayout(); line3Fl.AddChidren(yellowFL); yellowFL.X = redFL.Right + Application.GetRealWidth(septal); yellowFL.AddColorButtonView(); yellowFL.GetColorButto().BackgroundColor = 0xffFC9C04; yellowFL.AddClickView(); blueFL = new CustomFrameLayout(); line3Fl.AddChidren(blueFL); blueFL.X = yellowFL.Right + Application.GetRealWidth(septal); blueFL.AddColorButtonView(); blueFL.GetColorButto().BackgroundColor = MusicColor.MusicTxet14SelectedColor; blueFL.AddClickView(); var line4Fl = new FrameLayout { Y = line3Fl.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(h), }; layout.AddChidren(line4Fl); number1FL = new CustomFrameLayout(); line4Fl.AddChidren(number1FL); number1FL.X = Application.GetRealWidth(offset); number1FL.AddNumberButtonView(); number1FL.GetNumberButto().Text = "1"; number1FL.AddClickView(); number2FL = new CustomFrameLayout(); line4Fl.AddChidren(number2FL); number2FL.X = number1FL.Right + Application.GetRealWidth(septal); number2FL.AddNumberButtonView(); number2FL.GetNumberButto().Text = "2"; number2FL.AddClickView(); number3FL = new CustomFrameLayout(); line4Fl.AddChidren(number3FL); number3FL.X = number2FL.Right + Application.GetRealWidth(septal); number3FL.AddNumberButtonView(); number3FL.GetNumberButto().Text = "3"; number3FL.AddClickView(); var line5Fl = new FrameLayout { Y = line4Fl.Bottom, Height = Application.GetRealHeight(h), }; layout.AddChidren(line5Fl); number4FL = new CustomFrameLayout(); line5Fl.AddChidren(number4FL); number4FL.X = Application.GetRealWidth(offset); number4FL.AddNumberButtonView(); number4FL.GetNumberButto().Text = "4"; number4FL.AddClickView(); number5FL = new CustomFrameLayout(); line5Fl.AddChidren(number5FL); number5FL.X = number4FL.Right + Application.GetRealWidth(septal); number5FL.AddNumberButtonView(); number5FL.GetNumberButto().Text = "5"; number5FL.AddClickView(); number6FL = new CustomFrameLayout(); line5Fl.AddChidren(number6FL); number6FL.X = number5FL.Right + Application.GetRealWidth(septal); number6FL.AddNumberButtonView(); number6FL.GetNumberButto().Text = "6"; number6FL.AddClickView(); var line6Fl = new FrameLayout { Y = line5Fl.Bottom, Height = Application.GetRealHeight(h), }; layout.AddChidren(line6Fl); number7FL = new CustomFrameLayout(); line6Fl.AddChidren(number7FL); number7FL.X = Application.GetRealWidth(offset); number7FL.AddNumberButtonView(); number7FL.GetNumberButto().Text = "7"; number7FL.AddClickView(); number8FL = new CustomFrameLayout(); line6Fl.AddChidren(number8FL); number8FL.X = number7FL.Right + Application.GetRealWidth(septal); number8FL.AddNumberButtonView(); number8FL.GetNumberButto().Text = "8"; number8FL.AddClickView(); number9FL = new CustomFrameLayout(); line6Fl.AddChidren(number9FL); number9FL.X = number8FL.Right + Application.GetRealWidth(septal); number9FL.AddNumberButtonView(); number9FL.GetNumberButto().Text = "9"; number9FL.AddClickView(); var line7Fl = new FrameLayout { Y = line6Fl.Bottom, Height = Application.GetRealHeight(h), }; layout.AddChidren(line7Fl); yinguiFL = new CustomFrameLayout(); line7Fl.AddChidren(yinguiFL); yinguiFL.X = Application.GetRealWidth(offset); yinguiFL.AddImageView(); yinguiFL.AddTextButtonView(); yinguiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_yingui.png"; yinguiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_yingui_selected.png"; yinguiFL.GetTextButton().Text = "音轨"; yinguiFL.AddClickView(); number0FL = new CustomFrameLayout(); line7Fl.AddChidren(number0FL); number0FL.X = yinguiFL.Right + Application.GetRealWidth(septal); number0FL.AddNumberButtonView(); number0FL.GetNumberButto().Text = "0"; number0FL.AddClickView(); zimuFL = new CustomFrameLayout(); line7Fl.AddChidren(zimuFL); zimuFL.X = number0FL.Right + Application.GetRealWidth(septal); zimuFL.AddImageView(); zimuFL.AddTextButtonView(); zimuFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_zimu.png"; zimuFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_zimu_selected.png"; zimuFL.GetTextButton().Text = "字幕"; zimuFL.AddClickView(); zimuFL.AddClickView(); var line8Fl = new FrameLayout { Y = line7Fl.Bottom + Application.GetRealHeight(16), Height = Application.GetRealHeight(h), }; layout.AddChidren(line8Fl); jingyinFL = new CustomFrameLayout(); line8Fl.AddChidren(jingyinFL); jingyinFL.X = Application.GetRealWidth(offset); jingyinFL.AddImageView(); jingyinFL.AddTextButtonView(); jingyinFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_jingyin.png"; jingyinFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_jingyin_selected.png"; jingyinFL.GetTextButton().Text = "静音"; jingyinFL.AddClickView(); toupingFL = new CustomFrameLayout(); line8Fl.AddChidren(toupingFL); toupingFL.X = jingyinFL.Right + Application.GetRealWidth(septal); toupingFL.AddImageView(); toupingFL.AddTextButtonView(); toupingFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_toupin.png"; toupingFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_touping_selected.png"; toupingFL.GetTextButton().Text = "投屏"; toupingFL.AddClickView(); zhuyeFL = new CustomFrameLayout(); line8Fl.AddChidren(zhuyeFL); zhuyeFL.X = toupingFL.Right + Application.GetRealWidth(septal); zhuyeFL.AddImageView(); zhuyeFL.AddTextButtonView(); zhuyeFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_zhuye.png"; zhuyeFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_zhuye_selected.png"; zhuyeFL.GetTextButton().Text = "主页"; zhuyeFL.AddClickView(); #region 菜单布局 var baseFl = new BaseFramLayout { Y = line8Fl.Bottom, Height = Application.GetRealHeight(207 - 32 - 12), }; layout.AddChidren(baseFl); btnYingliangjia = new Button { Y = Application.GetRealHeight(16), X = Application.GetRealWidth(26), Width = Application.GetRealWidth(36), Height = Application.GetRealWidth(36), UnSelectedImagePath = "AksIcon/ykq_yingliangjia.png", SelectedImagePath = "AksIcon/ykq_yingliangjia_selected.png", }; baseFl.AddChidren(btnYingliangjia); btnYingliangjian = new Button { Y = btnYingliangjia.Bottom + Application.GetRealHeight(71), X = Application.GetRealWidth(26), Width = Application.GetRealWidth(36), Height = Application.GetRealWidth(36), UnSelectedImagePath = "AksIcon/ykq_yingliangjian.png", SelectedImagePath = "AksIcon/ykq_yingliangjian_selected.png", }; baseFl.AddChidren(btnYingliangjian); btnPindaojia = new Button { Y = Application.GetRealHeight(16), X = Application.GetRealWidth(170), Width = Application.GetRealWidth(36), Height = Application.GetRealWidth(36), UnSelectedImagePath = "AksIcon/ykq_pindaojia.png", SelectedImagePath = "AksIcon/ykq_pindaojia_selected.png", }; baseFl.AddChidren(btnPindaojia); btnPindaojian = new Button { Y = btnPindaojia.Bottom + Application.GetRealHeight(71), X = Application.GetRealWidth(170), Width = Application.GetRealWidth(36), Height = Application.GetRealWidth(36), UnSelectedImagePath = "AksIcon/ykq_pindaojian.png", SelectedImagePath = "AksIcon/ykq_pindaojian_selected.png", }; baseFl.AddChidren(btnPindaojian); okFl = new FrameLayout { Y = Application.GetRealHeight(16), Height = Application.GetRealWidth(143), Width = Application.GetRealWidth(143), BackgroundImagePath = "AksIcon/ykq_ok.png", Gravity = Gravity.CenterHorizontal, }; baseFl.AddChidren(okFl); btnLeft = new Button { Width = Application.GetRealWidth(40), Height = Application.GetRealHeight(20), Gravity = Gravity.CenterVertical, }; okFl.AddChidren(btnLeft); btnShang = new Button { Width = Application.GetRealWidth(40), Height = Application.GetRealHeight(30), Gravity = Gravity.CenterHorizontal, }; okFl.AddChidren(btnShang); btnRight = new Button { Width = Application.GetRealWidth(40), Height = Application.GetRealHeight(20), Gravity = Gravity.CenterRight, }; okFl.AddChidren(btnRight); btnXia = new Button { Width = Application.GetRealWidth(40), Height = Application.GetRealHeight(30), Gravity = Gravity.BottomCenter, }; okFl.AddChidren(btnXia); btnOk = new Button { Width = Application.GetRealWidth(52), Height = Application.GetRealWidth(52), Gravity = Gravity.Center, }; okFl.AddChidren(btnOk); #endregion var line9Fl = new FrameLayout { Y = baseFl.Bottom, Height = Application.GetRealHeight(h), }; layout.AddChidren(line9Fl); caidanFL = new CustomFrameLayout(); line9Fl.AddChidren(caidanFL); caidanFL.X = Application.GetRealWidth(offset); caidanFL.AddImageView(); caidanFL.AddTextButtonView(); caidanFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_caidan.png"; caidanFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_caidan_selected.png"; caidanFL.GetTextButton().Text = "菜单"; caidanFL.AddClickView(); fanhuiFL = new CustomFrameLayout(); line9Fl.AddChidren(fanhuiFL); fanhuiFL.X = caidanFL.Right + Application.GetRealWidth(110); fanhuiFL.AddImageView(); fanhuiFL.AddTextButtonView(); fanhuiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_fanhui.png"; fanhuiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_fanhui_selected.png"; fanhuiFL.GetTextButton().Text = "返回"; fanhuiFL.AddClickView(); var line10Fl = new FrameLayout { Y = line9Fl.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(h), }; layout.AddChidren(line10Fl); shanyibuFL = new CustomFrameLayout(); line10Fl.AddChidren(shanyibuFL); shanyibuFL.X = Application.GetRealWidth(offset); shanyibuFL.AddImageView(); shanyibuFL.AddTextButtonView(); shanyibuFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_shangyibu.png"; shanyibuFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_shangyibu_selected.png"; shanyibuFL.GetTextButton().Text = "上一部"; shanyibuFL.AddClickView(); bofangFL = new CustomFrameLayout(); line10Fl.AddChidren(bofangFL); bofangFL.X = shanyibuFL.Right + Application.GetRealWidth(septal); bofangFL.AddImageView(); bofangFL.AddTextButtonView(); bofangFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_bofan.png"; bofangFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_bofan_selected.png"; bofangFL.GetTextButton().Text = "播放"; bofangFL.AddClickView(); xiayibuFL = new CustomFrameLayout(); line10Fl.AddChidren(xiayibuFL); xiayibuFL.X = bofangFL.Right + Application.GetRealWidth(septal); xiayibuFL.AddImageView(); xiayibuFL.AddTextButtonView(); xiayibuFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_xiayibu.png"; xiayibuFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_xiayibu_selected.png"; xiayibuFL.GetTextButton().Text = "下一部"; xiayibuFL.AddClickView(); var line11Fl = new FrameLayout { Y = line10Fl.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(h), }; layout.AddChidren(line11Fl); kuaituiFL = new CustomFrameLayout(); line11Fl.AddChidren(kuaituiFL); kuaituiFL.X = Application.GetRealWidth(offset); kuaituiFL.AddImageView(); kuaituiFL.AddTextButtonView(); kuaituiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_kuaitui.png"; kuaituiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_kuaijin_selected.png"; kuaituiFL.GetTextButton().Text = "快退"; kuaituiFL.AddClickView(); zantingFL = new CustomFrameLayout(); line11Fl.AddChidren(zantingFL); zantingFL.X = kuaituiFL.Right + Application.GetRealWidth(septal); zantingFL.AddImageView(); zantingFL.AddTextButtonView(); zantingFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_zanting.png"; zantingFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_zanting_selected.png"; zantingFL.GetTextButton().Text = "暂停"; zantingFL.AddClickView(); kusinjinFL = new CustomFrameLayout(); line11Fl.AddChidren(kusinjinFL); kusinjinFL.X = zantingFL.Right + Application.GetRealWidth(septal); kusinjinFL.AddImageView(); kusinjinFL.AddTextButtonView(); kusinjinFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_kuaijin.png"; kusinjinFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_kuaitui_selected.png"; kusinjinFL.GetTextButton().Text = "快进"; kusinjinFL.AddClickView(); var line12Fl = new FrameLayout { Y = line11Fl.Bottom + Application.GetRealHeight(8), Height = Application.GetRealHeight(h), }; layout.AddChidren(line12Fl); dengguanFL = new CustomFrameLayout(); line12Fl.AddChidren(dengguanFL); dengguanFL.X = Application.GetRealWidth(offset); dengguanFL.AddImageView(); dengguanFL.AddTextButtonView(); dengguanFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_dengguan.png"; dengguanFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_dengguang_selected.png"; dengguanFL.GetTextButton().Text = "灯光1"; dengguanFL.AddClickView(); tingzhiFL = new CustomFrameLayout(); line12Fl.AddChidren(tingzhiFL); tingzhiFL.X = dengguanFL.Right + Application.GetRealWidth(septal); tingzhiFL.AddImageView(); tingzhiFL.AddTextButtonView(); tingzhiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_tingzhi.png"; tingzhiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_tingzhi_selected.png"; tingzhiFL.GetTextButton().Text = "停止"; tingzhiFL.AddClickView(); dankongdengFL = new CustomFrameLayout(); line12Fl.AddChidren(dankongdengFL); dankongdengFL.X = tingzhiFL.Right + Application.GetRealWidth(septal); dankongdengFL.AddImageView(); dankongdengFL.AddTextButtonView(); dankongdengFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_dankongdeng.png"; dankongdengFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_dankongdeng_selected.png"; dankongdengFL.GetTextButton().Text = "灯光2"; dankongdengFL.AddClickView(); #endregion //底部容器 CornerFramLayout cornerBottomFram = new CornerFramLayout(343, 72, 17); cornerBottomFram.X = Application.GetRealWidth(16); cornerBottomFram.Y = layout.Bottom + Application.GetRealHeight(16); cornerBottomFram.BackgroundColor = MusicColor.WhiteColor; this.AddChidren(cornerBottomFram); if (sequencerList.Count == 0) { //没有时序器 tyySingleFramLayout = new TypeSingleFramLayout(); tyySingleFramLayout.AddView(cornerBottomFram); tyySingleFramLayout.singleFramLayout.X = Application.GetRealWidth(226); tyySingleFramLayout.singleFramLayout.Width = Application.GetRealWidth(101); tyySingleFramLayout.singleFramLayout.Gravity = Gravity.CenterVertical; tyySingleFramLayout.btnName.Text = this.remoteControl.name; tyySingleFramLayout.btnName.X = Application.GetRealWidth(16); tyySingleFramLayout.btnName.Width = Application.GetRealWidth(48); tyySingleFramLayout.btnRightImage.X = tyySingleFramLayout.btnName.Right + Application.GetRealWidth(8); tyySingleFramLayout.btnRightImage.Width = Application.GetRealWidth(16); tyySingleFramLayout.btnRightImage.Height = Application.GetRealWidth(16); tyySingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png"; tyySingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical; tyySingleFramLayout.btnLeftImage.Visible = false; tyySingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right, tyySingleFramLayout.singleFramLayout, tyySingleFramLayout.btnName, tyySingleFramLayout.btnRightImage, 48, 200); } else { typeMultiFramLayout = new TypeMultiFramLayout(); typeMultiFramLayout.multiFramLayout.Y = Application.GetRealHeight(16); typeMultiFramLayout.AddView(cornerBottomFram); typeMultiFramLayout.btnRightName.Text = this.remoteControl.name; } this.AdjustRealHeight(16); } /// /// 按键控制 /// /// <按键标识/param> /// <按键名称(打印用的)/param> private void KeyControl(string keypad, string keyName, bool isSupport = true) { //CommonMethod.Current.Loading.Start(); CommonMethod.Current.SunThread(() => { try { SendMethod.Current.KeypadExecute(remoteControl.deviceId, remoteControl.rcId, keypad, keyName, isSupport); } catch { } finally { CommonMethod.Current.MainThread(() => { //CommonMethod.Current.Loading.Hide(); }); } }); } } /// /// 自己弄一个FrameLayout /// class CustomFrameLayout : BaseFramLayout { public const int widthFrameLayout = 36; public const int heightFrameLayout = 49 - 6; public CustomFrameLayout(int width = widthFrameLayout, int height = heightFrameLayout) { this.Width = Application.GetRealWidth(width); this.Height = Application.GetRealHeight(height); } Button btnImage = new Button { Width = Application.GetRealWidth(32), Height = Application.GetRealWidth(32), Gravity = Gravity.TopCenter, }; Button btnText = new Button { Width = Application.GetRealWidth(36), Height = Application.GetRealHeight(16), TextSize = TextSize.Text12, TextColor = MusicColor.WhiteColor, SelectedTextColor = MusicColor.MusicTxet14SelectedColor, TextAlignment = TextAlignment.Center, Gravity = Gravity.CenterHorizontal, Padding = new Padding(0, 0, 0, 0), }; Button btnNumber = new Button { Width = Application.GetRealWidth(widthFrameLayout), Height = Application.GetRealHeight(heightFrameLayout), Gravity = Gravity.Center, TextSize = 20, TextColor = MusicColor.WhiteColor, SelectedTextColor = MusicColor.MusicTxet14SelectedColor, IsBold = true, }; Button btn = new Button { Width = Application.GetRealWidth(12), Height = Application.GetRealWidth(12), Gravity = Gravity.Center, Radius = (uint)Application.GetRealWidth(6), BackgroundColor = 0x00000000, SelectedBackgroundColor = 0xFFF2F3F7, }; public FrameLayout clickFl = new FrameLayout { Width = Application.GetRealWidth(widthFrameLayout), Height = Application.GetRealHeight(heightFrameLayout), }; public void AddImageView() { this.AddChidren(btnImage); } public void AddTextButtonView() { btnText.Y = btnImage.Bottom; this.AddChidren(btnText); } public void AddColorButtonView() { this.AddChidren(btn); } public void AddNumberButtonView() { this.AddChidren(btnNumber); } public Button GetImageButton() { return this.btnImage; } public Button GetTextButton() { return this.btnText; } public Button GetColorButto() { return this.btn; } public Button GetNumberButto() { return this.btnNumber; } public void AddClickView() { this.AddChidren(clickFl); } /// /// 事件监听方法 /// 是定要添加AddClickView(),点击事件才生效; /// /// 回调(父类对象) public void SetClickListener(Action action) { clickFl.MouseUpEventHandler += (sender, e) => { action?.Invoke(); //按下去改变背景颜色 btnImage.IsSelected = true; btnText.IsSelected = true; btnNumber.IsSelected = true; btn.IsSelected = true; new System.Threading.Thread(() => { System.Threading.Thread.Sleep(millisecondsTimeout); Application.RunOnMainThread(() => { //弹起来还原背景颜色 btnImage.IsSelected = false; btnText.IsSelected = false; btnNumber.IsSelected = false; btn.IsSelected = false; }); }) { IsBackground = true }.Start(); }; } } }