陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
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,176 @@
        /// 当前按键配置的功能
        /// </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];
            }
            return null;
        }
        /// <summary>
        /// 获取当前楼层
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentSelectFloorId()
        {
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();//
            foreach (var floorId in dicFloor.Keys)
            {
                //第一个楼层
                return floorId;
            }
            return null;
        }
        /// <summary>
        /// 获取当前楼层名称
        /// </summary>
        /// <returns></returns>
        public static string GetCurrentSelectFloorIdName()
        {
            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
            foreach (var floorId in dicFloor.Keys)
            {
                //第一个楼层
                return dicFloor[floorId];
            }
            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];
                }
            }
            return null;
        }
        /// <summary>
        ///  检测控制面板(按键类)所拥有的功能,现支持的有以下几种(必定存在键值,出错会返回null)
@@ -28,8 +197,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 +209,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 +274,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 +308,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 +353,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 +392,7 @@
                    }
                }
            }
            return dicCheck;
        }
        #region 私有数据备份步骤(有用代码,这里先注释掉)
        //        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">启动参数:参数由指定画面的ShowForm函数所指定</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:已经存在,也可以代表成功
        //        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:未知,由节点设备反馈发送“Bind/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);
        //    };
        //}
    }
}