wjc
2023-08-22 8cefc1f93fc2db49465a5dd11ce94ed11267ea53
HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs
@@ -15,7 +15,7 @@
    {
        #region ■ 变量声明___________________________
        #region   -------变量声明---------
        /// <summary>
        /// 设备
        /// </summary>
@@ -162,45 +162,127 @@
            };
           
            //首页
            shouyeFL.SetClickListener((fl, btnImage, btnText) => { });
            shouyeFL.SetClickListener((fl, btnImage, btnText) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.home_page, "");
            });
            //关机
            kaiguanFL.SetClickListener((fl, btnImage, btnText) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.on_off, "0", (isBool) =>
                {
                    if (isBool)
                    {
                        CommonMethod.Current.MainThread(() =>
            {
                vv.Visible = false;
                baseCloseFFL.Visible = true;
            });
                    }
                    else
                    {
                        //提示:关机失败;
                    }
                });
            });
            //菜单
            caidanFL.SetClickListener((fl, btnImage, btnText) => { });
            caidanFL.SetClickListener((fl, btnImage, btnText) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11");
            });
            //音量+
            btn_jia.MouseDownEventHandler += (sender, e) => { };
            btn_jia.MouseDownEventHandler += (sender, e) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.volume_add, "");
            };
            //音量-
            btn_jian.MouseDownEventHandler += (sender, e) => { };
            btn_jian.MouseDownEventHandler += (sender, e) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.volume_subtract, "");
            };
            //播放
            bofangBtn.SetClickListener((btn) => { });
            bofangBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.media_play, "");
            });
            //暂停
            zantingBtn.SetClickListener((btn) => { });
            zantingBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.media_pause, "");
            });
            //快进
            kuaijinBtn.SetClickListener((btn) => { });
            kuaijinBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.fast_forward, "");
            });
            //快退
            kauituiBtn.SetClickListener((btn) => { });
            kauituiBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.fast_back, "");
            });
            //静音
            jingyinBtn.SetClickListener((btn) => { });
            jingyinBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.mute, "1");
            });
            //设置
            shezhiBtn.SetClickListener((btn) => { });
            shezhiBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.system_setting, "");
            });
            //解除静音
            jiechujingyinBtn.SetClickListener((btn) => { });
            jiechujingyinBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.mute, "0");
            });
            //返回
            fanhuiBtn.SetClickListener((btn) => { });
            //控制菜单
            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);
            };
@@ -213,10 +295,40 @@
            //开机
            clickBtn.MouseDownEventHandler += (sen, e) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.on_off, "1", (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>
        /// 初始数据
@@ -242,6 +354,8 @@
                }
            });
        }
        #region   -------界面布局---------
        /// <summary>
        /// 初始化【开机】界面
        /// </summary>
@@ -316,7 +430,7 @@
            shouyeFL.AddImageView();
            shouyeFL.AddTextButtonView();
            shouyeFL.GetImageButton().UnSelectedImagePath = "HisenseTv/shouye.png";
            shouyeFL.GetTextButton().Text = "首页";
            shouyeFL.GetTextButton().TextID = StringId.shouye;
            kaiguanFL = new CustomFrameLayout();
@@ -326,7 +440,7 @@
            kaiguanFL.AddImageView();
            kaiguanFL.AddTextButtonView();
            kaiguanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/kaiguan.png";
            kaiguanFL.GetTextButton().Text = "关机";
            kaiguanFL.GetTextButton().TextID = StringId.guanji;
            caidanFL = new CustomFrameLayout();
            backgroundOpenFl.AddChidren(caidanFL);
@@ -335,7 +449,7 @@
            caidanFL.AddImageView();
            caidanFL.AddTextButtonView();
            caidanFL.GetImageButton().UnSelectedImagePath = "HisenseTv/caidan.png";
            caidanFL.GetTextButton().Text = "菜单";
            caidanFL.GetTextButton().TextID = StringId.caidan;
            var yinliangFL = new FrameLayout();
            backgroundOpenFl.AddChidren(yinliangFL);
@@ -360,7 +474,8 @@
            {
                Y = Application.GetRealHeight(90),
                Height = Application.GetRealHeight(20),
                Text = "音量",
                //Text = "音量",
                TextID = StringId.yinliang,
                TextColor = MusicColor.TextColor,
                TextSize = TextSize.Text14,
                Gravity = Gravity.CenterHorizontal,
@@ -389,28 +504,28 @@
            };
            bofangBtn = new CustomButton();
            bofangBtn.Text = "播放";
            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.Text = "暂停";
            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.Text = "快进";
            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.Text = "快退";
            kauituiBtn.TextID = StringId.kuaitui;
            kauituiBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(16);
            kauituiBtn.X = kuaijinBtn.Right + Application.GetRealWidth(37);
            backgroundOpenFl.AddChidren(kauituiBtn);
@@ -419,14 +534,14 @@
            jingyinBtn = new CustomButton();
            jingyinBtn.Text = "静音";
            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.Text = "设置";
            shezhiBtn.TextID = StringId.shezhi;
            shezhiBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(16);
            shezhiBtn.X = jingyinBtn.Right + Application.GetRealWidth(37);
            backgroundOpenFl.AddChidren(shezhiBtn);
@@ -434,14 +549,14 @@
            jiechujingyinBtn = new CustomButton();
            jiechujingyinBtn.Text = "解除静音";
            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.Text = "返回";
            fanhuiBtn.TextID = StringId.fanhui;
            fanhuiBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(16);
            fanhuiBtn.X = jiechujingyinBtn.Right + Application.GetRealWidth(37);
            backgroundOpenFl.AddChidren(fanhuiBtn);
@@ -566,7 +681,8 @@
                Height = Application.GetRealHeight(22),
                TextSize = TextSize.Text16,
                TextColor = MusicColor.TextColor,
                Text = "已关机",
                //Text = "已关机",
                TextID = StringId.yiguanji,
                TextAlignment = TextAlignment.Center,
                Gravity = Gravity.CenterHorizontal,
                Padding = new Padding(0, 16, 0, 16),
@@ -599,7 +715,7 @@
                Height = Application.GetRealHeight(16),
                TextSize = TextSize.Text12,
                TextColor = MusicColor.TextCancelColor,
                Text = "开机",
                TextID = StringId.kaiji,
                TextAlignment = TextAlignment.Center,
                Gravity = Gravity.CenterHorizontal,
                Padding = new Padding(0, 2, 0, 2),
@@ -693,8 +809,10 @@
            //this.cellFrame.X = this.btnCurrDeviceRoom.Right + Application.GetRealWidth(20);
        }
       
    }
        #endregion
    }
    #region   -------自定义当前界面的容器---------
    /// <summary>
    /// 自定义(首页,关机,菜单)容器
    /// </summary>
@@ -1052,6 +1170,7 @@
                button.SetClickListener((btn) =>
                {
                    // MovieLibrary movieLibrary = new MovieLibrary();
                    selectAction?.Invoke(button.Text);
                });
                //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i)
@@ -1065,7 +1184,7 @@
        {
            return new List<string>
            {
                "HDML 1",
                "HDML 1",//" "
                "HDML 2",
                "HDML 3",
                "HDML 4",
@@ -1078,6 +1197,6 @@
    }
    #endregion
}