mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
HDL_ON/UI/UI2/FuntionControlView/Aks/YkqPage.cs
@@ -36,6 +36,7 @@
        /// 切换设备容器
        /// </summary>
        TypeMultiFramLayout typeMultiFramLayout;
        TypeSingleFramLayout tyySingleFramLayout;
        Button switchBtn;
        CustomFrameLayout xinxiFL;
@@ -105,10 +106,10 @@
        private void EventListener()
        {
            //开关
            switchBtn.MouseDownEventHandler += (senser, e) =>
            switchBtn.MouseUpEventHandler += (senser, e) =>
            {
                switchBtn.IsSelected = true;
                KeyControl("on_off", "开/关");
                this.SetButtonIsSelected(switchBtn);
            };
            //信息
            xinxiFL.SetClickListener(() =>
@@ -153,7 +154,7 @@
            //1
            number1FL.SetClickListener(() =>
            {
                 KeyControl("number_1", "1");
                KeyControl("number_1", "1");
            });
            //2
            number2FL.SetClickListener(() =>
@@ -236,59 +237,69 @@
            });
            //左
            btnLeft.MouseDownEventHandler += (sender, e) =>
            btnLeft.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_left_selected.png";
                KeyControl("key_left", "左");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_left_selected.png", "AksIcon/ykq_ok.png");
            };
            //上
            btnShang.MouseDownEventHandler += (sender, e) =>
            btnShang.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_shang_selected.png";
                KeyControl("key_up", "上");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_shang_selected.png", "AksIcon/ykq_ok.png");
            };
            //右
            btnRight.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_right_selected.png";
                KeyControl("key_right", "右");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_right_selected.png", "AksIcon/ykq_ok.png");
            };
            //下
            btnXia.MouseDownEventHandler += (sender, e) =>
            btnXia.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_xia_selected.png";
                KeyControl("key_down", "下");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_xia_selected.png", "AksIcon/ykq_ok.png");
            };
            //OK
            btnOk.MouseDownEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok_selected.png";
                KeyControl("key_ok", "确定");
                this.SetHighlightImagePath(okFl, "AksIcon/ykq_ok_selected.png", "AksIcon/ykq_ok.png");
            };
            //音量+
            btnYingliangjia.MouseDownEventHandler += (sen, e) => {
                btnYingliangjia.IsSelected = true;
            btnYingliangjia.MouseUpEventHandler += (sen, e) =>
            {
                KeyControl("volume_up", "音量+");
                this.SetButtonIsSelected(btnYingliangjia);
            };
            //音量-
            btnYingliangjian.MouseDownEventHandler += (sen, e) => {
                btnYingliangjian.IsSelected = true;
            btnYingliangjian.MouseUpEventHandler += (sen, e) =>
            {
                KeyControl("volume_down", "音量-");
                this.SetButtonIsSelected(btnYingliangjian);
            };
            //频道+
            btnPindaojia.MouseDownEventHandler += (sen, e) => {
                btnPindaojia.IsSelected = true;
            btnPindaojia.MouseUpEventHandler += (sen, e) =>
            {
                KeyControl("ch_up", "频道+");
                this.SetButtonIsSelected(btnPindaojia);
            };
            //频道-
            btnPindaojian.MouseDownEventHandler += (sen, e) => {
                btnPindaojian.IsSelected = true;
            btnPindaojian.MouseUpEventHandler += (sen, e) =>
            {
                KeyControl("ch_down", "频道-");
                this.SetButtonIsSelected(btnPindaojian);
            };
            //菜单
@@ -300,7 +311,7 @@
            //返回
            fanhuiFL.SetClickListener(() =>
            {
                KeyControl("return", "返回");
                KeyControl("cancel", "返回");
            });
            //上一部
@@ -354,22 +365,30 @@
            });
            //时序器
            typeMultiFramLayout.SetLeftFlClickListener((f) =>
            if (typeMultiFramLayout != null)
            {
                SxqPage sxqPage = new SxqPage(this.sequencerList,this.remoteControl.deviceId);
                MainPage.BasePageView.AddChidren(sxqPage);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                sxqPage.Show();
                //时序器
                typeMultiFramLayout.SetLeftFlClickListener((f) =>
                {
                    SxqPage sxqPage = new SxqPage(this.sequencerList, this.remoteControl.deviceId);
                    MainPage.BasePageView.AddChidren(sxqPage);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    sxqPage.Show();
            });
            //设备切换
            typeMultiFramLayout.SetRightFlClickListener((f) =>
                });
                //设备切换
                typeMultiFramLayout.SetRightFlClickListener((f) =>
                {
                    action?.Invoke(IntType.Control);
                });
            }
            if (tyySingleFramLayout != null)
            {
                Console.WriteLine("4");
                action?.Invoke(IntType.Control);
            });
                tyySingleFramLayout.SetClickListener((f) =>
                {
                    action?.Invoke(IntType.Control);
                });
            }
        }
        /// <summary>
@@ -387,7 +406,8 @@
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = MusicColor.TextColor,
                TextSize = TextSize.Text16,
                TextID = StringId.xuniyaokongqi,
                Text = this.remoteControl.name,
                IsBold = true,
            };
            this.AddChidren(btnTitle);
@@ -396,7 +416,7 @@
            {
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                Width = Application.GetRealWidth(240),
                Height = Application.GetRealHeight(1095),//遥控器固定高度
                Height = Application.GetRealHeight(1095 - 122 - 60),//遥控器固定高度
                Radius = (uint)Application.GetRealHeight(17),
                BackgroundColor = 0xff798394,
                Gravity = Gravity.CenterHorizontal,
@@ -409,7 +429,7 @@
                Y = btnTitle.Bottom + Application.GetRealHeight(16),
                //X = Application.GetRealWidth(71),
                Width = Application.GetRealWidth(232),
                Height = Application.GetRealHeight(1095),//遥控器固定高度
                Height = Application.GetRealHeight(1095 - 122 - 60),//遥控器固定高度
                Radius = (uint)Application.GetRealHeight(17),
                BackgroundColor = 0xff19181E,
                Gravity = Gravity.CenterHorizontal,
@@ -425,26 +445,30 @@
                Width = Application.GetRealWidth(48),
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = 0xff201F25,
                Radius = (uint)Application.GetRealHeight(24),
                Radius = (uint)Application.GetRealWidth(24),
            };
            layout.AddChidren(switchFl);
            switchBtn = new Button
            {
                Height = Application.GetRealWidth(32),
                Width = Application.GetRealWidth(32),
                Height = Application.GetRealWidth(48),
                Width = Application.GetRealWidth(48),
                Gravity = Gravity.Center,
                UnSelectedImagePath = "AksIcon/ykq_kai.png",
                SelectedImagePath= "AksIcon/ykq_kaiguang_selected.png"
                SelectedImagePath = "AksIcon/ykq_kaiguang_selected.png"
            };
            switchFl.AddChidren(switchBtn);
            switchBtn.MouseUpEventHandler += (senser, e) =>
            switchBtn.MouseDownEventHandler += (senser, e) =>
            {
                switchBtn.IsSelected = true;
            };
            switchBtn.MouseUpOutsideEventHandler += (senser, e) =>
            {
                switchBtn.IsSelected = false;
            };
            int h = 49;
            int h = 49 - 6;
            int offset = 28;//x轴偏移量
            int septal = 36;//间隔
            #region
@@ -480,7 +504,7 @@
            var line2Fl = new FrameLayout
            {
                Y = line1Fl.Bottom + Application.GetRealHeight(16),
                Y = line1Fl.Bottom + Application.GetRealHeight(8),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line2Fl);
@@ -520,7 +544,7 @@
            var line3Fl = new FrameLayout
            {
                Y = line2Fl.Bottom + Application.GetRealHeight(16),
                Y = line2Fl.Bottom + Application.GetRealHeight(8),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line3Fl);
@@ -553,7 +577,7 @@
            var line4Fl = new FrameLayout
            {
                Y = line3Fl.Bottom + Application.GetRealHeight(16),
                Y = line3Fl.Bottom + Application.GetRealHeight(8),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line4Fl);
@@ -695,7 +719,7 @@
            var line8Fl = new FrameLayout
            {
                Y = line7Fl.Bottom + Application.GetRealHeight(32),
                Y = line7Fl.Bottom + Application.GetRealHeight(16),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line8Fl);
@@ -740,14 +764,14 @@
            var baseFl = new BaseFramLayout
            {
                Y = line8Fl.Bottom,
                Height = Application.GetRealHeight(207),
                Height = Application.GetRealHeight(207 - 32 - 12),
            };
            layout.AddChidren(baseFl);
            btnYingliangjia = new Button
            {
                Y = Application.GetRealHeight(32),
                Y = Application.GetRealHeight(16),
                X = Application.GetRealWidth(26),
                Width = Application.GetRealWidth(36),
                Height = Application.GetRealWidth(36),
@@ -755,10 +779,7 @@
                SelectedImagePath = "AksIcon/ykq_yingliangjia_selected.png",
            };
            baseFl.AddChidren(btnYingliangjia);
            btnYingliangjia.MouseUpEventHandler += (sen,e) => {
                btnYingliangjia.IsSelected = false;
            };
            btnYingliangjian = new Button
@@ -771,16 +792,12 @@
                SelectedImagePath = "AksIcon/ykq_yingliangjian_selected.png",
            };
            baseFl.AddChidren(btnYingliangjian);
            btnYingliangjian.MouseUpEventHandler += (sen, e) => {
                btnYingliangjian.IsSelected = false;
            };
            btnPindaojia = new Button
            btnPindaojia = new Button
            {
                Y = Application.GetRealHeight(32),
                Y = Application.GetRealHeight(16),
                X = Application.GetRealWidth(170),
                Width = Application.GetRealWidth(36),
                Height = Application.GetRealWidth(36),
@@ -788,10 +805,7 @@
                SelectedImagePath = "AksIcon/ykq_pindaojia_selected.png",
            };
            baseFl.AddChidren(btnPindaojia);
            btnPindaojia.MouseUpEventHandler += (sen, e) => {
                btnPindaojia.IsSelected = false;
            };
            btnPindaojian = new Button
@@ -804,16 +818,13 @@
                SelectedImagePath = "AksIcon/ykq_pindaojian_selected.png",
            };
            baseFl.AddChidren(btnPindaojian);
            btnPindaojian.MouseUpEventHandler += (sen, e) => {
                btnPindaojian.IsSelected = false;
            };
            okFl = new FrameLayout
            {
                Y = Application.GetRealHeight(32),
                Y = Application.GetRealHeight(16),
                Height = Application.GetRealWidth(143),
                Width = Application.GetRealWidth(143),
                BackgroundImagePath = "AksIcon/ykq_ok.png",
@@ -870,37 +881,6 @@
            };
            okFl.AddChidren(btnOk);
            btnLeft.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnShang.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnRight.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnXia.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            btnOk.MouseUpEventHandler += (sender, e) =>
            {
                okFl.BackgroundImagePath = "AksIcon/ykq_ok.png";
            };
            #endregion
@@ -938,7 +918,7 @@
            var line10Fl = new FrameLayout
            {
                Y = line9Fl.Bottom + Application.GetRealHeight(16),
                Y = line9Fl.Bottom + Application.GetRealHeight(8),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line10Fl);
@@ -982,7 +962,7 @@
            var line11Fl = new FrameLayout
            {
                Y = line10Fl.Bottom + Application.GetRealHeight(16),
                Y = line10Fl.Bottom + Application.GetRealHeight(8),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line11Fl);
@@ -993,7 +973,7 @@
            kuaituiFL.AddImageView();
            kuaituiFL.AddTextButtonView();
            kuaituiFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_kuaitui.png";
            kuaituiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_kuaitui_selected.png";
            kuaituiFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_kuaijin_selected.png";
            kuaituiFL.GetTextButton().Text = "快退";
            kuaituiFL.AddClickView();
@@ -1019,7 +999,7 @@
            kusinjinFL.AddImageView();
            kusinjinFL.AddTextButtonView();
            kusinjinFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_kuaijin.png";
            kusinjinFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_kuaijin_selected.png";
            kusinjinFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_kuaitui_selected.png";
            kusinjinFL.GetTextButton().Text = "快进";
            kusinjinFL.AddClickView();
@@ -1030,7 +1010,7 @@
            var line12Fl = new FrameLayout
            {
                Y = line11Fl.Bottom + Application.GetRealHeight(16),
                Y = line11Fl.Bottom + Application.GetRealHeight(8),
                Height = Application.GetRealHeight(h),
            };
            layout.AddChidren(line12Fl);
@@ -1042,7 +1022,7 @@
            dengguanFL.AddTextButtonView();
            dengguanFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_dengguan.png";
            dengguanFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_dengguang_selected.png";
            dengguanFL.GetTextButton().Text = "灯关";
            dengguanFL.GetTextButton().Text = "灯光1";
            dengguanFL.AddClickView();
@@ -1065,7 +1045,7 @@
            dankongdengFL.AddTextButtonView();
            dankongdengFL.GetImageButton().UnSelectedImagePath = "AksIcon/ykq_dankongdeng.png";
            dankongdengFL.GetImageButton().SelectedImagePath = "AksIcon/ykq_dankongdeng_selected.png";
            dankongdengFL.GetTextButton().Text = "单控灯";
            dankongdengFL.GetTextButton().Text = "灯光2";
            dankongdengFL.AddClickView();
            #endregion
@@ -1080,10 +1060,40 @@
            cornerBottomFram.BackgroundColor = MusicColor.WhiteColor;
            this.AddChidren(cornerBottomFram);
            typeMultiFramLayout = new TypeMultiFramLayout();
            typeMultiFramLayout.multiFramLayout.Y = Application.GetRealHeight(16);
            typeMultiFramLayout.AddView(cornerBottomFram);
            typeMultiFramLayout.btnBottonRightName.TextID = StringId.xuniyaokongqi;
            if (sequencerList.Count == 0)
            {
                //没有时序器
                tyySingleFramLayout = new TypeSingleFramLayout();
                tyySingleFramLayout.AddView(cornerBottomFram);
                tyySingleFramLayout.singleFramLayout.X = Application.GetRealWidth(226);
                tyySingleFramLayout.singleFramLayout.Width = Application.GetRealWidth(101);
                tyySingleFramLayout.singleFramLayout.Gravity = Gravity.CenterVertical;
                tyySingleFramLayout.btnName.Text = this.remoteControl.name;
                tyySingleFramLayout.btnName.X = Application.GetRealWidth(16);
                tyySingleFramLayout.btnName.Width = Application.GetRealWidth(48);
                tyySingleFramLayout.btnRightImage.X = tyySingleFramLayout.btnName.Right + Application.GetRealWidth(8);
                tyySingleFramLayout.btnRightImage.Width = Application.GetRealWidth(16);
                tyySingleFramLayout.btnRightImage.Height = Application.GetRealWidth(16);
                tyySingleFramLayout.btnRightImage.UnSelectedImagePath = "AksIcon/xuanze.png";
                tyySingleFramLayout.btnRightImage.Gravity = Gravity.CenterVertical;
                tyySingleFramLayout.btnLeftImage.Visible = false;
                tyySingleFramLayout.CustomCalculationWidth(TypeSingleFramLayout.Orientation.right,
                  tyySingleFramLayout.singleFramLayout,
                  tyySingleFramLayout.btnName,
                   tyySingleFramLayout.btnRightImage,
                   48, 200);
            }
            else
            {
                typeMultiFramLayout = new TypeMultiFramLayout();
                typeMultiFramLayout.multiFramLayout.Y = Application.GetRealHeight(16);
                typeMultiFramLayout.AddView(cornerBottomFram);
                typeMultiFramLayout.btnRightName.Text = this.remoteControl.name;
            }
            this.AdjustRealHeight(16);
        }
@@ -1093,14 +1103,15 @@
        /// </summary>
        /// <param name="keypad"><按键标识/param>
        /// <param name="keyName"><按键名称(打印用的)/param>
        private void KeyControl(string keypad, string keyName)
        private void KeyControl(string keypad, string keyName, bool isSupport = true)
        {
            //CommonMethod.Current.Loading.Start();
            CommonMethod.Current.SunThread(() =>
            {
                try
                {
                    SendMethod.Current.KeypadExecute(remoteControl.deviceId, remoteControl.rcId, keypad, keyName);
                    SendMethod.Current.KeypadExecute(remoteControl.deviceId, remoteControl.rcId, keypad, keyName, isSupport);
                }
                catch { }
                finally
@@ -1119,10 +1130,10 @@
    /// <summary>
    /// 自己弄一个FrameLayout
    /// </summary>
    class CustomFrameLayout : FrameLayout
    class CustomFrameLayout : BaseFramLayout
    {
        public const int widthFrameLayout = 36;
        public const int heightFrameLayout = 49;
        public const int heightFrameLayout = 49 - 6;
        public CustomFrameLayout(int width = widthFrameLayout, int height = heightFrameLayout)
        {
            this.Width = Application.GetRealWidth(width);
@@ -1144,6 +1155,7 @@
            SelectedTextColor = MusicColor.MusicTxet14SelectedColor,
            TextAlignment = TextAlignment.Center,
            Gravity = Gravity.CenterHorizontal,
            Padding = new Padding(0, 0, 0, 0),
        };
        Button btnNumber = new Button
        {
@@ -1161,9 +1173,9 @@
            Width = Application.GetRealWidth(12),
            Height = Application.GetRealWidth(12),
            Gravity = Gravity.Center,
            Radius = (uint)Application.GetRealHeight(6),
            BackgroundColor=0x00000000,
            SelectedBackgroundColor = 0xFFEFEFEF,
            Radius = (uint)Application.GetRealWidth(6),
            BackgroundColor = 0x00000000,
            SelectedBackgroundColor = 0xFFF2F3F7,
        };
        public FrameLayout clickFl = new FrameLayout
@@ -1223,25 +1235,31 @@
        /// <param name="action">回调(父类对象)</param>
        public void SetClickListener(Action action)
        {
            clickFl.MouseDownEventHandler += (sender, e) =>
            clickFl.MouseUpEventHandler += (sender, e) =>
            {
                //this.BackgroundColor = 0xff798394;
                action?.Invoke();
                //按下去改变背景颜色
                btnImage.IsSelected = true;
                btnText.IsSelected = true;
                btnNumber.IsSelected = true;
                btn.IsSelected = true;
                action?.Invoke();
                new System.Threading.Thread(() =>
                {
                    System.Threading.Thread.Sleep(millisecondsTimeout);
                    Application.RunOnMainThread(() =>
                    {
                        //弹起来还原背景颜色
                        btnImage.IsSelected = false;
                        btnText.IsSelected = false;
                        btnNumber.IsSelected = false;
                        btn.IsSelected = false;
                    });
                })
                { IsBackground = true }.Start();
            };
            clickFl.MouseUpEventHandler += (sender, e) =>
            {
                //this.BackgroundColor = 0x00000000;
                btnImage.IsSelected = false;
                btnText.IsSelected = false;
                btnNumber.IsSelected = false;
                btn.IsSelected = false;
            };
        }