mac
2024-07-25 f9181a9c8125136f597add7c30cb2ff508d54ba7
HDL_ON/UI/UI2/FuntionControlView/HisenseTV /HisenseTvPage.cs
@@ -93,7 +93,7 @@
            this.btnRoomName = btnRoomName;
            this.btnCollectionIcon = btnCollectionIcon;
            this.comerom = comerom;
            this.action = action;
            this.action = action;
        }
@@ -105,7 +105,7 @@
            //初始化事件
            this.EventListener();
            //读取数据
            //this.ReadData();
            this.ReadData();
        }
@@ -168,8 +168,7 @@
            //开机
            kaijiFL.SetClickListener((fl, btnImage, btnText) =>
            {
                //Send.Current.Open("b7686438");
                ControlCommand(HisenseTVFunctionalAttributeConstant.on_off, "on");
                ControlCommand(HisenseTVFunctionalAttributeConstant.wol, "on");
            });
            //关机
@@ -179,24 +178,24 @@
            });
            //音量+
            btn_jia.MouseDownEventHandler += (sender, e) =>
            btn_jia.MouseUpEventHandler += (sender, e) =>
            {
                btn_jia.IsSelected = true;
                ControlCommand(HisenseTVFunctionalAttributeConstant.volume_add, "");
                this.SetButtonIsSelected(btn_jia);
            };
            //音量-
            btn_jian.MouseDownEventHandler += (sender, e) =>
            btn_jian.MouseUpEventHandler += (sender, e) =>
            {
                btn_jian.IsSelected = true;
                ControlCommand(HisenseTVFunctionalAttributeConstant.volume_subtract, "");
                this.SetButtonIsSelected(btn_jian);
            };
            //菜单
           caidanBtn.SetClickListener((btn) =>
            {
                ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11");
            caidanBtn.SetClickListener((btn) =>
             {
                 ControlCommand(HisenseTVFunctionalAttributeConstant.operation, "11");
            });
             });
            //播放
            bofangBtn.SetClickListener((btn) =>
            {
@@ -293,6 +292,26 @@
        {
            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);
@@ -304,14 +323,27 @@
        /// </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
@@ -343,7 +375,7 @@
            {
                Y = Application.GetRealHeight(24),
                X = Application.GetRealWidth(24),
                Height = Application.GetRealHeight(648),
                Height = Application.GetRealHeight(648-60),
                Width = Application.GetRealWidth(327),
                BackgroundImagePath = "HisenseTv/onbj.png",
            };
@@ -390,7 +422,7 @@
                TextAlignment = TextAlignment.CenterLeft,
            };
            backgroundOpenFl.AddChidren(btnOpenCurrDeviceRoom);
            int yHeight = btnOpenCurrDeviceRoom.Bottom + Application.GetRealHeight(16);
            shouyeFL = new CustomFrameLayout();
            backgroundOpenFl.AddChidren(shouyeFL);
@@ -413,7 +445,7 @@
            kaijiFL.GetImageButton().SelectedImagePath = "HisenseTv/kaiguanSelected.png";
            kaijiFL.GetTextButton().TextID = StringId.kaiji;
            guanFL = new CustomFrameLayout();
            guanFL = new CustomFrameLayout();
            backgroundOpenFl.AddChidren(guanFL);
            guanFL.X = kaijiFL.Right + Application.GetRealWidth(37);
            guanFL.Y = yHeight;
@@ -426,12 +458,12 @@
            var yinliangFL = new FrameLayout();
            backgroundOpenFl.AddChidren(yinliangFL);
            yinliangFL.Height = Application.GetRealHeight(146);
            yinliangFL.Height = Application.GetRealHeight(146-16);
            yinliangFL.Width = Application.GetRealWidth(68);
            yinliangFL.Y = Application.GetRealHeight(260);
            yinliangFL.Y = Application.GetRealHeight(260-8-20);
            yinliangFL.X = shouyeFL.X;
            yinliangFL.BackgroundColor = 0xffF2F3F7;
            yinliangFL.Radius = (uint)Application.GetRealHeight(34);
            yinliangFL.BackgroundColor = 0xFFF2F3F7;
            yinliangFL.Radius = (uint)Application.GetRealWidth(34);
            btn_jia = new Button
            {
@@ -446,7 +478,7 @@
            yinliangFL.AddChidren(btn_jia);
            Button btnText = new Button
            {
                Y = Application.GetRealHeight(63),
                Y = Application.GetRealHeight(63-8),
                Height = Application.GetRealHeight(20),
                //Text = "音量",
                TextID = StringId.yinliang,
@@ -458,7 +490,7 @@
            yinliangFL.AddChidren(btnText);
            btn_jian = new Button
            {
                Y = Application.GetRealHeight(98),
                Y = Application.GetRealHeight(98-8),
                Width = Application.GetRealWidth(32),
                Height = Application.GetRealWidth(32),
                UnSelectedImagePath = "HisenseTv/yingliangjian.png",
@@ -467,47 +499,38 @@
            };
            yinliangFL.AddChidren(btn_jian);
            btn_jia.MouseUpEventHandler += (sender, e) =>
            {
                btn_jia.IsSelected = false;
            };
            btn_jian.MouseUpEventHandler += (sender, e) =>
            {
                btn_jian.IsSelected = false;
            };
            int bottomValue= 4;
            caidanBtn = new CustomButton();
            caidanBtn.TextID = StringId.caidan;
            caidanBtn.Y = shouyeFL.Bottom + Application.GetRealHeight(24);
            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(24);
            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(24);
            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(16);
            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(16);
            kauituiBtn.Y = bofangBtn.Bottom + Application.GetRealHeight(bottomValue1);
            kauituiBtn.X = kuaijinBtn.Right + Application.GetRealWidth(37);
            backgroundOpenFl.AddChidren(kauituiBtn);
@@ -516,14 +539,14 @@
            jingyinBtn = new CustomButton();
            jingyinBtn.TextID = StringId.jingyin;
            jingyinBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(16);
            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(16);
            shezhiBtn.Y = kuaijinBtn.Bottom + Application.GetRealHeight(bottomValue1);
            shezhiBtn.X = jingyinBtn.Right + Application.GetRealWidth(37);
            backgroundOpenFl.AddChidren(shezhiBtn);
@@ -531,28 +554,28 @@
            jiechujingyinBtn = new CustomButton();
            jiechujingyinBtn.TextID = StringId.jiechujingyin;
            jiechujingyinBtn.Y = jingyinBtn.Bottom + Application.GetRealHeight(16);
            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(16);
            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(32);
            typeFrameLayout.middLayout.Y = yinliangFL.Bottom + Application.GetRealHeight(16);
            typeFrameLayout.AddView(backgroundOpenFl);
            muenFrameLayout = new MenuFramLayout();
            muenFrameLayout.Y = Application.GetRealHeight(482);
            muenFrameLayout.Y = Application.GetRealHeight(482-60);
            muenFrameLayout.AddView(backgroundOpenFl);
            sourceFrameLayout = new SourceFrameLayout();
            sourceFrameLayout.Y = Application.GetRealHeight(482);
            sourceFrameLayout.Y = Application.GetRealHeight(482-60);
            backgroundOpenFl.AddChidren(sourceFrameLayout);
            sourceFrameLayout.LoadSourcePage();
@@ -580,7 +603,7 @@
            #endregion
        }
        /// <summary>
        /// 初始化头部
        /// </summary>
@@ -592,7 +615,7 @@
            this.topView.topNameBtn.TextID = StringId.dianshi;
            this.AddChidren(topView.TopFLayoutView());
        }
        /// <summary>
        /// 重新计算宽度(设备名称,房间控件)
@@ -624,7 +647,7 @@
    /// <summary>
    /// 自定义(首页,关机,菜单)容器
    /// </summary>
    class CustomFrameLayout : FrameLayout
    class CustomFrameLayout : BaseFramLayout
    {
        public const int widthFrameLayout = 68;
        public const int heightFrameLayout = 68 + 8 + 20;
@@ -650,7 +673,7 @@
            TextID = StringId.dangqianmenweiguan,
            TextSize = TextSize.Text14,
            TextColor = MusicColor.TextColor,
            SelectedTextColor= MusicColor.MusicTxet14SelectedColor,
            SelectedTextColor = MusicColor.MusicTxet14SelectedColor,
            TextAlignment = TextAlignment.Center,
            Gravity = Gravity.CenterHorizontal,
            Name = "btnText",
@@ -682,21 +705,11 @@
        /// <param name="button2">注意:在SetClickListener()前面调用AddImageView()才有效</param>
        public void SetClickListener(Action<FrameLayout, Button, Button> action)
        {
            EventHandler<MouseEventArgs> DownClick = (sender, e) =>
            {
                btnImage.IsSelected = true;
                //btnText.IsSelected = true;
                action?.Invoke(this, btnImage, btnText);
            };
            this.MouseDownEventHandler += DownClick;
            btnImage.MouseDownEventHandler += DownClick;
            btnText.MouseDownEventHandler += DownClick;
            EventHandler<MouseEventArgs> UpClick = (sender, e) =>
             {
                 btnImage.IsSelected = false;
                 //btnText.IsSelected = false;
                 action?.Invoke(this, btnImage, btnText);
                 SetButtonIsSelected(btnImage);
             };
            this.MouseUpEventHandler += UpClick;
            btnImage.MouseUpEventHandler += UpClick;
@@ -721,10 +734,12 @@
            this.SelectedTextColor = MusicColor.MusicTxet14SelectedColor;
            this.TextAlignment = TextAlignment.Center;
            this.IsMoreLines = true;
            this.BackgroundColor = 0xffECEDEE;
            this.SelectedBackgroundColor = 0xFFF2F3F7;
            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>
        /// 事件监听方法
@@ -732,19 +747,12 @@
        /// <param name="action">回调(第一个是父类对象</param>
        public void SetClickListener(Action<Button> action)
        {
            EventHandler<MouseEventArgs> DownClick = (sender, e) =>
            {
                //this.BackgroundColor = 0xFFF2F3F7;
                this.IsSelected = true;
                action?.Invoke(this);
            };
            this.MouseDownEventHandler += DownClick;
            EventHandler<MouseEventArgs> UpClick = (sender, e) =>
            {
                //this.BackgroundColor = 0xffECEDEE;
                this.IsSelected = false;
                action?.Invoke(this);
                new BaseFramLayout().SetButtonIsSelected(this);
            };
            this.MouseUpEventHandler += UpClick;
@@ -774,13 +782,14 @@
        Button leftBtnTitle = new Button
        {
        {
            Height = Application.GetRealHeight(23),
            TextAlignment = TextAlignment.CenterLeft,
            TextColor = MusicColor.TextColor,
            SelectedTextColor = MusicColor.MusicTxet14SelectedColor,
            TextSize = TextSize.Text16,
            TextID = StringId.kongzhi,
            Padding = new Padding(0, 0, 0, 0),
            IsBold = true,
        };
@@ -814,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,
        };
@@ -858,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();
@@ -875,7 +885,7 @@
            rightBtnLine.Y = rightBtnTitle.Bottom + Application.GetRealHeight(4);
            rightBtnLine.Y = rightBtnTitle.Bottom + Application.GetRealHeight(0);
            if (rightBtnTitle.GetTextWidth() < rightBtnTitle.Width)
            {