From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 九月 2019 13:22:40 +0800
Subject: [PATCH] 合并了徐梅的按键面板绑定

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs |  354 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 177 insertions(+), 177 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
old mode 100644
new mode 100755
index c6287f7..b80edea
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -102,59 +102,59 @@
         /// <param name="common">Common.</param>
         /// <param name="typeTag">Type tag.</param>
         public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
+        {
             //璁惧涓婃姤鐘舵�佷腑 褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
-            if (typeTag == "DeviceStatusReport")
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    try
-                    {
-                        for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
-                        {
-                            var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
-                            var rowLayout = rowFL.GetChildren(0) as RowLayout;
-                            var deviceUI = rowLayout.Tag as DeviceUI;
-                            if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0)
-                            {
-                                //璁惧涓虹┖鎴栬�呮帶浠朵负绌�
-                                continue;
-                            }
-
-                            if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
-                            {
-                                //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
-                                continue;
-                            }
-                            var frameLayout = rowLayout.GetChildren(0) as FrameLayout;
-                            switch (deviceUI.CommonDevice.Type)
-                            {
-                                case DeviceType.OnOffOutput:
-                                    //寮�鍏冲姛鑳�
-                                    if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 6)
-                                    {
-                                        var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
-                                        onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport;
-                                        for (int j = 0; j < frameLayout.ChildrenCount; j++)
-                                        {
-                                            var tempView = frameLayout.GetChildren(j);
-                                            if (tempView.Tag == null)
-                                            {
-                                                continue;
-                                            }
-                                            if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
-                                            {
+            if (typeTag == "DeviceStatusReport")
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    try
+                    {
+                        for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
+                        {
+                            var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
+                            var rowLayout = rowFL.GetChildren(0) as RowLayout;
+                            var deviceUI = rowLayout.Tag as DeviceUI;
+                            if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0)
+                            {
+                                //璁惧涓虹┖鎴栬�呮帶浠朵负绌�
+                                continue;
+                            }
+
+                            if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
+                            {
+                                //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
+                                continue;
+                            }
+                            var frameLayout = rowLayout.GetChildren(0) as FrameLayout;
+                            switch (deviceUI.CommonDevice.Type)
+                            {
+                                case DeviceType.OnOffOutput:
+                                    //寮�鍏冲姛鑳�
+                                    if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 6)
+                                    {
+                                        var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight;
+                                        onOffOutputLight.DeviceStatusReport = (common as ZigBee.Device.ToggleLight).DeviceStatusReport;
+                                        for (int j = 0; j < frameLayout.ChildrenCount; j++)
+                                        {
+                                            var tempView = frameLayout.GetChildren(j);
+                                            if (tempView.Tag == null)
+                                            {
+                                                continue;
+                                            }
+                                            if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
+                                            {
                                                 //璁板綍銆佹洿鏂扮姸鎬�
                                                 if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0)
                                                 {
                                                     continue;
                                                 }
                                                 onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData;
-                                                (tempView as Button).IsSelected = onOffOutputLight.OnOffStatus == 1;
+                                                (tempView as Button).IsSelected = onOffOutputLight.OnOffStatus == 1;
                                                 //璁板綍鍥炲鏃堕棿
                                                 onOffOutputLight.LastDateTime = DateTime.Now;
-                                            }
-                                        }
+                                            }
+                                        }
                                     }
                                     //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
                                     if ((common as ZigBee.Device.ToggleLight).DeviceStatusReport.CluterID == 3)
@@ -177,34 +177,34 @@
                                         }
 
                                     }
-                                    break;
+                                    break;
 
-                                case DeviceType.AirSwitch:
-                                    //寮�鍏冲姛鑳�
-                                    if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6)
-                                    {
-                                        var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
-                                        airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport;
-                                        for (int j = 0; j < frameLayout.ChildrenCount; j++)
-                                        {
-                                            var tempView = frameLayout.GetChildren(j);
-                                            if (tempView.Tag == null)
-                                            {
-                                                continue;
-                                            }
-                                            if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
-                                            {
+                                case DeviceType.AirSwitch:
+                                    //寮�鍏冲姛鑳�
+                                    if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6)
+                                    {
+                                        var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
+                                        airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport;
+                                        for (int j = 0; j < frameLayout.ChildrenCount; j++)
+                                        {
+                                            var tempView = frameLayout.GetChildren(j);
+                                            if (tempView.Tag == null)
+                                            {
+                                                continue;
+                                            }
+                                            if (tempView.Tag.ToString() == deviceStatus_OnOffStatus)
+                                            {
                                                 //璁板綍銆佹洿鏂扮姸鎬�
                                                 if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0)
                                                 {
                                                     return;
                                                 }
                                                 airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData;
-                                                (tempView as Button).IsSelected = airSwitch.OnOffStatus == 1;
+                                                (tempView as Button).IsSelected = airSwitch.OnOffStatus == 1;
                                                 //璁板綍鍥炲鏃堕棿
                                                 airSwitch.LastDateTime = DateTime.Now;
-                                            }
-                                        }
+                                            }
+                                        }
                                     }
                                     //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁�
                                     if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 3)
@@ -226,12 +226,12 @@
                                             }
                                         }
                                     }
-                                    break;
+                                    break;
 
-                                case DeviceType.WindowCoveringDevice:
+                                case DeviceType.WindowCoveringDevice:
                                     if ((common as ZigBee.Device.Rollershade).DeviceStatusReport.CluterID == 3)
                                     {
-                                        var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
+                                        var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
                                         rollershade.IsOnline = 1;
                                         for (int j = 0; j < frameLayout.ChildrenCount; j++)
                                         {
@@ -248,7 +248,7 @@
                                             }
                                         }
                                     }
-                                    break;
+                                    break;
 
                                 case DeviceType.Thermostat:
                                     //AC鍔熻兘
@@ -425,94 +425,94 @@
                                     }
                                     break;
 
-                            }
-                        }
-                    }
-                    catch (Exception ex)
-                    {
-                        System.Console.WriteLine($"Error:{ex.Message}");
-                    }
-                });
-            }
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        System.Console.WriteLine($"Error:{ex.Message}");
+                    }
+                });
+            }
             //璁惧鍦ㄧ嚎鐘舵�佷笂鎶�
-            else if (typeTag == "OnlineStatusChange")
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    try
-                    {
-                        for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
-                        {
-                            var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
-                            var rowLayout = rowFL.GetChildren(0) as RowLayout;
-                            var deviceUI = rowLayout.Tag as DeviceUI;
-                            if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0)
-                            {
-                                //璁惧涓虹┖鎴栬�呮帶浠朵负绌�
-                                continue;
-                            }
-                            if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
-                            {
-                                //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
-                                continue;
-                            }
-                            var frameLayout = rowLayout.GetChildren(0) as FrameLayout;
-                            switch (deviceUI.CommonDevice.Type)
-                            {
-                                case DeviceType.OnOffOutput:
-                                    var onOffOutputLight = deviceUI.CommonDevice as ToggleLight;
-                                    onOffOutputLight.IsOnline = (common as ToggleLight).IsOnline;
-                                    for (int j = 0; j < frameLayout.ChildrenCount; j++)
-                                    {
-                                        var tempView = frameLayout.GetChildren(j);
-                                        if (tempView.Tag == null)
-                                        {
-                                            continue;
-                                        }
-                                        if (tempView.Tag.ToString() == deviceStatus_Online)
-                                        {
-                                            (tempView as Button).IsSelected = onOffOutputLight.IsOnline == 1;
-                                        }
-                                    }
-                                    //璁板綍鍥炲鏃堕棿
-                                    onOffOutputLight.LastDateTime = DateTime.Now;
-                                    break;
-                                case DeviceType.AirSwitch:
-                                    var airSwitch = deviceUI.CommonDevice as AirSwitch;
-                                    airSwitch.IsOnline = (common as AirSwitch).IsOnline;
-                                    for (int j = 0; j < frameLayout.ChildrenCount; j++)
-                                    {
-                                        var tempView = frameLayout.GetChildren(j);
-                                        if (tempView.Tag == null)
-                                        {
-                                            continue;
-                                        }
-                                        if (tempView.Tag.ToString() == deviceStatus_Online)
-                                        {
-                                            (tempView as Button).IsSelected = airSwitch.IsOnline == 1;
-                                        }
-                                    }
-                                    //璁板綍鍥炲鏃堕棿
-                                    airSwitch.LastDateTime = DateTime.Now;
-                                    break;
-                                case DeviceType.WindowCoveringDevice:
-                                    var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
-                                    rollershade.IsOnline = (common as Rollershade).IsOnline;
-                                    for (int j = 0; j < frameLayout.ChildrenCount; j++)
-                                    {
-                                        var tempView = frameLayout.GetChildren(j);
-                                        if (tempView.Tag == null)
-                                        {
-                                            continue;
-                                        }
-                                        if (tempView.Tag.ToString() == deviceStatus_Online)
-                                        {
-                                            (tempView as Button).IsSelected = rollershade.IsOnline == 1;
-                                        }
-                                    }
-                                    //璁板綍鍥炲鏃堕棿
-                                    rollershade.LastDateTime = DateTime.Now;
-                                    break;
+            else if (typeTag == "OnlineStatusChange")
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    try
+                    {
+                        for (int i = 0; deviceVerticalScrolViewLayout != null && i < deviceVerticalScrolViewLayout.ChildrenCount; i++)
+                        {
+                            var rowFL = deviceVerticalScrolViewLayout.GetChildren(i) as FrameLayout;
+                            var rowLayout = rowFL.GetChildren(0) as RowLayout;
+                            var deviceUI = rowLayout.Tag as DeviceUI;
+                            if (deviceUI.CommonDevice == null || rowLayout.ChildrenCount == 0)
+                            {
+                                //璁惧涓虹┖鎴栬�呮帶浠朵负绌�
+                                continue;
+                            }
+                            if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint)
+                            {
+                                //鍒ゆ柇鏄惁涓哄綋鍓嶈澶�
+                                continue;
+                            }
+                            var frameLayout = rowLayout.GetChildren(0) as FrameLayout;
+                            switch (deviceUI.CommonDevice.Type)
+                            {
+                                case DeviceType.OnOffOutput:
+                                    var onOffOutputLight = deviceUI.CommonDevice as ToggleLight;
+                                    onOffOutputLight.IsOnline = (common as ToggleLight).IsOnline;
+                                    for (int j = 0; j < frameLayout.ChildrenCount; j++)
+                                    {
+                                        var tempView = frameLayout.GetChildren(j);
+                                        if (tempView.Tag == null)
+                                        {
+                                            continue;
+                                        }
+                                        if (tempView.Tag.ToString() == deviceStatus_Online)
+                                        {
+                                            (tempView as Button).IsSelected = onOffOutputLight.IsOnline == 1;
+                                        }
+                                    }
+                                    //璁板綍鍥炲鏃堕棿
+                                    onOffOutputLight.LastDateTime = DateTime.Now;
+                                    break;
+                                case DeviceType.AirSwitch:
+                                    var airSwitch = deviceUI.CommonDevice as AirSwitch;
+                                    airSwitch.IsOnline = (common as AirSwitch).IsOnline;
+                                    for (int j = 0; j < frameLayout.ChildrenCount; j++)
+                                    {
+                                        var tempView = frameLayout.GetChildren(j);
+                                        if (tempView.Tag == null)
+                                        {
+                                            continue;
+                                        }
+                                        if (tempView.Tag.ToString() == deviceStatus_Online)
+                                        {
+                                            (tempView as Button).IsSelected = airSwitch.IsOnline == 1;
+                                        }
+                                    }
+                                    //璁板綍鍥炲鏃堕棿
+                                    airSwitch.LastDateTime = DateTime.Now;
+                                    break;
+                                case DeviceType.WindowCoveringDevice:
+                                    var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade;
+                                    rollershade.IsOnline = (common as Rollershade).IsOnline;
+                                    for (int j = 0; j < frameLayout.ChildrenCount; j++)
+                                    {
+                                        var tempView = frameLayout.GetChildren(j);
+                                        if (tempView.Tag == null)
+                                        {
+                                            continue;
+                                        }
+                                        if (tempView.Tag.ToString() == deviceStatus_Online)
+                                        {
+                                            (tempView as Button).IsSelected = rollershade.IsOnline == 1;
+                                        }
+                                    }
+                                    //璁板綍鍥炲鏃堕棿
+                                    rollershade.LastDateTime = DateTime.Now;
+                                    break;
                                 case DeviceType.Thermostat:
                                     var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                     ac.IsOnline = (common as ZigBee.Device.AC).IsOnline;
@@ -549,14 +549,14 @@
                                     //璁板綍鍥炲鏃堕棿
                                     dimmableLight.LastDateTime = DateTime.Now;
                                     break;
-                            }
-                        }
-                    }
-                    catch (Exception ex)
-                    {
-                        System.Console.WriteLine($"涓婚〉鍔熻兘鍒锋柊-Error:{ex.Message}");
-                    }
-                });
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        System.Console.WriteLine($"涓婚〉鍔熻兘鍒锋柊-Error:{ex.Message}");
+                    }
+                });
             }
         }
         /// <summary>
@@ -1053,7 +1053,7 @@
         /// <returns><c>true</c>, if bind gateway was haded, <c>false</c> otherwise.</returns>
         private bool HadBindGateway()
         {
-            var gatewayList = Common.LocalGateway.Current.GetAllLocalGateway();
+            var gatewayList = UserCenter.HdlGatewayLogic.Current.GetAllLocalGateway();
             if (gatewayList.Count == 0)
             {
                 return false;
@@ -1095,8 +1095,8 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void GoToAddGateWay(object sender, MouseEventArgs mouseEventArgs)
         {
-            UserCenter.Gateway.SelectNewGateWayForm selectNewGateWayForm = new UserCenter.Gateway.SelectNewGateWayForm { };
-            selectNewGateWayForm.AddForm(selectNewGateWayForm);
+            var selectNewGateWayForm = new UserCenter.GatewayAdd.NewGateWaySelectForm();
+            selectNewGateWayForm.AddForm();
         }
 
         #endregion
@@ -1471,9 +1471,9 @@
                             //寮�鍏崇伅
                             var light = device.CommonDevice as ToggleLight;
                             //琛ヤ笂闈炶繙绋�
-                            if (light.Gateway == null)
-                            {
-                                continue;
+                            if (light.Gateway == null)
+                            {
+                                continue;
                             }
                             if (light.Gateway.IsVirtual)
                             {
@@ -2666,20 +2666,20 @@
         private void ChangeResidence(House home)
         {
             try
-            {
+            {
                 CommonPage.Loading.Start();
-                new System.Threading.Thread(async () =>
+                new System.Threading.Thread(async () =>
                  {
                      Config.Instance.HomeId = home.Id;
                      Global.CreateHomeDirectory(home.Id);
-                     Config.Instance.Save();
-                     //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
+                     Config.Instance.Save();
+                     //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
                      await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
 
                      Room.InitAllRoom();
 
                      Application.RunOnMainThread(() =>
-                     {
+                     {
                          Show();
                          CommonPage.Loading.Hide();
                      });
@@ -2687,12 +2687,12 @@
                 { IsBackground = true }.Start();
             }
             catch (Exception ex)
-            {
+            {
                 Application.RunOnMainThread(() =>
-                {
+                {
                     CommonPage.Loading.Hide();
-                    new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.CheckInternet), Language.StringByID(R.MyInternationalizationString.Close)).Show();
-                    Console.WriteLine(ex.Message);
+                    //new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.CheckInternet), Language.StringByID(R.MyInternationalizationString.Close)).Show();
+                    Console.WriteLine(ex.Message);
                 });
             }
         }

--
Gitblit v1.8.0