From f9181a9c8125136f597add7c30cb2ff508d54ba7 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:34:32 +0800 Subject: [PATCH] 2024年07月25日17:33:40 --- HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs | 1088 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 568 insertions(+), 520 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs index 5a91d6c..d0a93d8 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs @@ -1,16 +1,10 @@ 锘縰sing Shared; using System; using System.Collections.Generic; -using System.Text; -using HDL_ON.UI.CSS; using HDL_ON.Entity; -using HDL_ON.DriverLayer; using HDL_ON.UI.Music; using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock; -using HDL_ON.UI.UI2.Intelligence.Automation; -using System.Linq; using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView; -using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity; namespace HDL_ON.UI.UI2.FuntionControlView.HisenseTV { @@ -21,7 +15,7 @@ { - #region 鈻� 鍙橀噺澹版槑___________________________ + #region -------鍙橀噺澹版槑--------- /// <summary> /// 璁惧 /// </summary> @@ -35,26 +29,46 @@ /// </summary> private Button btnRoomName; /// <summary> + /// 涓婁竴绾х晫闈㈢殑鏀惰棌鎺т欢 + /// </summary> + private Button btnCollectionIcon; + /// <summary> /// 澶撮儴甯冨眬 /// </summary> private TopView topView; /// <summary> + ///涓儴甯冨眬 + /// </summary> + VerticalScrolViewLayout vv; + /// <summary> /// 褰撳墠璁惧鍚嶇О /// </summary> - private Button btnCurrDeviceName; + private Button btnOpenCurrDeviceName; /// <summary> /// 鍖哄煙 /// </summary> - private Button btnCurrDeviceRoom; - + private Button btnOpenCurrDeviceRoom; /// <summary> ///鏀惰棌鍥炬爣 /// </summary> - private Button btnCollectIcon; - /// <summary> - /// 闂ㄩ攣鐘舵�� - /// </summary> - private Button btnDoorLockIcon; + private Button btnOpenCollectIcon; + CustomFrameLayout shouyeFL; + CustomFrameLayout kaijiFL; + CustomFrameLayout guanFL; + Button btn_jia; + Button btn_jian; + CustomButton caidanBtn; + CustomButton bofangBtn; + CustomButton zantingBtn; + CustomButton kuaijinBtn; + CustomButton kauituiBtn; + CustomButton jingyinBtn; + CustomButton shezhiBtn; + CustomButton jiechujingyinBtn; + CustomButton fanhuiBtn; + MenuFramLayout muenFrameLayout; + SourceFrameLayout sourceFrameLayout; + /// <summary> /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰 /// </summary> @@ -65,18 +79,19 @@ public Action action; #endregion - /// <summary> /// 鏋勯�犲嚱鏁� /// </summary> /// <param name="function">璁惧</param> /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> - /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> - public HisenseTvPage(Function function, Button btnDeviceName, Button btnRoomName, CommonMethod.Comerom comerom, Action action) + /// <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; @@ -85,7 +100,8 @@ public void Show() { //鍒濆鍖朥I - this.InitUI(); + this.InitTopUI(); + this.InitOpenUI(); //鍒濆鍖栦簨浠� this.EventListener(); //璇诲彇鏁版嵁 @@ -93,243 +109,6 @@ } - - /// <summary> - /// 鍒濆鍖栫晫闈� - /// </summary> - private void InitUI() - { - #region ---鐣岄潰甯冨眬--- - this.BackgroundColor = MusicColor.ViewColor; - this.topView = new TopView(); - this.topView.setBtn.Visible = true; - this.topView.topNameBtn.TextID = StringId.dianshi; - this.AddChidren(topView.TopFLayoutView()); - - var vv = new VerticalScrolViewLayout - { - Y = topView.fLayout.Bottom, - Height = Application.GetRealHeight(H_W.H - H_W.T_Height), - }; - this.AddChidren(vv); - var baseFL = new BaseFramLayout(); - vv.AddChidren(baseFL); - - var backgroundFl = new FrameLayout - { - Y = Application.GetRealHeight(24), - X = Application.GetRealWidth(24), - Height = Application.GetRealHeight(682), - Width = Application.GetRealWidth(327), - BackgroundImagePath = "HisenseTv/onbj.png", - Name = "backgroundFl", - }; - baseFL.AddChidren(backgroundFl); - - baseFL.AdjustRealHeight(51); - - btnCollectIcon = 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, - Name = "collect" - }; - backgroundFl.AddChidren(btnCollectIcon); - - btnCurrDeviceName = 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 - }; - backgroundFl.AddChidren(btnCurrDeviceName); - - - btnCurrDeviceRoom = new Button - { - TextSize = TextSize.Text12, - TextColor = MusicColor.MusicNoTxetColor, - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(17), - Y = btnCurrDeviceName.Bottom + Application.GetRealHeight(4), - X = Application.GetRealWidth(16), - Text = this.device.GetRoomListName(), - TextAlignment = TextAlignment.CenterLeft, - }; - backgroundFl.AddChidren(btnCurrDeviceRoom); - - int yHeight = btnCurrDeviceRoom.Bottom + Application.GetRealHeight(16); - var shouyeFL = new CustomFrameLayout(); - backgroundFl.AddChidren(shouyeFL); - shouyeFL.X = Application.GetRealWidth(24); - shouyeFL.Y = yHeight; - shouyeFL.AddImageView(); - shouyeFL.AddTextButtonView(); - shouyeFL.GetImageButton().UnSelectedImagePath = "HisenseTv/shouye.png"; - shouyeFL.GetTextButton().Text = "棣栭〉"; - - - var kaiguanFL = new CustomFrameLayout(); - backgroundFl.AddChidren(kaiguanFL); - kaiguanFL.X = shouyeFL.Right + Application.GetRealWidth(37); - kaiguanFL.Y = yHeight; - kaiguanFL.AddImageView(); - kaiguanFL.AddTextButtonView(); - kaiguanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/kaiguan.png"; - kaiguanFL.GetTextButton().Text = "鍏虫満"; - - var caidanFL = new CustomFrameLayout(); - backgroundFl.AddChidren(caidanFL); - caidanFL.X = kaiguanFL.Right + Application.GetRealWidth(37); - caidanFL.Y = yHeight; - caidanFL.AddImageView(); - caidanFL.AddTextButtonView(); - caidanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/caidan.png"; - caidanFL.GetTextButton().Text = "鑿滃崟"; - - var yinliangFL = new FrameLayout(); - backgroundFl.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); - - Button 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 = "闊抽噺", - TextColor = MusicColor.TextColor, - TextSize = TextSize.Text14, - Gravity = Gravity.CenterHorizontal, - - }; - yinliangFL.AddChidren(btnText); - Button 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); - - - CustomButton bofangBtn = new CustomButton(); - bofangBtn.Text = "鎾斁"; - bofangBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(24); - bofangBtn.X = yinliangFL.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(bofangBtn); - - - CustomButton zantingBtn = new CustomButton(); - zantingBtn.Text = "鏆傚仠"; - zantingBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(24); - zantingBtn.X = bofangBtn.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(zantingBtn); - - - CustomButton kuaijinBtn = new CustomButton(); - kuaijinBtn.Text = "蹇繘"; - kuaijinBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(16); - kuaijinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(kuaijinBtn); - - - CustomButton kauituiBtn = new CustomButton(); - kauituiBtn.Text = "蹇��"; - kauituiBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(16); - kauituiBtn.X = kuaijinBtn.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(kauituiBtn); - - - - - CustomButton jingyinBtn = new CustomButton(); - jingyinBtn.Text = "闈欓煶"; - jingyinBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(16); - jingyinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(jingyinBtn); - - - CustomButton shezhiBtn = new CustomButton(); - shezhiBtn.Text = "璁剧疆"; - shezhiBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(16); - shezhiBtn.X = jingyinBtn.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(shezhiBtn); - - - - CustomButton jiechujingyinBtn = new CustomButton(); - jiechujingyinBtn.Text = "瑙i櫎闈欓煶"; - jiechujingyinBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(16); - jiechujingyinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(jiechujingyinBtn); - - - CustomButton fanhuiBtn = new CustomButton(); - fanhuiBtn.Text = "杩斿洖"; - fanhuiBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(16); - fanhuiBtn.X = jiechujingyinBtn.Right + Application.GetRealWidth(37); - backgroundFl.AddChidren(fanhuiBtn); - - - TypeFrameLayout typeFrameLayout = new TypeFrameLayout(); - typeFrameLayout.middLayout.Y = yinliangFL.Bottom + Application.GetRealHeight(32); - typeFrameLayout.AddView(backgroundFl); - - - - MuenFrameLayout muenFrameLayout = new MuenFrameLayout (); - muenFrameLayout.AddView(backgroundFl); - muenFrameLayout.parentFl.Y = Application.GetRealHeight(482); - muenFrameLayout.parentFl.X = Application.GetRealWidth(73); - - - typeFrameLayout.SetLfteClickListener((btn) => { - - - }); - typeFrameLayout.SetRightClickListener((btn) => { - - - }); - - muenFrameLayout.SetLeftClickListener((b) => { - - }); - - - - #endregion - - - } /// <summary> /// 娉ㄥ唽浜嬩欢 /// </summary> @@ -355,8 +134,9 @@ ////鍒锋柊鏄剧ず this.btnDeviceName.Text = this.device.name; this.btnRoomName.Text = this.device.GetRoomListName(); - this.btnCurrDeviceName.Text = this.device.name; - this.btnCurrDeviceRoom.Text = this.device.GetRoomListName(); + // + this.btnOpenCurrDeviceName.Text = this.device.name; + this.btnOpenCurrDeviceRoom.Text = this.device.GetRoomListName(); this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害 }); @@ -373,28 +153,197 @@ }); }; //鏀惰棌 - this.btnCollectIcon.MouseUpEventHandler += (sender, e) => + this.btnOpenCollectIcon.MouseUpEventHandler += (sender, e) => { - btnCollectIcon.IsSelected = this.device.collect = !btnCollectIcon.IsSelected; + btnOpenCollectIcon.IsSelected = this.device.collect = !btnOpenCollectIcon.IsSelected; this.device.CollectFunction(); + this.btnCollectionIcon.IsSelected = btnOpenCollectIcon.IsSelected; }; + //棣栭〉 + shouyeFL.SetClickListener((fl, btnImage, btnText) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.home_page, ""); + }); + //寮�鏈� + kaijiFL.SetClickListener((fl, btnImage, btnText) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.wol, "on"); + }); + //鍏虫満 + guanFL.SetClickListener((fl, btnImage, btnText) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.on_off, "off"); + + }); + //闊抽噺+ + btn_jia.MouseUpEventHandler += (sender, e) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.volume_add, ""); + this.SetButtonIsSelected(btn_jia); + + }; + //闊抽噺- + btn_jian.MouseUpEventHandler += (sender, e) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.volume_subtract, ""); + this.SetButtonIsSelected(btn_jian); + }; + //鑿滃崟 + caidanBtn.SetClickListener((btn) => + { + ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11"); + + }); + //鎾斁 + 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 += (key) => + { + var p = new UI2.Intelligence.Automation.PublicInterface(); + var dic = p.GetHisenseSignalSourceDic(); + string value = p.GetValue(dic, key); + ControlCommand(HisenseTVFunctionalAttributeConstant.signal, value); + }; } /// <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 + { + if (this.device == null) + { + //璁惧涓嶅湪绾挎帶鍒跺け璐� + Application.RunOnMainThread(() => + { + CommonMethod.Current.ShowTip(Language.StringByID(StringId.shebeibuzaixian), 3); + }); + return; + } + + if (!this.device.online && key != HisenseTVFunctionalAttributeConstant.wol) + { + //璁惧涓嶅湪绾挎帶鍒跺け璐� + Application.RunOnMainThread(() => + { + CommonMethod.Current.ShowTip(Language.StringByID(StringId.shebeibuzaixian), 3); + }); + return; + } + + 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() { + if (this.device == null) + { + return; + } CommonMethod.Current.Loading.Start(); CommonMethod.Current.SunThread(() => { try { - CommonMethod.Current.MainThread(() => + + var isRefreshDeviceStatus = Send.Current.RefreshDeviceStatus(new List<string> { this.device.deviceId }); + if (isRefreshDeviceStatus) { - }); + var fun = Send.Current.GetDeviceInfo(this.device.deviceId); + if (fun != null) + { + //鏇存柊鐪熷疄鍦ㄧ嚎鐘舵�� + this.device.online = fun.online; + } + + } } catch { } finally @@ -407,6 +356,265 @@ }); } + #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-60), + 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.GetImageButton().SelectedImagePath = "HisenseTv/shouyeSelected.png"; + shouyeFL.GetTextButton().TextID = StringId.shouye; + + + kaijiFL = new CustomFrameLayout(); + backgroundOpenFl.AddChidren(kaijiFL); + kaijiFL.X = shouyeFL.Right + Application.GetRealWidth(37); + kaijiFL.Y = yHeight; + kaijiFL.AddImageView(); + kaijiFL.AddTextButtonView(); + kaijiFL.GetImageButton().UnSelectedImagePath = "HisenseTv/kai.png"; + kaijiFL.GetImageButton().SelectedImagePath = "HisenseTv/kaiguanSelected.png"; + kaijiFL.GetTextButton().TextID = StringId.kaiji; + + guanFL = new CustomFrameLayout(); + backgroundOpenFl.AddChidren(guanFL); + guanFL.X = kaijiFL.Right + Application.GetRealWidth(37); + guanFL.Y = yHeight; + guanFL.AddImageView(); + guanFL.AddTextButtonView(); + guanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/guan.png"; + guanFL.GetImageButton().SelectedImagePath = "HisenseTv/kaiguanSelected.png"; + //guanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/caidan.png"; + guanFL.GetTextButton().TextID = StringId.guanji; + + var yinliangFL = new FrameLayout(); + backgroundOpenFl.AddChidren(yinliangFL); + yinliangFL.Height = Application.GetRealHeight(146-16); + yinliangFL.Width = Application.GetRealWidth(68); + yinliangFL.Y = Application.GetRealHeight(260-8-20); + yinliangFL.X = shouyeFL.X; + yinliangFL.BackgroundColor = 0xFFF2F3F7; + yinliangFL.Radius = (uint)Application.GetRealWidth(34); + + btn_jia = new Button + { + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "HisenseTv/yingliangjia.png", + SelectedImagePath = "HisenseTv/yingliangjiaSelected.png", + Y = Application.GetRealHeight(16), + Gravity = Gravity.CenterHorizontal, + + }; + yinliangFL.AddChidren(btn_jia); + Button btnText = new Button + { + Y = Application.GetRealHeight(63-8), + 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(98-8), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "HisenseTv/yingliangjian.png", + SelectedImagePath = "HisenseTv/yingliangjianSelected.png", + Gravity = Gravity.CenterHorizontal, + + }; + yinliangFL.AddChidren(btn_jian); + + int bottomValue= 4; + caidanBtn = new CustomButton(); + caidanBtn.TextID = StringId.caidan; + caidanBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(bottomValue); + caidanBtn.X = shouyeFL.X; + backgroundOpenFl.AddChidren(caidanBtn); + + bofangBtn = new CustomButton(); + bofangBtn.TextID = StringId.bofang; + bofangBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(bottomValue); + bofangBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(bofangBtn); + + + zantingBtn = new CustomButton(); + zantingBtn.TextID = StringId.zanting; + zantingBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(bottomValue); + zantingBtn.X = bofangBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(zantingBtn); + + int bottomValue1 = 8; + kuaijinBtn = new CustomButton(); + kuaijinBtn.TextID = StringId.kuaijin; + kuaijinBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(bottomValue1); + kuaijinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(kuaijinBtn); + + + kauituiBtn = new CustomButton(); + kauituiBtn.TextID = StringId.kuaitui; + kauituiBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(bottomValue1); + kauituiBtn.X = kuaijinBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(kauituiBtn); + + + + + jingyinBtn = new CustomButton(); + jingyinBtn.TextID = StringId.jingyin; + jingyinBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(bottomValue1); + jingyinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(jingyinBtn); + + + shezhiBtn = new CustomButton(); + shezhiBtn.TextID = StringId.shezhi; + shezhiBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(bottomValue1); + shezhiBtn.X = jingyinBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(shezhiBtn); + + + + jiechujingyinBtn = new CustomButton(); + jiechujingyinBtn.TextID = StringId.jiechujingyin; + jiechujingyinBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(bottomValue1); + jiechujingyinBtn.X = yinliangFL.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(jiechujingyinBtn); + + + fanhuiBtn = new CustomButton(); + fanhuiBtn.TextID = StringId.fanhui; + fanhuiBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(bottomValue1); + fanhuiBtn.X = jiechujingyinBtn.Right + Application.GetRealWidth(37); + backgroundOpenFl.AddChidren(fanhuiBtn); + + + TypeFrameLayout typeFrameLayout = new TypeFrameLayout(); + typeFrameLayout.middLayout.Y = yinliangFL.Bottom + Application.GetRealHeight(16); + typeFrameLayout.AddView(backgroundOpenFl); + + muenFrameLayout = new MenuFramLayout(); + muenFrameLayout.Y = Application.GetRealHeight(482-60); + muenFrameLayout.AddView(backgroundOpenFl); + + sourceFrameLayout = new SourceFrameLayout(); + sourceFrameLayout.Y = Application.GetRealHeight(482-60); + 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 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> @@ -414,30 +622,32 @@ /// </summary> private void CalculatedPosition() { - this.btnCurrDeviceName.Width = this.btnCurrDeviceName.GetTextWidth(); - this.btnCurrDeviceName.Width += 10; - if (this.btnCurrDeviceName.GetTextWidth() > this.btnCollectIcon.X) + //寮�鏈虹姸鎬� + this.btnOpenCurrDeviceName.Width = this.btnOpenCurrDeviceName.GetTextWidth(); + this.btnOpenCurrDeviceName.Width += 10; + if (this.btnOpenCurrDeviceName.GetTextWidth() > this.btnOpenCollectIcon.X) { //閲嶆柊璁$畻瀹藉害 - this.btnCurrDeviceName.Width = this.btnCollectIcon.X + Application.GetRealWidth(-10); + this.btnOpenCurrDeviceName.Width = this.btnOpenCollectIcon.X + Application.GetRealWidth(-10); } - this.btnCurrDeviceRoom.Width = this.btnCurrDeviceRoom.GetTextWidth(); - this.btnCurrDeviceRoom.Width += 10; - if (this.btnCurrDeviceRoom.GetTextWidth() > this.btnCollectIcon.X) + this.btnOpenCurrDeviceRoom.Width = this.btnOpenCurrDeviceRoom.GetTextWidth(); + this.btnOpenCurrDeviceRoom.Width += 10; + if (this.btnOpenCurrDeviceRoom.GetTextWidth() > this.btnOpenCollectIcon.X) { //閲嶆柊璁$畻瀹藉害 - this.btnCurrDeviceRoom.Width = this.btnCollectIcon.X + Application.GetRealWidth(-20 - 10); + this.btnOpenCurrDeviceRoom.Width = this.btnOpenCollectIcon.X + Application.GetRealWidth(-20 - 10); } //this.cellFrame.X = this.btnCurrDeviceRoom.Right + Application.GetRealWidth(20); } + #endregion } - + #region -------鑷畾涔夊綋鍓嶇晫闈㈢殑瀹瑰櫒--------- /// <summary> /// 鑷畾涔夛紙棣栭〉锛屽叧鏈猴紝鑿滃崟锛夊鍣� /// </summary> - class CustomFrameLayout : FrameLayout + class CustomFrameLayout : BaseFramLayout { public const int widthFrameLayout = 68; public const int heightFrameLayout = 68 + 8 + 20; @@ -463,6 +673,7 @@ TextID = StringId.dangqianmenweiguan, TextSize = TextSize.Text14, TextColor = MusicColor.TextColor, + SelectedTextColor = MusicColor.MusicTxet14SelectedColor, TextAlignment = TextAlignment.Center, Gravity = Gravity.CenterHorizontal, Name = "btnText", @@ -494,19 +705,11 @@ /// <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; + action?.Invoke(this, btnImage, btnText); + SetButtonIsSelected(btnImage); }; this.MouseUpEventHandler += UpClick; btnImage.MouseUpEventHandler += UpClick; @@ -528,11 +731,15 @@ this.Height = Application.GetRealHeight(38); this.TextSize = 14; this.TextColor = MusicColor.TextColor; + this.SelectedTextColor = MusicColor.MusicTxet14SelectedColor; this.TextAlignment = TextAlignment.Center; this.IsMoreLines = true; - this.BackgroundColor = 0xffECEDEE; - this.Radius = (uint)Application.GetRealHeight(30); + this.BackgroundColor = 0xFFF2F3F7; + this.SelectedBackgroundColor = 0xffECEDEE; + this.Radius = (uint)Application.GetRealHeight(19); + this.Padding = new Padding(0, 0, 0, 0); } + /// <summary> /// 浜嬩欢鐩戝惉鏂规硶 @@ -540,17 +747,12 @@ /// <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 = 0x00000000; + + action?.Invoke(this); + new BaseFramLayout().SetButtonIsSelected(this); + }; this.MouseUpEventHandler += UpClick; @@ -580,14 +782,15 @@ 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, + Padding = new Padding(0, 0, 0, 0), + IsBold = true, }; @@ -620,7 +823,8 @@ TextColor = MusicColor.TextColor, SelectedTextColor = MusicColor.MusicTxet14SelectedColor, TextSize = TextSize.Text16, - Text = "淇″彿婧�", + TextID = StringId.xinhaoyuan, + Padding = new Padding(0, 0, 0, 0), IsBold = true, }; @@ -664,7 +868,7 @@ rightLayout.AddChidren(clickRightLayout); leftBtnTitle.Width = leftLayout.Width; - leftBtnLine.Y = leftBtnTitle.Bottom + Application.GetRealHeight(4); + leftBtnLine.Y = leftBtnTitle.Bottom + Application.GetRealHeight(0); if (leftBtnTitle.GetTextWidth() < leftBtnTitle.Width) { leftBtnTitle.Width = leftBtnTitle.GetTextWidth(); @@ -681,7 +885,7 @@ - rightBtnLine.Y = rightBtnTitle.Bottom + Application.GetRealHeight(4); + rightBtnLine.Y = rightBtnTitle.Bottom + Application.GetRealHeight(0); if (rightBtnTitle.GetTextWidth() < rightBtnTitle.Width) { @@ -703,14 +907,12 @@ rightBtnLine.Visible = false; } - /// <summary> - /// 淇″彿婧愮洃鍚柟娉� + /// 鎺у埗鐩戝惉鏂规硶 /// </summary> - /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄</param> - public void SetRightClickListener(Action<Button> action) + public void SetLfteClickListener(Action action) { - //棰戦亾鐐瑰嚮浜嬩欢 + //鐐瑰嚮浜嬩欢 clickLeftLayout.MouseDownEventHandler += (sen, e) => { leftBtnTitle.IsSelected = true; @@ -719,16 +921,16 @@ rightBtnTitle.IsSelected = false; rightBtnLine.IsSelected = false; rightBtnLine.Visible = false; + action?.Invoke(); }; - } /// <summary> - /// 鎺у埗鐩戝惉鏂规硶 + /// 淇″彿婧愮洃鍚柟娉� /// </summary> - /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄</param> - public void SetLfteClickListener(Action<Button> action) + public void SetRightClickListener(Action action) { - //鎺у埗鐐瑰嚮浜嬩欢 + + //鐐瑰嚮浜嬩欢 clickRightLayout.MouseDownEventHandler += (sen, e) => { leftBtnTitle.IsSelected = false; @@ -737,243 +939,89 @@ rightBtnTitle.IsSelected = true; rightBtnLine.IsSelected = true; rightBtnLine.Visible = true; + action?.Invoke(); + }; + } - - } /// <summary> - /// 鑿滃崟瀹瑰櫒 + /// 淇″彿婧愬鍣� /// </summary> - class MuenFrameLayout + class SourceFrameLayout : FrameLayout { + public const int widthFrameLayout = 375; + public const int heightFrameLayout = 146; + public const int interval = 37;//琛屼腑鐨勫垪闂撮殧鍊� - public FrameLayout parentFl = new FrameLayout + public Action<string> selectAction; + + public SourceFrameLayout(int width = widthFrameLayout, int height = heightFrameLayout) { - Width = Application.GetRealWidth(180), - Height = Application.GetRealWidth(180), - Radius = (uint)Application.GetRealHeight(90), - BackgroundColor= 0xffF2F3F7, - - }; - - Button btnTop = new Button - { - Y = Application.GetRealWidth(16), - X = Application.GetRealWidth(78), - Width = Application.GetRealWidth(24), - Height = Application.GetRealHeight(20), - UnSelectedImagePath = "AksIcon/shang.png", - SelectedImagePath = "AksIcon/shang_selected.png", - Name = "涓�", - }; - Button btnBottom = new Button - { - Y = Application.GetRealWidth(144), - X = Application.GetRealWidth(78), - Width = Application.GetRealWidth(24), - Height = Application.GetRealHeight(20), - UnSelectedImagePath = "AksIcon/xia.png", - SelectedImagePath = "AksIcon/xia_selected.png", - Name = "涓�", - }; - Button btnLeft = new Button - { - Y = Application.GetRealWidth(78), - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(20), - Height = Application.GetRealHeight(24), - UnSelectedImagePath = "AksIcon/zuo.png", - SelectedImagePath = "AksIcon/zuo_selected.png", - Name = "宸�", - - }; - Button btnRight = new Button - { - Y = Application.GetRealWidth(78), - X = Application.GetRealWidth(144), - Width = Application.GetRealWidth(20), - Height = Application.GetRealHeight(24), - UnSelectedImagePath = "AksIcon/you.png", - SelectedImagePath = "AksIcon/you_selected.png", - Name = "鍙�", - - }; - - Button btnOkbj = new Button - { - //Y = Application.GetRealWidth(52), - //X = Application.GetRealWidth(52), - Width = Application.GetRealWidth(76), - Height = Application.GetRealWidth(76), - Radius = (uint)Application.GetRealHeight(38), - Gravity=Gravity.Center, - BackgroundColor = MusicColor.WhiteColor, - - - }; - Button btnOk = new Button - { - //Y = Application.GetRealWidth(76), - //X = Application.GetRealWidth(76), - Gravity = Gravity.Center, - Width = Application.GetRealWidth(28), - Height = Application.GetRealWidth(28), - Radius = (uint)Application.GetRealHeight(14), - BackgroundColor = MusicColor.SelectedColor, - Name = "纭畾" - }; - - public void AddView(FrameLayout layout) - { - layout.AddChidren(parentFl); - parentFl.AddChidren(btnTop); - parentFl.AddChidren(btnBottom); - parentFl.AddChidren(btnLeft); - parentFl.AddChidren(btnRight); - parentFl.AddChidren(btnOkbj); - parentFl.AddChidren(btnOk); - - + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); } /// <summary> - /// 涓� + /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� /// </summary> - /// <param name="action"></param> - public void SetTopClickListener(Action<KeypadEntity> action) + public void LoadSourcePage() { - EventHandler<MouseEventArgs> UpClick = (sender, e) => + 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++) { - btnTop.IsSelected = false; - //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� - }; - btnTop.MouseUpEventHandler += UpClick; + 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(); - EventHandler<MouseEventArgs> DownClick = (sender, e) => - { - //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnTop.IsSelected = true; - KeypadEntity keypadEntity = new KeypadEntity(); - keypadEntity.name = btnTop.Name; - keypadEntity.keypad = "key_up"; - action?.Invoke(keypadEntity); - }; - btnTop.MouseDownEventHandler += DownClick; + selectAction?.Invoke(button.Text); + }); + //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //{ + // selectImageAction?.Invoke((int)imageFram.Tag); + //} + } + } - - /// <summary> - /// 涓� - /// </summary> - /// <param name="action"></param> - public void SetBottomClickListener(Action<KeypadEntity> action) + private List<string> GetList() { - EventHandler<MouseEventArgs> UpClick = (sender, e) => + return new List<string> { - btnBottom.IsSelected = false; - - - //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + "HDML 1",//" " + "HDML 2", + "HDML 3", + "HDML 4", + "Live TV", + "PS", + "AV", }; - btnBottom.MouseUpEventHandler += UpClick; - - - EventHandler<MouseEventArgs> DownClick = (sender, e) => - { - btnBottom.IsSelected = true; - KeypadEntity keypadEntity = new KeypadEntity(); - keypadEntity.name = btnBottom.Name; - keypadEntity.keypad = "key_down"; - action?.Invoke(keypadEntity); - //鎸変笅鍘绘敼鍙樿儗鏅鑹� - }; - btnBottom.MouseDownEventHandler += DownClick; } - /// <summary> - /// 宸� - /// </summary> - /// <param name="action"></param> - public void SetLeftClickListener(Action<KeypadEntity> action) - { - EventHandler<MouseEventArgs> UpClick = (sender, e) => - { - btnLeft.IsSelected = false; - //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� - }; - btnLeft.MouseUpEventHandler += UpClick; - - - EventHandler<MouseEventArgs> DownClick = (sender, e) => - { - btnLeft.IsSelected = true; - KeypadEntity keypadEntity = new KeypadEntity(); - keypadEntity.name = btnLeft.Name; - keypadEntity.keypad = "key_left"; - action?.Invoke(keypadEntity); - //鎸変笅鍘绘敼鍙樿儗鏅鑹� - }; - btnLeft.MouseDownEventHandler += DownClick; - } - /// <summary> - /// 鍙� - /// </summary> - /// <param name="action"></param> - public void SetRightClickListener(Action<KeypadEntity> action) - { - EventHandler<MouseEventArgs> UpClick = (sender, e) => - { - btnRight.IsSelected = false; - //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� - }; - btnRight.MouseUpEventHandler += UpClick; - - - EventHandler<MouseEventArgs> DownClick = (sender, e) => - { - //鎸変笅鍘绘敼鍙樿儗鏅鑹� - btnRight.IsSelected = true; - KeypadEntity keypadEntity = new KeypadEntity(); - keypadEntity.name = btnRight.Name; - keypadEntity.keypad = "key_right"; - action?.Invoke(keypadEntity); - }; - btnRight.MouseDownEventHandler += DownClick; - } - - - - /// <summary> - /// ok - /// </summary> - /// <param name="action"></param> - public void SetOkClickListener(Action<KeypadEntity> action) - { - EventHandler<MouseEventArgs> UpClick = (sender, e) => - { - btnOk.BackgroundColor = MusicColor.SelectedColor;// this.UpBackgroundColor; - //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� - }; - btnOk.MouseUpEventHandler += UpClick; - - - EventHandler<MouseEventArgs> DownClick = (sender, e) => - { - KeypadEntity keypadEntity = new KeypadEntity(); - keypadEntity.name = btnOk.Name; - keypadEntity.keypad = "key_ok"; - action?.Invoke(keypadEntity); - btnOk.BackgroundColor = 0xffF2F3F7; - }; - btnOk.MouseDownEventHandler += DownClick; - } - } - + #endregion } -- Gitblit v1.8.0