From 1c4904d77f484c075080942d87785481b52b6fb2 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 28 十月 2019 14:58:46 +0800
Subject: [PATCH] Revert "Merge branch 'dev-tzy' into DEV_GXC"

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs |  261 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 261 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs
new file mode 100755
index 0000000..6a3ddb9
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorBindTargetForm.cs
@@ -0,0 +1,261 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter.DevicePirSensor
+{
+    /// <summary>
+    /// PIR浼犳劅鍣ㄧ粦瀹氱晫闈⑩槄
+    /// </summary>
+    public class PirSensorBindTargetForm : EditorCommonForm
+    {
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalScrolViewLayout listView = null;
+        /// <summary>
+        /// 缂栬緫鎸夐挳
+        /// </summary>
+        private BottomClickButton btnEditor = null;
+        /// <summary>
+        /// 浼犳劅鍣ㄨ澶�
+        /// </summary>
+        private IASZone deviceIASZone = null;
+        /// <summary>
+        /// 宸茬粡瀛樺湪鐨勭粦瀹氳澶�
+        /// </summary>
+        private Dictionary<string, CommonDevice> dicEsixtDevice = new Dictionary<string, CommonDevice>();
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_iasZone">浼犳劅鍣ㄨ澶�</param>
+        public void ShowForm(IASZone i_iasZone)
+        {
+            deviceIASZone = i_iasZone;
+
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBindTargetsSettion));
+
+            ////鍙充笂娣诲姞鎸夐挳
+            //var btnAddDeviceIcon = new MostRightIconControl(69, 69);
+            //btnAddDeviceIcon.UnSelectedImagePath = "Item/Add.png";
+            //btnAddDeviceIcon.SelectedImagePath = "Item/AddSelected.png";
+            //topFrameLayout.AddChidren(btnAddDeviceIcon);
+            //btnAddDeviceIcon.MouseUpEventHandler += (sender, e) =>
+            //{
+            //    //鏄剧ず璁惧閫夋嫨鐨勭晫闈�
+            //    this.ShowDeviceSelectForm();
+            //};
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            //this.InitMiddleFrame();
+        }
+
+        ///// <summary>
+        ///// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        ///// </summary>
+        //private void InitMiddleFrame()
+        //{
+        //    //娓呯┖bodyFrame
+        //    this.ClearBodyFrame();
+
+        //    this.listView = new VerticalScrolViewLayout();
+        //    this.listView.Height = bodyFrameLayout.Height;
+        //    bodyFrameLayout.AddChidren(this.listView);
+
+        //    this.dicEsixtDevice.Clear();
+
+        //    //寮�鍚繘搴︽潯
+        //    this.ShowProgressBar();
+
+        //    HdlThreadLogic.Current.Run(async () =>
+        //    {
+        //        List<CommonDevice> listDevice = await HdlDeviceBindLogic.Current.GetBindTargetDevice(this.deviceIASZone);
+        //        if (listDevice == null)
+        //        {
+        //            //鍏抽棴杩涘害鏉�
+        //            this.CloseProgressBar(ShowReLoadMode.YES);
+        //            return;
+        //        }
+        //        foreach(CommonDevice device in listDevice)
+        //        {
+        //            Application.RunOnMainThread(() =>
+        //            {
+        //                if (this.Parent != null)
+        //                {
+        //                    this.AddRowlayout(device);
+        //                }
+        //            });
+        //        }
+        //        //鍏抽棴杩涘害鏉�
+        //        this.CloseProgressBar();
+        //    });
+        //}
+
+        ///// <summary>
+        ///// 娣诲姞琛�
+        ///// </summary>
+        ///// <param name="device"></param>
+        //private void AddRowlayout(CommonDevice device)
+        //{
+        //    //鍒濆鍖栫紪杈戞寜閽�
+        //    this.InitEditorButton();
+
+        //    string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+        //    this.dicEsixtDevice[mainKeys] = device;
+
+        //    var row = new DeviceRoomViewRow(this.listView, device);
+        //    row.ChangedChidrenBindMode(row.btnIcon, ChidrenBindMode.BindEventOnly);
+        //    row.ChangedChidrenBindMode(row.btnRoom, ChidrenBindMode.BindEventOnly);
+        //    row.ChangedChidrenBindMode(row.btnDevie, ChidrenBindMode.BindEventOnly);
+
+        //    //鍒犻櫎
+        //    var btnDelete = new RowDeleteButton();
+        //    row.AddRightView(btnDelete);
+        //    btnDelete.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        //纭瑕佸垹闄ゅ悧锛�
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uShowDoDeleteMsg);
+        //        this.ShowConfirmMsg(msg, "DeleteTargetDevice", device, row);
+        //    };
+        //}
+
+        ///// <summary>
+        ///// 鍒犻櫎缁戝畾鐩爣
+        ///// </summary>
+        ///// <param name="device"></param>
+        ///// <param name="row"></param>
+        //public async void DeleteTargetDevice(CommonDevice device, DeviceRoomViewRow row)
+        //{
+        //    //寮�鍚繘搴︽潯
+        //    this.ShowProgressBar();
+        //    bool result = await HdlDeviceBindLogic.Current.DeleteDeviceTarget(this.deviceIASZone, device);
+        //    //鍏抽棴杩涘害鏉�
+        //    this.CloseProgressBar();
+
+        //    if (result == false)
+        //    {
+        //        return;
+        //    }
+        //    Application.RunOnMainThread(() =>
+        //    {
+        //        string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+        //        this.dicEsixtDevice.Remove(mainKeys);
+
+        //        row?.RemoveFromParent();
+        //        if (listView != null && listView.ChildrenCount == 0)
+        //        {
+        //            this.btnEditor?.RemoveFromParent();
+        //            this.btnEditor = null;
+        //        }
+        //    });
+        //}
+
+        ///// <summary>
+        ///// 鏄剧ず璁惧閫夋嫨鐨勭晫闈�
+        ///// </summary>
+        //private void ShowDeviceSelectForm()
+        //{
+        //    var listShowDevice = new List<CommonDevice>();
+        //    var listTempDevice = Common.LocalDevice.Current.listAllDevice;
+        //    foreach (var device in listTempDevice)
+        //    {
+        //        //濡傛灉鏄紶鎰熷櫒锛屾垨鑰呮槸娌℃湁寮�鍏崇皣鐨勮瘽(杩欓噷鍒ゆ柇鐨勬槸杈撳叆绨�)
+        //        if ((device is IASZone) || Common.LocalDevice.Current.InDeviceIsCanOnOff(device) == false)
+        //        {
+        //            continue;
+        //        }
+        //        string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+        //        if (this.dicEsixtDevice.ContainsKey(mainKeys) == true)
+        //        {
+        //            //濡傛灉宸茬粡娣诲姞浜嗭紝鍒欎笉鍐嶆樉绀�
+        //            continue;
+        //        }
+
+        //        listShowDevice.Add(device);
+        //    }
+        //    var listSelect = new List<string>();
+        //    foreach (string mainkeys in this.dicEsixtDevice.Keys)
+        //    {
+        //        listSelect.Add(mainkeys);
+        //    }
+
+        //    var form = new SelectDeviceForm();
+        //    form.AddForm(listShowDevice, listSelect, false);
+        //    //娣诲姞缁戝畾鐩爣
+        //    form.SetTitleText(Language.StringByID(R.MyInternationalizationString.AddBindTargets));
+
+        //    //璁惧閫夋嫨纭畾
+        //    form.ActionSelectDevice += (async (listDevice) =>
+        //    {
+        //        if (listDevice.Count == 0)
+        //        {
+        //            return;
+        //        }
+        //        //寮�鍚繘搴︽潯
+        //        this.ShowProgressBar();
+        //        var listNewDevice = await HdlDeviceBindLogic.Current.BindDeviceTarget(this.deviceIASZone, listDevice);
+        //        //鍏抽棴杩涘害鏉�
+        //        this.CloseProgressBar();
+
+        //        if (listNewDevice == null || listNewDevice.Count == 0)
+        //        {
+        //            return;
+        //        }
+
+        //        foreach (CommonDevice device in listNewDevice)
+        //        {
+        //            string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+        //            this.dicEsixtDevice[mainKeys] = device;
+
+        //            Application.RunOnMainThread(() =>
+        //            {
+        //                if (this.listView != null)
+        //                {
+        //                    this.AddRowlayout(device);
+        //                }
+        //            });
+        //        }
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            //鎵撳紑PIR浼犳劅鍣ㄧ殑鐏厜鐗规晥閰嶇疆鐣岄潰
+        //            var newform = new PirSensorLightSettionForm();
+        //            newform.AddForm(this.deviceIASZone);
+        //        });
+        //    });
+        //}
+
+        ///// <summary>
+        ///// 鍒濆鍖栫紪杈戞寜閽�
+        ///// </summary>
+        //private void InitEditorButton()
+        //{
+        //    if (this.btnEditor != null)
+        //    {
+        //        return;
+        //    }
+
+        //    Application.RunOnMainThread(() =>
+        //    {
+        //        if (this.listView == null)
+        //        {
+        //            return;
+        //        }
+        //        //缂栬緫
+        //        this.btnEditor = new BottomClickButton();
+        //        this.btnEditor.MouseUpTime = 0;
+        //        this.btnEditor.TextID = R.MyInternationalizationString.uEditor;
+        //        bodyFrameLayout.AddChidren(this.btnEditor);
+        //        this.btnEditor.MouseUpEvent += (sender, e) =>
+        //        {
+        //            var form = new PirSensorLightSettionForm();
+        //            form.AddForm(deviceIASZone);
+        //        };
+
+        //        this.listView.Height = this.btnEditor.Y - ControlCommonResourse.BottomButtonAndListViewSpace;
+        //    });
+        //}
+    }
+}

--
Gitblit v1.8.0