From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:50:43 +0800
Subject: [PATCH] Revert "1"

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs |  249 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 207 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..5fbf109 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/TVPageBLL.cs
@@ -1,42 +1,26 @@
 锘縰sing System;
 using Shared;
 using HDL_ON.Entity;
+using HDL_ON.DriverLayer;
+using System.Collections.Generic;
 
 namespace HDL_ON.UI
 {
     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();
+                btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
+                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
+                function.UpdataFuncitonInfo();
             };
         }
 
@@ -46,39 +30,220 @@
         void LoadCollectionEvent()
         {
             btnCollection.MouseUpEventHandler += (sender, e) => {
-                btnCollection.IsSelected = tv.collection = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
-                DB_ResidenceData.residenceData.SaveResidenceData();
+                btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
+                function.CollectFunction();
             };
         }
 
         /// <summary>
-        /// 鍔犺浇寮�鍏充簨浠�
+        /// 鍔犺浇鎺у埗浜嬩欢
         /// </summary>
-        void LoadSwitchEvent()
+        void LoadControlEvent()
         {
-            btnSwitchIcon.MouseUpEventHandler += (sender, e) =>
+            btnChangeTVAV.MouseUpEventHandler = (sender, e) =>
             {
-                btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected;
-
-                new System.Threading.Thread(() =>
+                if (DB_ResidenceData.Instance.GatewayType == 1)
                 {
-                    tv.on_off = btnSwitch.IsSelected ? "on" : "off";
-                    Control.Send(CommandType_A.write, this.tv);
-                })
-                { IsBackground = true }.Start();
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("av_tv", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.AV_TV, function);
+                }
             };
-            btnSwitch.MouseUpEventHandler += (sender, e) =>
+            btnChlPlus.MouseUpEventHandler = (sender, e) =>
             {
-                btnSwitch.IsSelected = !btnSwitch.IsSelected;
-
-                new System.Threading.Thread(() =>
+                if (DB_ResidenceData.Instance.GatewayType == 1)
                 {
-                    tv.on_off = btnSwitch.IsSelected ? "on" : "off";
-                    Control.Send(CommandType_A.write, this.tv);
-                })
-                { IsBackground = true }.Start();
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("ch+", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.ChannelUp, function);
+                }
+            };
+            btnChlReduce.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("ch-", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.ChannelDown, function);
+                }
+            };
+            btnVolPlus.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("volume+", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.VolUp, function);
+                }
+            };
+            btnVolReduce.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("volume-", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.VolDown, function);
+                }
+            };
+            btnBack.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("return", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Back, function);
+                }
             };
 
+            btnMenu.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("menu", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Menu, function);
+                }
+            };
+            btn123.MouseUpEventHandler = (sender, e) =>
+            {
+                ShowNumberView();
+            };
+            btnMute.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("mute", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Mute, function);
+                }
+            };
+            btnPower.MouseUpEventHandler = (sender, e) =>
+            {
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("on_off", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Power, function);
+                }
+            };
+
+            btnTopMenuUp.MouseDownEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIconUp.png";
+            };
+            btnTopMenuDown.MouseDownEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIconDown.png";
+            };
+            btnTopMenuLeft.MouseDownEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIconLeft.png";
+            };
+            btnTopMenuRight.MouseDownEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIconRight.png";
+            };
+            btnOk.MouseDownEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIconOk.png";
+            };
+
+            btnTopMenuUp.MouseUpEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIcon.png";
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("up", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Up, function);
+                }
+            };
+            btnTopMenuLeft.MouseUpEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIcon.png";
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("left", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Left, function);
+                }
+            };
+            btnTopMenuRight.MouseUpEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIcon.png";
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("right", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Right, function);
+                }
+            };
+            btnTopMenuDown.MouseUpEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIcon.png";
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("down", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Down, function);
+                }
+            };
+            btnOk.MouseUpEventHandler = (sender, e) => {
+                topMenuView.BackgroundImagePath = "FunctionIcon/Electrical/TV/TVOkIcon.png";
+                if (DB_ResidenceData.Instance.GatewayType == 1)
+                {
+                    Dictionary<string, string> d = new Dictionary<string, string>();
+                    d.Add("ok", "");
+                    Control.Ins.SendWriteCommand(function, d);
+                }
+                else
+                {
+                    tvTemp.ControlTV(InfraredCode_TV.Confrim, function);
+                }
+            };
         }
 
     }

--
Gitblit v1.8.0