From d5b9ff8bf8cc36f5b13c46b66682f5988d3a6f36 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 15 五月 2020 11:36:11 +0800
Subject: [PATCH] 2020-05-15-1
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs | 690 +++++++++++++++++++++++----------------------------------
1 files changed, 277 insertions(+), 413 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
index e17fcde..720426a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Shared.Common;
-using Shared.Phone.Device.Category;
using Shared.Phone.UserCenter.Device;
using ZigBee.Device;
using static ZigBee.Device.Panel;
@@ -15,6 +14,180 @@
/// 褰撳墠鎸夐敭閰嶇疆鐨勫姛鑳�
/// </summary>
public static int clusterID = 0;
+ /// <summary>
+ /// 璁板綍鏃х殑鐩爣鍒楄〃
+ /// </summary>
+ public static List<CommonDevice> oldTargetList = new List<CommonDevice>();
+
+ /// <summary>
+ /// 妫�娴嬭璁惧鑳藉惁鏄剧ず
+ /// </summary>
+ /// <param name="device"></param>
+ /// <returns></returns>
+ public static bool CheckCanShowDevice(ZigBee.Device.CommonDevice device, string curDeviceBindType = "AddSwitch")
+ {
+ if (device == null)
+ {
+ return false;
+ }
+ //濡傛灉鏄紶鎰熷櫒锛屾垨鑰呮槸娌℃湁寮�鍏崇皣鐨勮瘽(杩欓噷鍒ゆ柇鐨勬槸杈撳叆绨�)
+ if ((device.Type == ZigBee.Device.DeviceType.IASZone) || InMatchDevice(device, curDeviceBindType) == false)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// 妫�娴嬭鎴块棿鑳藉惁鏄剧ず
+ /// </summary>
+ /// <param name="room"></param>
+ /// <returns></returns>
+ public static bool CheckCanShowRoom(Common.Room room, string curDeviceBindType = "AddSwitch")
+ {
+ if (room.ListDevice.Count == 0)
+ {
+ return false;
+ }
+ if (room.IsLove == true)
+ {
+ return false;
+ }
+ foreach (var deviceKeys in room.ListDevice)
+ {
+ var device = Common.LocalDevice.Current.GetDevice(deviceKeys);
+ //妫�娴嬭璁惧鑳藉惁鏄剧ず
+ if (CheckCanShowDevice(device, curDeviceBindType) == false)
+ {
+ continue;
+ }
+
+ //瀛樺湪璁惧鐨勮瘽锛屾鎴块棿鍙互鏄剧ず
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 妫�娴嬭澶囨槸鍚︽嫢鏈夊紑鍏崇殑鍔熻兘(杈撳叆绨�)
+ /// </summary>
+ /// <param name="device"></param>
+ /// <returns></returns>
+ public static bool InMatchDevice(CommonDevice device, string curDeviceBindType = "AddSwitch")
+ {
+ foreach (var data in device.InClusterList)
+ {
+ switch (curDeviceBindType)
+ {
+ case "AddSwitch":
+ //鎷ユ湁on/off鍔熻兘鐨勶紝鎵嶆敮鎸佹祴璇�
+ if (data.InCluster == 6)
+ {
+ return true;
+ }
+ break;
+ case "AddDimmer":
+ if (data.InCluster == 8)
+ {
+ return true;
+ }
+ break;
+ case "AddCurtain":
+ if (data.InCluster == 258)
+ {
+ return true;
+ }
+ break;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 搴曢儴瀹屾垚鎸夐挳鏄剧ず
+ /// </summary>
+ /// <returns></returns>
+ public static void FinishDisplay(List<Room> roomTempList, Button btnFinish)
+ {
+ if (roomTempList.Count == 0)
+ {
+ btnFinish.Enable = false;
+ btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+ }
+ else
+ {
+ btnFinish.Enable = true;
+ btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠妤煎眰鍚嶇О
+ /// </summary>
+ /// <returns></returns>
+ public static string GetCurrentKeyAllRoomList()
+ {
+ var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+ foreach (var floorId in dicFloor.Keys)
+ {
+ //绗竴涓ゼ灞�
+ return dicFloor[floorId];
+ break;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠妤煎眰
+ /// </summary>
+ /// <returns></returns>
+ public static string GetCurrentSelectFloorId()
+ {
+ var dicFloor = HdlRoomLogic.Current.GetFloorSortList();//
+ foreach (var floorId in dicFloor.Keys)
+ {
+ //绗竴涓ゼ灞�
+ return floorId;
+ break;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠妤煎眰鍚嶇О
+ /// </summary>
+ /// <returns></returns>
+ public static string GetCurrentSelectFloorIdName()
+ {
+ var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+ foreach (var floorId in dicFloor.Keys)
+ {
+ //绗竴涓ゼ灞�
+ return dicFloor[floorId];
+ break;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// 鑾峰彇褰撳墠妤煎眰鍚嶇О
+ /// fllodID:妤煎眰ID
+ /// </summary>
+ /// <returns></returns>
+ public static string GetBindTargetsFloorIdName(string curFllodID)
+ {
+ var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+ foreach (var floorId in dicFloor.Keys)
+ {
+ //褰撳墠妤煎眰
+ if (curFllodID == floorId)
+ {
+ return dicFloor[floorId];
+ break;
+ }
+ }
+ return null;
+ }
/// <summary>
/// 妫�娴嬫帶鍒堕潰鏉�(鎸夐敭绫�)鎵�鎷ユ湁鐨勫姛鑳�,鐜版敮鎸佺殑鏈変互涓嬪嚑绉�(蹇呭畾瀛樺湪閿��,鍑洪敊浼氳繑鍥瀗ull)
@@ -28,8 +201,11 @@
dicCheck["寮�鍏�:寮�"] = false;
dicCheck["寮�鍏�:鍏�"] = false;
dicCheck["寮�鍏�:鍒囨崲"] = false;
- dicCheck["浜害:璋冨ぇ"] = false;
- dicCheck["浜害:璋冨皬"] = false;
+ dicCheck["浜害:鎸夌瓑绾ц皟澶�"] = false;
+ dicCheck["浜害:鎸夌瓑绾ц皟灏�"] = false;
+ dicCheck["浜害:鎸夌瓑绾у垏鎹�"] = false;
+ dicCheck["浜害:鎵撳紑"] = false;
+ dicCheck["浜害:鍏抽棴"] = false;
dicCheck["浜害:鍒囨崲"] = false;
dicCheck["绐楀笜:寮�"] = false;
dicCheck["绐楀笜:鍏�"] = false;
@@ -37,30 +213,60 @@
dicCheck["绐楀笜:涓婂崌鍋�"] = false;
dicCheck["绐楀笜:涓嬮檷鍋�"] = false;
+
+ List<int> result = null;
//鑾峰彇绗竴绾у姛鑳�
- var result = await key.GetPanelDeviceFunctionLevel1();
- if (result == null)
+ if (key.privateFuncFirstLevelList.Count == 0 || key.privateFuncFirstLevelList.Contains(256) == false)
{
- return null;
+ result = await key.GetPanelDeviceFunctionLevel1();
+ if (result == null)
+ {
+ return null;
+ }
+ key.privateFuncFirstLevelList = result;
+ //闈㈡澘娌℃湁鎸夐敭绫�
+ if (result.Contains(256) == false)
+ {
+ return dicCheck;
+ }
+ }
+ else
+ {
+ result = key.privateFuncFirstLevelList;
}
- //闈㈡澘娌℃湁鎸夐敭绫�
- if (result.Contains(256) == false)
+ if (key.privateFuncSecondLevelList.Count == 0 || key.privateFuncSecondLevelList.Contains(1) == false || key.privateFuncSecondLevelList.Contains(100) == false || key.privateFuncSecondLevelList.Contains(200) == false || key.privateFuncSecondLevelList.Contains(300) == false)
{
- return dicCheck;
+ //鑾峰彇绗簩绾у姛鑳�
+ result = await key.GetPanelDeviceFunctionLevel2(256);
+ if (result == null)
+ {
+ return null;
+ }
+ key.privateFuncSecondLevelList = result;
+ }
+ else
+ {
+ result = key.privateFuncSecondLevelList;
}
- //鑾峰彇绗簩绾у姛鑳�
- result = await key.GetPanelDeviceFunctionLevel2(256);
- if (result == null)
- {
- return null;
- }
//鐗规畩鍔熻兘
if (result.Contains(1) == true)
{
+ List<int> result3 = null;
//鑾峰彇绗笁绾у姛鑳�
- var result3 = await key.GetPanelDeviceFunctionLevel3(256, 1);
+ if (key.privateFuncThirdLevelList.Count == 0 || key.privateFuncThirdLevelList.Contains(1) == false)
+ {
+ result3 = await key.GetPanelDeviceFunctionLevel3(256, 1);
+ foreach (var l3 in result3)
+ {
+ key.privateFuncThirdLevelList.Add(l3);
+ }
+ }
+ else
+ {
+ result3 = key.privateFuncThirdLevelList;
+ }
if (result3 != null)
{
if (result3.Contains(1) == true)
@@ -72,8 +278,21 @@
//鎸夐敭寮�鍏崇被
if (result.Contains(100) == true)
{
+
+ List<int> result3 = null;
//鑾峰彇绗笁绾у姛鑳�
- var result3 = await key.GetPanelDeviceFunctionLevel3(256, 100);
+ if (key.privateFuncThirdLevelList.Count == 0 || key.privateFuncThirdLevelList.Contains(100) == false || key.privateFuncThirdLevelList.Contains(101) == false || key.privateFuncThirdLevelList.Contains(102) == false)
+ {
+ result3 = await key.GetPanelDeviceFunctionLevel3(256, 100);
+ foreach (var l3 in result3)
+ {
+ key.privateFuncThirdLevelList.Add(l3);
+ }
+ }
+ else
+ {
+ result3 = key.privateFuncThirdLevelList;
+ }
if (result3 != null)
{
if (result3.Contains(100) == true)
@@ -93,19 +312,43 @@
//鎸夐敭璋冨厜绫�
if (result.Contains(200) == true)
{
+ List<int> result3 = null;
//鑾峰彇绗笁绾у姛鑳�
- var result3 = await key.GetPanelDeviceFunctionLevel3(256, 200);
+ if (key.privateFuncThirdLevelList.Count == 0 || key.privateFuncThirdLevelList.Contains(200) == false || key.privateFuncThirdLevelList.Contains(201) == false || key.privateFuncThirdLevelList.Contains(202) == false)
+ {
+ result3 = await key.GetPanelDeviceFunctionLevel3(256, 200);
+ foreach (var l3 in result3)
+ {
+ key.privateFuncThirdLevelList.Add(l3);
+ }
+ }
+ else
+ {
+ result3 = key.privateFuncThirdLevelList;
+ }
if (result3 != null)
{
if (result3.Contains(200) == true)
{
- dicCheck["浜害:璋冨ぇ"] = true;
+ dicCheck["浜害:鎸夌瓑绾ц皟澶�"] = true;
}
if (result3.Contains(201) == true)
{
- dicCheck["浜害:璋冨皬"] = true;
+ dicCheck["浜害:鎸夌瓑绾ц皟灏�"] = true;
}
if (result3.Contains(202) == true)
+ {
+ dicCheck["浜害:鎸夌瓑绾у垏鎹�"] = true;
+ }
+ if (result3.Contains(203) == true)
+ {
+ dicCheck["浜害:鎵撳紑"] = true;
+ }
+ if (result3.Contains(204) == true)
+ {
+ dicCheck["浜害:鍏抽棴"] = true;
+ }
+ if (result3.Contains(205) == true)
{
dicCheck["浜害:鍒囨崲"] = true;
}
@@ -114,8 +357,21 @@
//绐楀笜绫�
if (result.Contains(300) == true)
{
+ List<int> result3 = null;
//鑾峰彇绗笁绾у姛鑳�
- var result3 = await key.GetPanelDeviceFunctionLevel3(256, 300);
+ if (key.privateFuncThirdLevelList.Count == 0 || (key.privateFuncThirdLevelList.Contains(300) == false && key.privateFuncThirdLevelList.Contains(301) == false && key.privateFuncThirdLevelList.Contains(302) == false && key.privateFuncThirdLevelList.Contains(303) == false && key.privateFuncThirdLevelList.Contains(304) == false))
+ {
+ result3 = await key.GetPanelDeviceFunctionLevel3(256, 300);
+ foreach (var l3 in result3)
+ {
+ key.privateFuncThirdLevelList.Add(l3);
+ }
+ }
+ else
+ {
+ result3 = key.privateFuncThirdLevelList;
+ }
+
if (result3 != null)
{
if (result3.Contains(300) == true)
@@ -140,399 +396,7 @@
}
}
}
-
return dicCheck;
}
-
- #region 绉佹湁鏁版嵁澶囦唤姝ラ(鏈夌敤浠g爜锛岃繖閲屽厛娉ㄩ噴鎺夛級
- // title.MouseLongEventHandler += async(sender, e) =>
- // {
- // string fileName = "Panel_";
- // fileName += currentKey.FilePath;
- // var file = await System.Threading.Tasks.Task.Factory.StartNew(() => Newtonsoft.Json.JsonConvert.SerializeObject(currentKey));
- // var data = System.Text.Encoding.UTF8.GetBytes(file);
- // //缃戝叧涓垱寤哄瓨鍌ㄦ暟鎹殑鏂囦欢
- // var saveFile = await currentKey.Gateway.CreateFileAsync(fileName);
- // //涓婁紶鏁版嵁鍒扮綉鍏�
- // var saveData = await currentKey.Gateway.SendFileAsync(data);
- // };
-
- // //瀛樺偍涓嬭浇鐨勬枃浠舵暟鎹�
- // var byteSource = new System.Collections.Generic.List<byte>();
- // if (byteSource != null)
- // {
- // //鎭㈠鏁版嵁瀵硅薄
- // var realDa = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel>(System.Text.Encoding.UTF8.GetString(byteSource.ToArray()));
- //}
-
- ////涓嬭浇鎭㈠绉佹湁鏁版嵁
- //title.MouseUpEventHandler +=async(sender, e) =>
- // {
- // var key11 = currentKey;
- //string fileName = "Panel_";
- //fileName += currentKey.FilePath;
- // //鑾峰彇褰撳墠鏂囦欢鐨勫叿浣撲俊鎭�
- // var getFileSize = await currentKey.Gateway.GetCurrentFileInfoAsync(fileName);
- ////涓嬭浇鏂囦欢
- //var saveFileName = await currentKey.Gateway.SetDownloadFileAsync(fileName);
- ////鎺ユ敹鏁版嵁
- //Action<string, byte[]> action = (topic, dataContent) =>
- //{
- // if (topic.Split('/')[0] + "/" + topic.Split('/')[1] + "/" + topic.Split('/')[2] == topic.Split('/')[0] + "/" + "FileTransfer/DownloadFile")
- // {
- // byte[] fileBytes = dataContent;
- // if (fileBytes[5] != 1)
- // {
- // if (fileBytes.Length == 2056)
- // {
- // var tempBytes = new byte[2048];
- // System.Array.Copy(fileBytes, 8, tempBytes, 0, 2048);
- // byteSource.AddRange(tempBytes);
- // }
- // else
- // {
- // var tempBytes = new byte[fileBytes.Length - 8];
- // System.Array.Copy(fileBytes, 8, tempBytes, 0, tempBytes.Length);
- // byteSource.AddRange(tempBytes);
- // }
- // }
- // else
- // {
- // var tempBytes = new byte[fileBytes.Length - 8];
- // System.Array.Copy(fileBytes, 8, tempBytes, 0, tempBytes.Length);
- // byteSource.AddRange(tempBytes);
- // }
-
- // }
- //};
- //currentKey.Gateway.FileContentAction += action;
- //};
- #endregion
-
- ///// <summary>
- ///// 鍒楄〃鎺т欢
- ///// </summary>
- //private VerticalScrolViewLayout listView = null;
- ///// <summary>
- ///// 宸茬粡瀛樺湪鐨勭粦瀹氳澶�
- ///// </summary>
- //private Dictionary<string, CommonDevice> dicEsixtDevice = new Dictionary<string, CommonDevice>();
-
- ///// <summary>
- ///// 鑾峰彇璁惧鐨勫敮涓�涓婚敭
- ///// </summary>
- ///// <param name="device"></param>
- ///// <returns></returns>
- //public string GetDeviceMainKeys(CommonDevice device)
- //{
- // return device.DeviceAddr + device.DeviceEpoint;
- //}
-
- ///// <summary>
- ///// 鏄剧ず閿欒淇℃伅绐楀彛
- ///// </summary>
- ///// <param name="msg"></param>
- //private void ShowErrorMsg(string msg)
- //{
- // Application.RunOnMainThread(() =>
- // {
- // var contr = new Phone.UserCenter.ErrorMsgControl(msg);
- // contr.Show();
- // });
- //}
-
- ///// <summary>
- ///// 鏄剧ずTip淇℃伅绐楀彛
- ///// </summary>
- ///// <param name="msg"></param>
- //private void ShowTipMsg(string msg)
- //{
- // Application.RunOnMainThread(() =>
- // {
- // var contr = new Phone.UserCenter.TipViewControl(msg);
- // contr.ShowView();
- // });
- //}
-
- ///// <summary>
- ///// 鏄剧ず涓�涓渶瑕佺‘璁ょ殑淇℃伅妗�
- ///// </summary>
- ///// <param name="msg">淇℃伅</param>
- ///// <param name="methodName">鏂规硶鍚�(璇风‘璁よ繖鏄竴涓叡鏈夋柟娉�)</param>
- ///// <param name="obj">鍥炶皟鍑芥暟鐨勫惎鍔ㄥ弬鏁�</param>
- //public void ShowConfirmMsg(string msg, string methodName = null, params object[] obj)
- //{
- // Application.RunOnMainThread(() =>
- // {
- // var alert = new ConfirmMsgControl(msg);
- // alert.Show();
-
- // if (methodName != null)
- // {
- // alert.ResultEventHandler += (sender, result) =>
- // {
- // if (result == true)
- // {
- // this.LoadFormMethodByName(this, methodName, obj);
- // }
- // };
- // }
- // });
- //}
-
- ///// <summary>
- ///// 鎵ц鎸囧畾鐢婚潰鐨勬柟娉�
- ///// </summary>
- ///// <param name="form">鎸囧畾鐢婚潰鐨勮嫳鏂囧悕</param>
- ///// <param name="method">鎸囧畾瑕佸姞杞界殑鏂规硶鍚�</param>
- ///// <param name="parameter">鍚姩鍙傛暟</param>
- //public object LoadFormMethodByName(BindInfo form, string method, params object[] parameter)
- //{
- // return form.GetType().InvokeMember(method, System.Reflection.BindingFlags.InvokeMethod, null, form, parameter);
- //}
-
- ///// <summary>
- ///// 娣诲姞鐢婚潰,鍚姩鍙傛暟鐢辨寚瀹氱敾闈㈢殑ShowForm鍑芥暟鎵�鎸囧畾
- ///// </summary>
- ///// <param name="newform">瀵硅薄鐢婚潰</param>
- ///// <param name="parameter">鍚姩鍙傛暟锛氬弬鏁扮敱鎸囧畾鐢婚潰鐨凷howForm鍑芥暟鎵�鎸囧畾</param>
- //public void AddForm(UserCenterCommonForm newform, params object[] parameter)
- //{
- // //妫�娴嬭兘鍚﹁拷鍔犵敾闈�(闃叉鐢婚潰浜岄噸娣诲姞)锛屽綋鐐瑰嚮杩囧揩鏃讹紝浼氭湁鍑犵巼浜岄噸娣诲姞
- // if (UserCenterLogic.CheckCanAddForm(newform) == false)
- // {
- // return;
- // }
- // newform.FormID = UserCenterLogic.GetFormName(newform);
-
- // UserView.HomePage.Instance.AddChidren(newform);
- // UserView.HomePage.Instance.PageIndex += 1;
- // //鍒濆鍖栫晫闈㈡鏋�
- // newform.InitForm(parameter);
- // //鎵цShowForm()鏂规硶
- // newform.LoadShowFormMethod(parameter);
- //}
-
- ///// <summary>
- ///// 鑳界粦瀹氬埌鎸夐敭鐨勮澶�
- ///// </summary>
- ///// <param name="device"></param>
- ///// <returns></returns>
- //public bool SupportDevice(CommonDevice device,int currentClusterID)
- //{
- // foreach (var data in device.InClusterList)
- // {
- // //鎷ユ湁on/off鍔熻兘鐨勶紝鎵嶆敮鎸佹祴璇�
- // if (data.InCluster == currentClusterID)
- // {
- // return true;
- // }
- // }
- // return false;
- //}
-
- ///// <summary>
- ///// 缁戝畾PIR浼犳劅鍣ㄧ殑鐩爣(杩斿洖鎴愬姛璁剧疆鐨勮澶�,閿欒鏃讹紝杩斿洖null)
- ///// </summary>
- ///// <param name="i_iasZone">浼犳劅鍣�</param>
- ///// <param name="listDevice">瑕佺粦瀹氱殑鐩爣璁惧</param>
- ///// <returns></returns>
- //public async Task<List<CommonDevice>> BindKeyDeviceTargets(Panel key, List<CommonDevice> listDevice,int currentClusterID)
- //{
- // if (listDevice.Count == 0)
- // {
- // return new List<CommonDevice>();
- // }
-
- // var dicDevice = new Dictionary<string, CommonDevice>();
-
- // //缁勮鏁版嵁
- // var addData = new Panel.AddBindData();
- // addData.DeviceAddr = key.DeviceAddr;
- // addData.Epoint = key.DeviceEpoint;
- // foreach (var device in listDevice)
- // {
- // var info = new Panel.AddBindListObj();
- // info.BindCluster = currentClusterID;
- // info.BindMacAddr = device.DeviceAddr;
- // info.BindEpoint = device.DeviceEpoint;
- // info.BindType = 0;
-
- // addData.BindList.Add(info);
-
- // //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢�
- // string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
- // dicDevice[mainkeys] = device;
- // }
-
- // var result = await key.AddDeviceBindAsync(addData);
- // if (result.addedDeviceBindResponseData == null)
- // {
- // //濡傛灉缃戝叧宸茬粡鎺夌嚎
- // bool flage = Common.LocalGateway.Current.CheckGatewayOnLineOnTimeout(key.CurrentGateWayId, result.errorMessageBase);
- // if (flage == false)
- // {
- // return null;
- // }
- // //缁戝畾鐩爣璁剧疆澶辫触
- // string msg = Language.StringByID(R.MyInternationalizationString.uSetBindTargetsFail);
- // //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
- // msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg);
-
- // this.ShowErrorMsg(msg);
- // return null;
- // }
-
- // var listSuccess = new List<CommonDevice>();
- // foreach (var data in result.addedDeviceBindResponseData.BindList)
- // {
- // string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint);
- // //0:娣诲姞鎴愬姛 3:宸茬粡瀛樺湪锛屼篃鍙互浠h〃鎴愬姛
- // if (data.Result == 0 || data.Result == 3)
- // {
- // if (dicDevice.ContainsKey(mainkeys) == true)
- // {
- // listSuccess.Add(dicDevice[mainkeys]);
- // }
- // }
- // //1锛氬け璐ワ紝鑺傜偣璁惧鎴栧満鏅笉瀛樺湪
- // else if (data.Result == 1)
- // {
- // if (dicDevice.ContainsKey(mainkeys) == true)
- // {
- // //璁惧鍚嶇О 缁戝畾澶辫触
- // string msg = Shared.Common.LocalDevice .Current.GetDeviceEpointName(dicDevice[mainkeys]) + " ";
- // msg += Language.StringByID(R.MyInternationalizationString.BindFailed);
- // this.ShowTipMsg(msg);
- // }
- // }
- // //2锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔�
- // else if (data.Result == 2)
- // {
- // if (result.addBindResultResponseData == null)
- // {
- // //璁惧鍚嶇О 缁戝畾澶辫触
- // string msg = Shared.Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + " ";
- // msg += Language.StringByID(R.MyInternationalizationString.BindFailed);
- // this.ShowTipMsg(msg);
- // }
- // else
- // {
- // //娣诲姞鎴愬姛
- // if (result.addBindResultResponseData.Result == 0)
- // {
- // if (dicDevice.ContainsKey(mainkeys) == true)
- // {
- // listSuccess.Add(dicDevice[mainkeys]);
- // }
- // }
- // //璁惧鍚嶇О 缁戝畾鍒楄〃宸叉弧
- // else if (result.addBindResultResponseData.Result == 140)
- // {
- // string msg = Shared.Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + " ";
- // msg += Language.StringByID(R.MyInternationalizationString.uBindListIsFull);
- // this.ShowTipMsg(msg);
- // }
- // else
- // {
- // //璁惧鍚嶇О 缁戝畾澶辫触
- // string msg = Shared.Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + " ";
- // msg += Language.StringByID(R.MyInternationalizationString.BindFailed);
- // this.ShowTipMsg(msg);
- // }
- // }
- // }
- // }
-
- // return listSuccess;
- //}
-
- ///// <summary>
- ///// 鏄剧ず璁惧閫夋嫨鐨勭晫闈�
- ///// </summary>
- //public void ShowDeviceSelectForm(Panel key, int currentClusterID)
- //{
- // var listShowDevice = new List<CommonDevice>();
- // foreach (var device in PanelBindPage.list)
- // {
- // if (SupportDevice(device, currentClusterID) == false)
- // {
- // continue;
- // }
-
- // string mainKeys = this.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();
- // this.AddForm(form, listShowDevice, listSelect, false);
- // //娣诲姞缁戝畾鐩爣
- // form.SetTitleText(Language.StringByID(R.MyInternationalizationString.AddBindTargets));
-
- // //璁惧閫夋嫨纭畾
- // form.ActionSelectDevice += (async (listDevice) =>
- // {
- // if (listDevice.Count == 0)
- // {
- // return;
- // }
-
- // var listNewDevice = await this.BindKeyDeviceTargets(key, listDevice,currentClusterID);
-
- // 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(() =>
- // {
- // this.AddRowlayout(device);
- // });
- // }
- // });
- //}
-
- ///// <summary>
- ///// 娣诲姞琛�
- ///// </summary>
- ///// <param name="device"></param>
- //private void AddRowlayout(CommonDevice device)
- //{
- // 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);
- // };
- //}
-
}
}
--
Gitblit v1.8.0