From 2d5cd35af7437ad4015d38594d8c721dc6166b11 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 29 八月 2023 09:22:38 +0800 Subject: [PATCH] Merge branch 'wjc' of http://59.41.255.150:6688/r/~wxr/OnPro into wjc --- HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs | 1216 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,216 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs new file mode 100644 index 0000000..e939fda --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs @@ -0,0 +1,1216 @@ +锘縰sing Shared; +using System; +using System.Collections.Generic; +using HDL_ON.Entity; +using HDL_ON.UI.Music; +using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; +using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView; + +namespace HDL_ON.UI.UI2.FuntionControlView.HisenseTV +{ + /// <summary> + /// 娴蜂俊鐢佃鐣岄潰 + /// </summary> + public class HisenseTvPage : BaseFramLayout + { + + + #region -------鍙橀噺澹版槑--------- + /// <summary> + /// 璁惧 + /// </summary> + private Function device; + /// <summary> + /// 涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢 + /// </summary> + private Button btnDeviceName; + /// <summary> + /// 涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢 + /// </summary> + private Button btnRoomName; + /// <summary> + /// 涓婁竴绾х晫闈㈢殑鏀惰棌鎺т欢 + /// </summary> + private Button btnCollectionIcon; + + /// <summary> + /// 澶撮儴甯冨眬 + /// </summary> + private TopView topView; + BaseFramLayout baseCloseFFL; + VerticalScrolViewLayout vv; + /// <summary> + /// 褰撳墠璁惧鍚嶇О + /// </summary> + private Button btnOpenCurrDeviceName; + /// <summary> + /// 鍖哄煙 + /// </summary> + private Button btnOpenCurrDeviceRoom; + /// <summary> + ///鏀惰棌鍥炬爣 + /// </summary> + private Button btnOpenCollectIcon; + CustomFrameLayout shouyeFL; + CustomFrameLayout kaiguanFL; + CustomFrameLayout caidanFL; + Button btn_jia; + Button btn_jian; + CustomButton bofangBtn; + CustomButton zantingBtn; + CustomButton kuaijinBtn; + CustomButton kauituiBtn; + CustomButton jingyinBtn; + CustomButton shezhiBtn; + CustomButton jiechujingyinBtn; + CustomButton fanhuiBtn; + MenuFramLayout muenFrameLayout; + SourceFrameLayout sourceFrameLayout; + + + Button btnCloseCollectIcon; + Button btnCloseCurrDeviceName; + Button btnCloseCurrDeviceRoom; + Button clickBtn; + + /// <summary> + /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰 + /// </summary> + private CommonMethod.Comerom comerom; + /// <summary> + /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟 + /// </summary> + public Action action; + #endregion + + /// <summary> + /// 鏋勯�犲嚱鏁� + /// </summary> + /// <param name="function">璁惧</param> + /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> + /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> + /// <param name="btnCollectionIcon">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> + public HisenseTvPage(Function function, Button btnDeviceName, Button btnRoomName, Button btnCollectionIcon, CommonMethod.Comerom comerom, Action action) + { + this.device = function; + this.btnDeviceName = btnDeviceName; + this.btnRoomName = btnRoomName; + this.btnCollectionIcon = btnCollectionIcon; + this.comerom = comerom; + this.action = action; + + } + + public void Show() + { + //鍒濆鍖朥I + this.InitTopUI(); + this.InitOpenUI(); + this.InitCloseUI(); + this.CurrentAssignPage(); + //鍒濆鍖栦簨浠� + this.EventListener(); + //璇诲彇鏁版嵁 + this.ReadData(); + + } + + /// <summary> + /// 娉ㄥ唽浜嬩欢 + /// </summary> + private void EventListener() + { + //杩斿洖 + this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) => + { + this.RemoveFromParent(); + }; + //璁剧疆 + this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) => + { + CommonMethod.Current.MainThread(() => + { + //璋冪敤绉�缁曠殑鐣岄潰 + var infoView = new UI.FunctionBaseInfoSetPage(this.device, () => + { + if (this.btnDeviceName == null || this.btnRoomName == null || this.device == null) + { + return; + } + ////鍒锋柊鏄剧ず + this.btnDeviceName.Text = this.device.name; + this.btnRoomName.Text = this.device.GetRoomListName(); + // + this.btnOpenCurrDeviceName.Text = this.device.name; + this.btnOpenCurrDeviceRoom.Text = this.device.GetRoomListName(); + // + this.btnCloseCurrDeviceName.Text = this.device.name; + this.btnCloseCurrDeviceRoom.Text = this.device.GetRoomListName(); + this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害 + + }); + infoView.actionDel += () => + { + //瑙g粦璁惧鍚� + this.RemoveFromParent(); + this.action?.Invoke(); + + }; + MainPage.BasePageView.AddChidren(infoView); + infoView.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }); + }; + //鏀惰棌 + this.btnOpenCollectIcon.MouseUpEventHandler += (sender, e) => + { + btnOpenCollectIcon.IsSelected = this.device.collect = !btnOpenCollectIcon.IsSelected; + this.device.CollectFunction(); + btnCloseCollectIcon.IsSelected = btnOpenCollectIcon.IsSelected; + this.btnCollectionIcon.IsSelected = btnOpenCollectIcon.IsSelected; + }; + + //棣栭〉 + shouyeFL.SetClickListener((fl, btnImage, btnText) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.home_page, ""); + }); + //鍏虫満 + kaiguanFL.SetClickListener((fl, btnImage, btnText) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.on_off, "off", (isBool) => + { + if (isBool) + { + CommonMethod.Current.MainThread(() => + { + vv.Visible = false; + baseCloseFFL.Visible = true; + }); + } + else + { + //鎻愮ず:鍏虫満澶辫触; + } + }); + }); + //鑿滃崟 + caidanFL.SetClickListener((fl, btnImage, btnText) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11"); + + }); + //闊抽噺+ + btn_jia.MouseDownEventHandler += (sender, e) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.volume_add, ""); + + }; + //闊抽噺- + btn_jian.MouseDownEventHandler += (sender, e) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.volume_subtract, ""); + }; + //鎾斁 + bofangBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.media_play, ""); + + }); + //鏆傚仠 + zantingBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.media_pause, ""); + }); + //蹇繘 + kuaijinBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.fast_forward, ""); + }); + //蹇�� + kauituiBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.fast_back, ""); + }); + //闈欓煶 + jingyinBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.mute, "1"); + }); + //璁剧疆 + shezhiBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.system_setting, ""); + }); + //瑙i櫎闈欓煶 + jiechujingyinBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.mute, "0"); + }); + //杩斿洖 + fanhuiBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "5"); + }); + //涓� + muenFrameLayout.SetTopClickListener((muen) => + { + + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "0"); + + }); + //涓� + muenFrameLayout.SetBottomClickListener((muen) => + { + + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "1"); + + }); + //宸� + muenFrameLayout.SetLeftClickListener((muen) => + { + + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "2"); + + }); + //鍙� + muenFrameLayout.SetRightClickListener((muen) => + { + + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "3"); + + }); + //OK + muenFrameLayout.SetOkClickListener((muen) => + { + + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "4"); + + }); + //淇″彿婧� + sourceFrameLayout.selectAction += (text) => + { + string value = text.Replace(" ", "_"); + ControlCommand(HisenseTVFunctionalAttributeConstant.signal, value); + }; + + + //鏀惰棌(鍏虫満) + this.btnCloseCollectIcon.MouseUpEventHandler += (sender, e) => + { + btnCloseCollectIcon.IsSelected = this.device.collect = !btnCloseCollectIcon.IsSelected; + this.device.CollectFunction(); + btnOpenCollectIcon.IsSelected = btnCloseCollectIcon.IsSelected; + this.btnCollectionIcon.IsSelected = btnCloseCollectIcon.IsSelected; + }; + //寮�鏈� + clickBtn.MouseDownEventHandler += (sen, e) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.on_off, "on", (isBool) => + { + if (isBool) + { + CommonMethod.Current.MainThread(() => + { + vv.Visible = true; + baseCloseFFL.Visible = false; + }); + } + else + { + //鎻愮ず:寮�鏈哄け璐�; + } + }); + + }; + + } + /// <summary> + /// 鍙戦�佹帶鍒跺睘鎬ф寚浠� + /// </summary> + /// <param name="key">鍔熻兘灞炴��(璇泙涓婂畾涔夌殑)</param> + /// <param name="value">鍊�</param> + /// <param name="action">缁撴灉鍥炶皟(榛樿涓嶅洖璋�)</param> + private void ControlCommand(string key, string value, Action<bool> action = null) + { + try + { + Dictionary<string, string> dic = new Dictionary<string, string>(); + dic.Add(key, value); + Send.Current.SendControlCommand(this.device, dic, action); + } + catch { } + } + /// <summary> + /// 鍒濆鍖栨暟鎹� + /// </summary> + private void ReadData() + { + CommonMethod.Current.Loading.Start(); + CommonMethod.Current.SunThread(() => + { + try + { + CommonMethod.Current.MainThread(() => + { + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + CommonMethod.Current.Loading.Hide(); + }); + } + }); + } + + #region -------鐣岄潰甯冨眬--------- + /// <summary> + /// 鍒濆鍖栥�愬紑鏈恒�戠晫闈� + /// </summary> + private void InitOpenUI() + { + #region ---鐣岄潰甯冨眬--- + vv = new VerticalScrolViewLayout + { + Y = topView.fLayout.Bottom, + Height = Application.GetRealHeight(H_W.H - H_W.T_Height), + }; + this.AddChidren(vv); + var baseOpenFL = new BaseFramLayout(); + vv.AddChidren(baseOpenFL); + var backgroundOpenFl = new FrameLayout + { + Y = Application.GetRealHeight(24), + X = Application.GetRealWidth(24), + Height = Application.GetRealHeight(648), + Width = Application.GetRealWidth(327), + BackgroundImagePath = "HisenseTv/onbj.png", + }; + baseOpenFL.AddChidren(backgroundOpenFl); + + baseOpenFL.AdjustRealHeight(16); + + btnOpenCollectIcon = 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", + IsSelected = this.device.collect, + }; + backgroundOpenFl.AddChidren(btnOpenCollectIcon); + + btnOpenCurrDeviceName = new Button + { + TextSize = TextSize.Text24, + TextColor = MusicColor.Text18Color, + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(33), + Y = Application.GetRealHeight(16), + X = Application.GetRealWidth(16), + Text = this.device.name, + TextAlignment = TextAlignment.CenterLeft, + IsBold = true + }; + backgroundOpenFl.AddChidren(btnOpenCurrDeviceName); + + + btnOpenCurrDeviceRoom = new Button + { + TextSize = TextSize.Text12, + TextColor = MusicColor.MusicNoTxetColor, + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(17), + Y = btnOpenCurrDeviceName.Bottom + Application.GetRealHeight(4), + X = Application.GetRealWidth(16), + Text = this.device.GetRoomListName(), + TextAlignment = TextAlignment.CenterLeft, + }; + backgroundOpenFl.AddChidren(btnOpenCurrDeviceRoom); + + int yHeight = btnOpenCurrDeviceRoom.Bottom + Application.GetRealHeight(16); + shouyeFL = new CustomFrameLayout(); + backgroundOpenFl.AddChidren(shouyeFL); + shouyeFL.X = Application.GetRealWidth(24); + shouyeFL.Y = yHeight; + shouyeFL.AddImageView(); + shouyeFL.AddTextButtonView(); + shouyeFL.GetImageButton().UnSelectedImagePath = "HisenseTv/shouye.png"; + shouyeFL.GetTextButton().TextID = StringId.shouye; + + + kaiguanFL = new CustomFrameLayout(); + backgroundOpenFl.AddChidren(kaiguanFL); + kaiguanFL.X = shouyeFL.Right + Application.GetRealWidth(37); + kaiguanFL.Y = yHeight; + kaiguanFL.AddImageView(); + kaiguanFL.AddTextButtonView(); + kaiguanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/kaiguan.png"; + kaiguanFL.GetTextButton().TextID = StringId.guanji; + + caidanFL = new CustomFrameLayout(); + backgroundOpenFl.AddChidren(caidanFL); + caidanFL.X = kaiguanFL.Right + Application.GetRealWidth(37); + caidanFL.Y = yHeight; + caidanFL.AddImageView(); + caidanFL.AddTextButtonView(); + caidanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/caidan.png"; + caidanFL.GetTextButton().TextID = StringId.caidan; + + var yinliangFL = new FrameLayout(); + backgroundOpenFl.AddChidren(yinliangFL); + yinliangFL.Height = Application.GetRealHeight(200); + yinliangFL.Width = Application.GetRealWidth(68); + yinliangFL.Y = shouyeFL.Bottom + Application.GetRealHeight(24); + yinliangFL.X = shouyeFL.X; + yinliangFL.BackgroundColor = 0xffF2F3F7; + yinliangFL.Radius = (uint)Application.GetRealHeight(34); + + btn_jia = new Button + { + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "HisenseTv/yingliangjia.png", + Y = Application.GetRealHeight(20), + Gravity = Gravity.CenterHorizontal, + + }; + yinliangFL.AddChidren(btn_jia); + Button btnText = new Button + { + Y = Application.GetRealHeight(90), + Height = Application.GetRealHeight(20), + //Text = "闊抽噺", + TextID = StringId.yinliang, + TextColor = MusicColor.TextColor, + TextSize = TextSize.Text14, + Gravity = Gravity.CenterHorizontal, + + }; + yinliangFL.AddChidren(btnText); + btn_jian = new Button + { + Y = Application.GetRealHeight(148), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "HisenseTv/yingliangjian.png", + Gravity = Gravity.CenterHorizontal, + + }; + yinliangFL.AddChidren(btn_jian); + btn_jia.MouseUpEventHandler += (sender, e) => + { + + + }; + btn_jian.MouseUpEventHandler += (sender, e) => + { + + + }; + + bofangBtn = new CustomButton(); + bofangBtn.TextID = StringId.bofang; + bofangBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(24); + bofangBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(bofangBtn); + + + zantingBtn = new CustomButton(); + zantingBtn.TextID = StringId.zanting; + zantingBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(24); + zantingBtn.X = bofangBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(zantingBtn); + + + kuaijinBtn = new CustomButton(); + kuaijinBtn.TextID = StringId.kuaijin; + kuaijinBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(16); + kuaijinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(kuaijinBtn); + + + kauituiBtn = new CustomButton(); + kauituiBtn.TextID = StringId.kuaitui; + kauituiBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(16); + kauituiBtn.X = kuaijinBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(kauituiBtn); + + + + + jingyinBtn = new CustomButton(); + jingyinBtn.TextID = StringId.jingyin; + jingyinBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(16); + jingyinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(jingyinBtn); + + + shezhiBtn = new CustomButton(); + shezhiBtn.TextID = StringId.shezhi; + shezhiBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(16); + shezhiBtn.X = jingyinBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(shezhiBtn); + + + + jiechujingyinBtn = new CustomButton(); + jiechujingyinBtn.TextID = StringId.jiechujingyin; + jiechujingyinBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(16); + jiechujingyinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(jiechujingyinBtn); + + + fanhuiBtn = new CustomButton(); + fanhuiBtn.TextID = StringId.fanhui; + fanhuiBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(16); + fanhuiBtn.X = jiechujingyinBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(fanhuiBtn); + + + TypeFrameLayout typeFrameLayout = new TypeFrameLayout(); + typeFrameLayout.middLayout.Y = yinliangFL.Bottom + Application.GetRealHeight(32); + typeFrameLayout.AddView(backgroundOpenFl); + + muenFrameLayout = new MenuFramLayout(); + muenFrameLayout.Y = Application.GetRealHeight(482); + muenFrameLayout.AddView(backgroundOpenFl); + + sourceFrameLayout = new SourceFrameLayout(); + sourceFrameLayout.Y = Application.GetRealHeight(482); + backgroundOpenFl.AddChidren(sourceFrameLayout); + sourceFrameLayout.LoadSourcePage(); + + + + muenFrameLayout.Visible = true; + sourceFrameLayout.Visible = false; + typeFrameLayout.SetLfteClickListener(() => + { + + muenFrameLayout.Visible = true; + sourceFrameLayout.Visible = false; + }); + typeFrameLayout.SetRightClickListener(() => + { + muenFrameLayout.Visible = false; + sourceFrameLayout.Visible = true; + + }); + + + + + + #endregion + + } + /// <summary> + /// 鍒濆鍖栥�愬叧鏈恒�戠晫闈� + /// </summary> + private void InitCloseUI() + { + #region ---鐣岄潰甯冨眬--- + + baseCloseFFL = new BaseFramLayout + { + Y = topView.fLayout.Bottom, + Height = Application.GetRealHeight(H_W.H - H_W.T_Height), + }; + this.AddChidren(baseCloseFFL); + var backgroundCloseFl = new FrameLayout + { + Y = Application.GetRealHeight(24), + X = Application.GetRealWidth(24), + Height = Application.GetRealHeight(526), + Width = Application.GetRealWidth(327), + BackgroundImagePath = "HisenseTv/offbj.png", + }; + baseCloseFFL.AddChidren(backgroundCloseFl); + baseCloseFFL.AdjustRealHeight(16); + + btnCloseCollectIcon = 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", + IsSelected = this.device.collect, + }; + backgroundCloseFl.AddChidren(btnCloseCollectIcon); + + btnCloseCurrDeviceName = new Button + { + TextSize = TextSize.Text24, + TextColor = MusicColor.Text18Color, + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(33), + Y = Application.GetRealHeight(16), + X = Application.GetRealWidth(16), + Text = this.device.name, + TextAlignment = TextAlignment.CenterLeft, + IsBold = true + }; + backgroundCloseFl.AddChidren(btnCloseCurrDeviceName); + + + btnCloseCurrDeviceRoom = new Button + { + TextSize = TextSize.Text12, + TextColor = MusicColor.MusicNoTxetColor, + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(17), + Y = btnCloseCurrDeviceName.Bottom + Application.GetRealHeight(4), + X = Application.GetRealWidth(16), + Text = this.device.GetRoomListName(), + TextAlignment = TextAlignment.CenterLeft, + }; + backgroundCloseFl.AddChidren(btnCloseCurrDeviceRoom); + + var btnOffTvBj = new Button + { + Y = Application.GetRealHeight(108), + Height = Application.GetRealWidth(198), + Width = Application.GetRealWidth(198), + UnSelectedImagePath = "HisenseTv/offtvbj.png", + Gravity = Gravity.CenterHorizontal, + }; + backgroundCloseFl.AddChidren(btnOffTvBj); + + + var btnText = new Button + { + Y = btnOffTvBj.Bottom + Application.GetRealHeight(20), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(22), + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + //Text = "宸插叧鏈�", + TextID = StringId.yiguanji, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterHorizontal, + Padding = new Padding(0, 16, 0, 16), + + }; + backgroundCloseFl.AddChidren(btnText); + + + var offFl = new FrameLayout + { + Y = btnText.Bottom + Application.GetRealHeight(91), + Width = Application.GetRealHeight(32), + Height = Application.GetRealWidth(32 + 20), + Gravity = Gravity.CenterHorizontal, + }; + backgroundCloseFl.AddChidren(offFl); + + var btnOffIcon = new Button + { + Height = Application.GetRealWidth(32), + Width = Application.GetRealWidth(32), + UnSelectedImagePath = "HisenseTv/on.png", + Gravity = Gravity.CenterHorizontal, + }; + offFl.AddChidren(btnOffIcon); + + var btnOffText = new Button + { + Y = btnOffIcon.Bottom + Application.GetRealHeight(4), + Height = Application.GetRealHeight(16), + TextSize = TextSize.Text12, + TextColor = MusicColor.TextCancelColor, + TextID = StringId.kaiji, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterHorizontal, + Padding = new Padding(0, 2, 0, 2), + }; + offFl.AddChidren(btnOffText); + + clickBtn = new Button + { + Width = Application.GetRealHeight(32), + Height = Application.GetRealWidth(32 + 20), + }; + offFl.AddChidren(clickBtn); + #endregion + + } + /// <summary> + /// 鍒濆鍖栧ご閮� + /// </summary> + private void InitTopUI() + { + this.BackgroundColor = MusicColor.ViewColor; + this.topView = new TopView(); + this.topView.setBtn.Visible = true; + this.topView.topNameBtn.TextID = StringId.dianshi; + this.AddChidren(topView.TopFLayoutView()); + } + /// <summary> + /// 鏍规嵁璁惧寮�鍏崇姸鎬佹樉绀烘寚瀹氱晫闈� + /// (杩涙潵鐨勬椂鍊欑敤鍒�) + /// </summary> + /// <returns></returns> + private void CurrentAssignPage() + { + CommonMethod.Current.MainThread(() => + { + + if (this.device == null) + { + vv.Visible = false; + baseCloseFFL.Visible = true; + return; + } + if (this.device.GetAttrState("on_off") == "on" || this.device.GetAttrState("on_off") == "1") + { + vv.Visible = true; + baseCloseFFL.Visible = false; + } + else + { + vv.Visible = false; + baseCloseFFL.Visible = true; + } + }); + + } + + /// <summary> + /// 閲嶆柊璁$畻瀹藉害(璁惧鍚嶇О,鎴块棿鎺т欢) + /// </summary> + private void CalculatedPosition() + { + //寮�鏈虹姸鎬� + this.btnOpenCurrDeviceName.Width = this.btnOpenCurrDeviceName.GetTextWidth(); + this.btnOpenCurrDeviceName.Width += 10; + if (this.btnOpenCurrDeviceName.GetTextWidth() > this.btnOpenCollectIcon.X) + { + //閲嶆柊璁$畻瀹藉害 + this.btnOpenCurrDeviceName.Width = this.btnOpenCollectIcon.X + Application.GetRealWidth(-10); + } + this.btnOpenCurrDeviceRoom.Width = this.btnOpenCurrDeviceRoom.GetTextWidth(); + this.btnOpenCurrDeviceRoom.Width += 10; + if (this.btnOpenCurrDeviceRoom.GetTextWidth() > this.btnOpenCollectIcon.X) + { + //閲嶆柊璁$畻瀹藉害 + this.btnOpenCurrDeviceRoom.Width = this.btnOpenCollectIcon.X + Application.GetRealWidth(-20 - 10); + } + + + //鍏虫満鐘舵�� + this.btnCloseCurrDeviceName.Width = this.btnCloseCurrDeviceName.GetTextWidth(); + this.btnCloseCurrDeviceName.Width += 10; + if (this.btnCloseCurrDeviceName.GetTextWidth() > this.btnCloseCollectIcon.X) + { + //閲嶆柊璁$畻瀹藉害 + this.btnCloseCurrDeviceName.Width = this.btnCloseCollectIcon.X + Application.GetRealWidth(-10); + } + this.btnCloseCurrDeviceRoom.Width = this.btnCloseCurrDeviceRoom.GetTextWidth(); + this.btnCloseCurrDeviceRoom.Width += 10; + if (this.btnCloseCurrDeviceRoom.GetTextWidth() > this.btnCloseCollectIcon.X) + { + //閲嶆柊璁$畻瀹藉害 + this.btnCloseCurrDeviceRoom.Width = this.btnCloseCollectIcon.X + Application.GetRealWidth(-20 - 10); + } + //this.cellFrame.X = this.btnCurrDeviceRoom.Right + Application.GetRealWidth(20); + } + + #endregion + + } + #region -------鑷畾涔夊綋鍓嶇晫闈㈢殑瀹瑰櫒--------- + /// <summary> + /// 鑷畾涔夛紙棣栭〉锛屽叧鏈猴紝鑿滃崟锛夊鍣� + /// </summary> + class CustomFrameLayout : FrameLayout + { + public const int widthFrameLayout = 68; + public const int heightFrameLayout = 68 + 8 + 20; + public const int interval = 37;//琛屼腑鐨勫垪闂撮殧鍊� + + 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(68), + Height = Application.GetRealWidth(68), + Gravity = Gravity.TopCenter, + Name = "btnImage", + + }; + Button btnText = new Button + { + Width = Application.GetRealWidth(68), + Height = Application.GetRealWidth(20), + TextID = StringId.dangqianmenweiguan, + TextSize = TextSize.Text14, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterHorizontal, + Name = "btnText", + IsMoreLines = true, + }; + public void AddImageView() + { + this.AddChidren(btnImage); + } + public void AddTextButtonView() + { + btnText.Y = Application.GetRealHeight(8) + btnImage.Bottom; + this.AddChidren(btnText); + } + public Button GetImageButton() + { + return this.btnImage; + } + public Button GetTextButton() + { + return this.btnText; + } + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄;绗簩涓槸鍥炬爣瀵硅薄;绗笁涓槸鐘舵�佸璞�</param> + /// <param name="button1">娉ㄦ剰:鍦⊿etClickListener()鍓嶉潰璋冪敤AddImageView()鎵嶆湁鏁�</param> + /// <param name="button2">娉ㄦ剰:鍦⊿etClickListener()鍓嶉潰璋冪敤AddImageView()鎵嶆湁鏁�</param> + public void SetClickListener(Action<FrameLayout, Button, Button> action) + { + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //this.BackgroundColor = 0xFFF2F3F7; + action?.Invoke(this, btnImage, btnText); + }; + this.MouseDownEventHandler += DownClick; + btnImage.MouseDownEventHandler += DownClick; + btnText.MouseDownEventHandler += DownClick; + + + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + //this.BackgroundColor = 0x00000000; + }; + this.MouseUpEventHandler += UpClick; + btnImage.MouseUpEventHandler += UpClick; + btnText.MouseUpEventHandler += UpClick; + + } + + } + /// <summary> + /// 鎸夐敭瀹瑰櫒 + /// </summary> + class CustomButton : Button + { + + public CustomButton() + { + + this.Width = Application.GetRealWidth(68); + this.Height = Application.GetRealHeight(38); + this.TextSize = 14; + this.TextColor = MusicColor.TextColor; + this.TextAlignment = TextAlignment.Center; + this.IsMoreLines = true; + this.BackgroundColor = 0xffECEDEE; + this.Radius = (uint)Application.GetRealHeight(30); + } + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄</param> + public void SetClickListener(Action<Button> action) + { + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + this.BackgroundColor = 0xFFF2F3F7; + action?.Invoke(this); + }; + this.MouseDownEventHandler += DownClick; + + + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + this.BackgroundColor = 0xffECEDEE; + }; + this.MouseUpEventHandler += UpClick; + + } + + } + /// <summary> + /// 绫诲瀷锛堟帶鍒� 淇″彿婧愶級瀹瑰櫒 + /// </summary> + class TypeFrameLayout + { + #region ----鎺у埗 淇″彿婧�---- + public FrameLayout middLayout = new FrameLayout + { + Height = Application.GetRealHeight(29), + Y = Application.GetRealHeight(32), + }; + + + FrameLayout leftLayout = new FrameLayout + { + X = Application.GetRealWidth(42), + Height = Application.GetRealHeight(29), + Width = Application.GetRealWidth(32), + + }; + + + Button leftBtnTitle = new Button + { + Height = Application.GetRealHeight(23), + TextAlignment = TextAlignment.CenterLeft, + TextColor = MusicColor.TextColor, + SelectedTextColor = MusicColor.MusicTxet14SelectedColor, + TextSize = TextSize.Text16, + TextID = StringId.kongzhi, + IsBold = true, + }; + + + + Button leftBtnLine = new Button + { + + Height = Application.GetRealHeight(2), + BackgroundColor = MusicColor.TextColor, + SelectedBackgroundColor = MusicColor.MusicTxet14SelectedColor, + Gravity = Gravity.CenterHorizontal, + }; + + //棰戦亾鐐瑰嚮鎺т欢 + FrameLayout clickLeftLayout = new FrameLayout + { + + }; + + + FrameLayout rightLayout = new FrameLayout + { + Width = Application.GetRealWidth(48), + }; + Button rightBtnTitle = new Button + { + Height = Application.GetRealHeight(23), + Width = Application.GetRealWidth(48), + TextAlignment = TextAlignment.CenterLeft, + TextColor = MusicColor.TextColor, + SelectedTextColor = MusicColor.MusicTxet14SelectedColor, + TextSize = TextSize.Text16, + Text = "淇″彿婧�", + IsBold = true, + }; + + Button rightBtnLine = new Button + { + Height = Application.GetRealHeight(2), + BackgroundColor = MusicColor.TextColor, + SelectedBackgroundColor = MusicColor.MusicTxet14SelectedColor, + Gravity = Gravity.CenterHorizontal, + }; + + + //淇″彿婧愮偣鍑绘帶浠� + FrameLayout clickRightLayout = new FrameLayout + { + + }; + + #endregion + + + + + + + /// <summary> + /// + /// </summary> + /// <param name="layout"></param> + public void AddView(FrameLayout layout) + { + layout.AddChidren(middLayout); + middLayout.AddChidren(leftLayout); + + leftLayout.AddChidren(leftBtnTitle); + leftLayout.AddChidren(leftBtnLine); + leftLayout.AddChidren(clickLeftLayout); + middLayout.AddChidren(rightLayout); + rightLayout.AddChidren(rightBtnTitle); + rightLayout.AddChidren(rightBtnLine); + rightLayout.AddChidren(clickRightLayout); + + leftBtnTitle.Width = leftLayout.Width; + leftBtnLine.Y = leftBtnTitle.Bottom + Application.GetRealHeight(4); + if (leftBtnTitle.GetTextWidth() < leftBtnTitle.Width) + { + leftBtnTitle.Width = leftBtnTitle.GetTextWidth(); + } + leftBtnLine.Width = leftBtnTitle.Width; + + clickLeftLayout.Height = leftLayout.Height; + clickLeftLayout.Width = leftLayout.Width; + + + rightLayout.X = leftLayout.Right + Application.GetRealWidth(171); + rightLayout.Y = leftLayout.Y; + rightLayout.Height = leftLayout.Height; + + + + rightBtnLine.Y = rightBtnTitle.Bottom + Application.GetRealHeight(4); + + if (rightBtnTitle.GetTextWidth() < rightBtnTitle.Width) + { + rightBtnTitle.Width = rightBtnTitle.GetTextWidth(); + } + rightBtnLine.Width = rightBtnTitle.Width; + + clickRightLayout.Height = leftLayout.Height; + clickRightLayout.Width = leftLayout.Width; + + + + //鍒濆鍊� + leftBtnTitle.IsSelected = true; + leftBtnLine.IsSelected = true; + leftBtnLine.Visible = true; + rightBtnTitle.IsSelected = false; + rightBtnLine.IsSelected = false; + rightBtnLine.Visible = false; + + } + /// <summary> + /// 鎺у埗鐩戝惉鏂规硶 + /// </summary> + public void SetLfteClickListener(Action action) + { + //鐐瑰嚮浜嬩欢 + clickLeftLayout.MouseDownEventHandler += (sen, e) => + { + leftBtnTitle.IsSelected = true; + leftBtnLine.IsSelected = true; + leftBtnLine.Visible = true; + rightBtnTitle.IsSelected = false; + rightBtnLine.IsSelected = false; + rightBtnLine.Visible = false; + action?.Invoke(); + }; + } + /// <summary> + /// 淇″彿婧愮洃鍚柟娉� + /// </summary> + public void SetRightClickListener(Action action) + { + + //鐐瑰嚮浜嬩欢 + clickRightLayout.MouseDownEventHandler += (sen, e) => + { + leftBtnTitle.IsSelected = false; + leftBtnLine.IsSelected = false; + leftBtnLine.Visible = false; + rightBtnTitle.IsSelected = true; + rightBtnLine.IsSelected = true; + rightBtnLine.Visible = true; + action?.Invoke(); + + + }; + + } + + } + /// <summary> + /// 淇″彿婧愬鍣� + /// </summary> + class SourceFrameLayout : FrameLayout + { + public const int widthFrameLayout = 375; + public const int heightFrameLayout = 146; + public const int interval = 37;//琛屼腑鐨勫垪闂撮殧鍊� + + public Action<string> selectAction; + + public SourceFrameLayout(int width = widthFrameLayout, int height = heightFrameLayout) + { + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); + } + + /// <summary> + /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// </summary> + public void LoadSourcePage() + { + var mList = GetList(); + int currnetheightValue = 0; + int currnetWidthValue = 0; + int heightMaxValue = 38; + int widthMaxValue = 68; + //鑾峰彇鐩稿涓�涓含搴﹀�� + int widthDimensionValue = this.Width - Application.GetRealWidth(24) - Application.GetRealWidth(24) - Application.GetRealHeight(widthMaxValue / 2); + for (int i = 0; i < mList.Count; i++) + { + var source = mList[i]; + CustomButton button = new CustomButton(); + this.AddChidren(button); + button.Tag = source; + button.Y = Application.GetRealHeight(currnetheightValue); + button.X = Application.GetRealWidth(24) + Application.GetRealWidth(currnetWidthValue); + button.Text = source; + currnetWidthValue += (widthMaxValue + 37);//37鏄殧闂村�� + if (widthDimensionValue < Application.GetRealWidth(currnetWidthValue)) + { + currnetheightValue += (heightMaxValue + 16);//16鏄殧闂村�� + currnetWidthValue = 0; + } + + button.SetClickListener((btn) => + { + // MovieLibrary movieLibrary = new MovieLibrary(); + + selectAction?.Invoke(button.Text); + }); + //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //{ + // selectImageAction?.Invoke((int)imageFram.Tag); + //} + } + + } + private List<string> GetList() + { + return new List<string> + { + "HDML 1",//" " + "HDML 2", + "HDML 3", + "HDML 4", + "Live TV", + "PS", + "AV", + }; + } + + + } + + #endregion + +} -- Gitblit v1.8.0