From 98ceb6bd2021f9ff136cda27eef28676dd7b5d92 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 21 五月 2020 13:24:02 +0800
Subject: [PATCH] 最后的版本

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs |  120 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs
index 8230911..730ce66 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/ChooseKeyModePage.cs
@@ -5,19 +5,8 @@
 using static ZigBee.Device.BindObj;
 namespace Shared.Phone.UserCenter.DeviceBind
 {
-    public class ChooseKeyModePage : BindCommonLayout, ZigBee.Common.IStatus
+    public class ChooseKeyModePage : BindCommonLayout
     {
-        /// <summary>
-        /// 鎸夐敭妯″紡鎺ユ敹
-        /// </summary>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
-            Shared.Application.RunOnMainThread(() =>
-            {
-            });
-        }
-
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
@@ -138,7 +127,7 @@
                     //1銆佹竻绌烘墍鏈夌洰鏍�
                     if (currentKey.bindList != null)
                     {
-                        var bindResult = await currentKey.ClearBindInfoAsync();
+                        var bindResult = HdlDeviceBindLogic.Current.ClearBindInfoAsync(currentKey);
                         if (bindResult != null && bindResult.clearBindInfoResponseData != null)
                         {
                             if (bindResult.clearBindInfoResponseData.Result != 0)
@@ -175,43 +164,43 @@
                     switch (currentModeID)
                     {
                         case 100:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.OnOff_On);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.OnOff_On);
                             break;
                         case 101:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.OnOff_oFF);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.OnOff_oFF);
                             break;
                         case 102:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.OnOff_OnOff);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.OnOff_OnOff);
                             break;
                         case 200:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Step_Up);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Step_Up);
                             break;
                         case 201:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Step_Down);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Step_Down);
                             break;
                         case 203:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Up);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Up);
                             break;
                         case 204:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Down);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Down);
                             break;
                         case 205:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Level_Up_Down);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Level_Up_Down);
                             break;
                         case 300:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Up);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Up);
                             break;
                         case 301:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Down);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Down);
                             break;
                         case 302:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Stop);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Stop);
                             break;
                         case 303:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Up_Stop);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Up_Stop);
                             break;
                         case 304:
-                            temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Wcd_Down_Stop);
+                            temp = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(currentKey, Panel.KeyMode.Wcd_Down_Stop);
                             break;
                     }
                     if (temp != null && temp.setWritableValueResponData != null)
@@ -254,19 +243,8 @@
                             }
 
                             var dev = new AddedDeviceBindResponseAllData();
-                            dev = await currentKey.AddDeviceBindAsync(addBindeDev);
-                            if (dev.addedDeviceBindResponseData == null)
-                            {
-                                Application.RunOnMainThread(() =>
-                                {
-                                    CommonPage.Loading.Hide();
-                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
-                                });
-                                btnFinifh.Enable = true;
-                                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                                return;
-                            }
-                            else
+                            dev = HdlDeviceBindLogic.Current.AddDeviceBindAsync(addBindeDev);
+                            if (dev != null && dev.addedDeviceBindResponseData != null)
                             {
                                 if (dev.addedDeviceBindResponseData.Result == 0)
                                 {
@@ -328,6 +306,17 @@
                                     btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                                     return;
                                 }
+                            }
+                            else
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    CommonPage.Loading.Hide();
+                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh);
+                                });
+                                btnFinifh.Enable = true;
+                                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                                return;
                             }
                         }
                         else
@@ -421,6 +410,13 @@
         {
             return System.Threading.Tasks.Task.Run(async () =>
              {
+                 //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+                 if (Common.Config.Instance.Home.IsVirtually == true)
+                 {
+                     typeDetailModeList.Clear();
+                     return new List<int>() { 100, 101, 102 };
+                 }
+
                  Application.RunOnMainThread(() =>
                  {
                      CommonPage.Loading.Start();
@@ -477,6 +473,13 @@
         {
             return System.Threading.Tasks.Task.Run(async () =>
             {
+                //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    typeDetailModeList.Clear();
+                    return new List<int>() { 200, 201, 203, 204, 205 };
+                }
+
                 Application.RunOnMainThread(() =>
                 {
                     CommonPage.Loading.Start();
@@ -548,6 +551,17 @@
             return System.Threading.Tasks.Task.Run(async () =>
             {
                 typeDetailModeList.Clear();
+                //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        CommonPage.Loading.Hide();
+                    });
+                    typeDetailModeList.Clear();
+                    return new List<int>() { 300, 301, 302, 303, 304 };
+                }
+
                 List<int> result3 = new List<int> { };
                 try
                 {
@@ -645,8 +659,8 @@
 
                 var btnChoose = new Button()
                 {
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetMinReal(60),
+                    Height = Application.GetMinReal(60),
                     X = Application.GetRealWidth(861 + 81),
                     Y = Application.GetRealHeight(35),
                     SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -723,7 +737,6 @@
                          oldMode = btnChoose;
                          oldMode.IsSelected = true;
                          oldMode.Visible = true;
-                         currentKey.CurrentSwitchMode = btnModeText.Text;
                          if (btnModeText.Text == Language.StringByID(R.MyInternationalizationString.OnOffOn))
                          {
                              currentModeID = 100;
@@ -804,8 +817,8 @@
 
                 var btnChoose = new Button()
                 {
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetMinReal(60),
+                    Height = Application.GetMinReal(60),
                     X = Application.GetRealWidth(861 + 81),
                     Y = Application.GetRealHeight(35),
                     SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -899,7 +912,6 @@
                         oldMode = btnChoose;
                         oldMode.IsSelected = true;
                         oldMode.Visible = true;
-                        currentKey.CurrentSwitchMode = btnModeText.Text;
                         if (btnModeText.Text == Language.StringByID(R.MyInternationalizationString.DimmerMode1))
                         {
                             currentModeID = 200;
@@ -978,8 +990,8 @@
 
                 var btnChoose = new Button()
                 {
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetMinReal(60),
+                    Height = Application.GetMinReal(60),
                     X = Application.GetRealWidth(861 + 81),
                     Y = Application.GetRealHeight(35),
                     SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -1073,7 +1085,6 @@
                         oldMode = btnChoose;
                         oldMode.IsSelected = true;
                         oldMode.Visible = true;
-                        currentKey.CurrentSwitchMode = btnModeText.Text;
                         if (btnModeText.Text == Language.StringByID(R.MyInternationalizationString.WcdUp))
                         {
                             currentModeID = 300;
@@ -1106,19 +1117,6 @@
                 btnChoose.MouseUpEventHandler += hander;
                 i++;
             }
-        }
-
-
-        public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
-        }
-
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-        }
-
-        public void ChangedISceneStatus(Scene scene)
-        {
         }
     }
 }

--
Gitblit v1.8.0