From 2450c12c825ad4d78d1572da2fa421706db2df2f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 18 六月 2020 16:01:14 +0800
Subject: [PATCH] 新代码

---
 ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDeviceChange.cs |   79 ++++++++++++++++++++++++++-------------
 1 files changed, 52 insertions(+), 27 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDeviceChange.cs b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDeviceChange.cs
index e9168d3..f457039 100755
--- a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDeviceChange.cs
+++ b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundContentForDeviceChange.cs
@@ -30,7 +30,12 @@
         /// </summary>
         private FrameLayout TipLayout = null;
 
-        private List<string> TabList = new List<string>() { Language.StringByID(R.MyInternationalizationString.uLight), Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100) };
+        private List<string> TabList = new List<string>()
+        {
+            Language.StringByID(R.MyInternationalizationString.uLight),
+            Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100),
+            Language.StringByID(R.MyInternationalizationString.AC)
+        };
 
         private int CurrentSelectIndex = 0;
         private int imageWith = 683;
@@ -251,6 +256,23 @@
                             }
                         }
                         break;
+                    case 2: // 绌鸿皟
+                        {
+                            int n = 0;
+                            for (int i = 0; i < CurrentRoom.DeviceList.Count; i++)
+                            {
+                                SmartSound.Device device = CurrentRoom.DeviceList[i];
+                                //
+                                if (device.DeviceType == 7)
+                                {
+                                    var deviceRowLayout = new DeviceRowLayout(this, device, n);
+                                    DeviceListView.AddChidren(deviceRowLayout);
+                                    deviceRowLayout.InitControl();
+                                    n++;
+                                }
+                            }
+                        }
+                        break;
                 }
 
                 if (DeviceListView.ChildrenCount > 5)
@@ -285,9 +307,9 @@
             //鐢熸垚涓�涓脊绐楃敾闈�
             var dialogForm = new DialogInputControl();
             //缂栬緫浣忓畢
-            dialogForm.SetTitleText("鑷畾涔夊敜閱掕瘝");
+            dialogForm.SetTitleText("鑷畾涔夋樀绉�");
             //璇疯緭鍏ヤ綇瀹呭悕绉�
-            dialogForm.SetTipText("璇疯緭鍏ュ敜閱掕瘝");
+            dialogForm.SetTipText("璇疯緭鍏ユ樀绉�");
             dialogForm.Text = scene.NicksName;
 
             //鎸変笅纭鎸夐挳
@@ -316,9 +338,9 @@
             //鐢熸垚涓�涓脊绐楃敾闈�
             var dialogForm = new DialogInputControl();
             //缂栬緫浣忓畢
-            dialogForm.SetTitleText("鑷畾涔夊敜閱掕瘝");
+            dialogForm.SetTitleText("鑷畾涔夋樀绉�");
             //璇疯緭鍏ヤ綇瀹呭悕绉�
-            dialogForm.SetTipText("璇疯緭鍏ュ敜閱掕瘝");
+            dialogForm.SetTipText("璇疯緭鍏ユ樀绉�");
             dialogForm.Text = device.NicksName;
 
             //鎸変笅纭鎸夐挳
@@ -344,20 +366,22 @@
         /// </summary>
         private void ShowSceneDelectDialog(SmartSound.Scene scene)
         {
-            this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", async () =>
-            {
-                try
+            this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", () =>
+           {
+               HdlThreadLogic.Current.RunThread(async () =>
                 {
+                    this.ShowProgressBar();
                     CurrentRoom.SceneList.Remove(scene);
-                    LoadSceneView();
                     string json = await postBatchEdit();
-                }
-                catch (Exception e)
-                {
-                    string sss = e.Message;
-                }
 
-            }, Language.StringByID(R.MyInternationalizationString.OkMsg));
+                    HdlThreadLogic.Current.RunMainInThread(() =>
+                    {
+                        LoadSceneView();
+                        this.CloseProgressBar();
+                    });
+                });
+
+           }, Language.StringByID(R.MyInternationalizationString.OkMsg));
         }
 
         /// <summary>
@@ -365,20 +389,21 @@
         /// </summary>
         private void ShowDeviceDelectDialog(SmartSound.Device device)
         {
-            this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", async () =>
+            this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵",  () =>
              {
-                 try
-                 {
-                    //DeviceListView.RemoveAt(index);
-                    CurrentRoom.DeviceList.Remove(device);
-                     RefreshFunctionListView();
 
-                     string json = await postBatchEdit();
-                 }
-                 catch (Exception e)
+                 HdlThreadLogic.Current.RunThread(async () =>
                  {
-                     string sss = e.Message;
-                 }
+                     this.ShowProgressBar();
+                     CurrentRoom.DeviceList.Remove(device);
+                     string json = await postBatchEdit();
+
+                     HdlThreadLogic.Current.RunMainInThread(() =>
+                     {
+                         RefreshFunctionListView();
+                         this.CloseProgressBar();
+                     });
+                 });
 
              }, Language.StringByID(R.MyInternationalizationString.OkMsg));
         }
@@ -446,7 +471,7 @@
             // 鎻愪氦鏁版嵁鑷虫湇鍔″櫒
             string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit";
             string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate());
-            string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8);
+            string response_str = MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8);
             return response_str;
         }
 

--
Gitblit v1.8.0