From bb6ad792b598927a5459a5fb6f6c27fb1aa9e94e Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 17 十二月 2020 14:06:36 +0800
Subject: [PATCH] 20201217-1

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs |  100 +++++++++++++++++++++++++++++---------------------
 1 files changed, 58 insertions(+), 42 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
index a278200..cdbf1b7 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
@@ -7,36 +7,18 @@
     public partial class TVPage
     {
         /// <summary>
-        /// 鏇存柊鐏厜鐘舵��
-        /// </summary>
-        public static void UpdataState(TV uTv)
-        {
-            Application.RunOnMainThread(() =>
-            {
-                try
-                {
-                    if (bodyView == null)
-                        return;
-                    bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uTv.on_off == "on";
-                }
-                catch (Exception ex)
-                {
-                    MainPage.Log($"RelayPage error {ex.Message}");
-                }
-            });
-        }
-        /// <summary>
         /// 鍔犺浇浜嬩欢鍒楄〃
         /// </summary>
         void LoadEventList()
         {
-            LoadSwitchEvent();
+            LoadControlEvent();
             LoadCollectionEvent();
 
             //鍥為��鍒锋柊淇℃伅浜嬩欢
             actionRefresh = () => {
                 btnFunctionName.Text = btnFunctionName_Out.Text = tv.name;
                 btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = tv.GetRoomListName();
+                tv.SaveFunctionData(true);
             };
         }
 
@@ -46,39 +28,73 @@
         void LoadCollectionEvent()
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
-                btnCollection.IsSelected = tv.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                DB_ResidenceData.residenceData.SaveResidenceData();
+                btnCollection.IsSelected = tv.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+                tv.SaveFunctionData(true);
             };
         }
 
         /// <summary>
-        /// 鍔犺浇寮�鍏充簨浠�
+        /// 鍔犺浇鎺у埗浜嬩欢
         /// </summary>
-        void LoadSwitchEvent()
+        void LoadControlEvent()
         {
-            btnSwitchIcon.MouseUpEventHandler += (sender, e) =>
+            btnChangeTVAV.MouseUpEventHandler = (sender, e) =>
             {
-                btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected;
-
-                new System.Threading.Thread(() =>
-                {
-                    tv.on_off = btnSwitch.IsSelected ? "on" : "off";
-                    Control.Send(CommandType_A.write, this.tv);
-                })
-                { IsBackground = true }.Start();
+                tv.ControlTV(InfraredCode_TV.AV_TV);
             };
-            btnSwitch.MouseUpEventHandler += (sender, e) =>
+            btnChlPlus.MouseUpEventHandler = (sender, e) =>
             {
-                btnSwitch.IsSelected = !btnSwitch.IsSelected;
-
-                new System.Threading.Thread(() =>
-                {
-                    tv.on_off = btnSwitch.IsSelected ? "on" : "off";
-                    Control.Send(CommandType_A.write, this.tv);
-                })
-                { IsBackground = true }.Start();
+                tv.ControlTV(InfraredCode_TV.ChannelUp);
+            };
+            btnChlReduce.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.ChannelDown);
+            };
+            btnVolPlus.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.VolUp);
+            };
+            btnVolReduce.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.VolDown);
+            };
+            btnBack.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.Back);
             };
 
+            btnMenu.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.Menu);
+            };
+            btn123.MouseUpEventHandler = (sender, e) =>
+            {
+                ShowNumberView();
+            };
+            btnMute.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.Mute);
+            };
+            btnPower.MouseUpEventHandler = (sender, e) =>
+            {
+                tv.ControlTV(InfraredCode_TV.Power);
+            };
+
+            btnTopMenuUp.MouseUpEventHandler = (sender, e) => {
+                tv.ControlTV(InfraredCode_TV.Up);
+            };
+            btnTopMenuLeft.MouseUpEventHandler = (sender, e) => {
+                tv.ControlTV(InfraredCode_TV.Left);
+            };
+            btnTopMenuRight.MouseUpEventHandler = (sender, e) => {
+                tv.ControlTV(InfraredCode_TV.Right);
+            };
+            btnTopMenuDown.MouseUpEventHandler = (sender, e) => {
+                tv.ControlTV(InfraredCode_TV.Down);
+            };
+            btnOk.MouseUpEventHandler = (sender, e) => {
+                tv.ControlTV(InfraredCode_TV.Confrim);
+            };
         }
 
     }

--
Gitblit v1.8.0