| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Runtime.CompilerServices; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter.DoorLock |
| | | { |
| | | public class DoorLockCommonInfo : ZigBee.Device.DoorLock |
| | | public class DoorLockCommonInfo : CommonDevice |
| | | { |
| | | public DoorLockCommonInfo() |
| | | { |
| | | } |
| | | #region 本地变量 |
| | | public static bool IsModify = false; |
| | | public static bool InTempPasswordVisiable = false; |
| | | public static int ValidDateYear = 0; |
| | | public static int ValidDateMonth = 0; |
| | | public static int ValidDateDay = 0; |
| | | public static int ValidDateHour = 100; |
| | | public static int ValidDateMinute = 100; |
| | | public static int ValidDateSecond = 0; |
| | | public static int InValidDateYear = 0; |
| | | public static int InValidDateMonth = 0; |
| | | public static int InValidDateDay = 0; |
| | | public static int InValidDateHour = 100; |
| | | public static int InValidDateMinute = 100; |
| | | public static int InValidDateSecond = 0; |
| | | #endregion |
| | | |
| | | public class DoorLockFingerprintInfo |
| | | /// <summary> |
| | | /// 获取门锁包含设备信息和账户信息 |
| | | /// </summary> |
| | | public static async System.Threading.Tasks.Task<Dictionary<int, LocaDoorLockObj>> GetLocaDoorLocklist(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes curAccountObj) |
| | | { |
| | | /// <summary> |
| | | /// 指纹备注 |
| | | /// </summary> |
| | | public string fingerprintRemark = string.Empty; |
| | | /// <summary> |
| | | /// 指纹图片 |
| | | /// </summary> |
| | | public string fingerprintImage = string.Empty; |
| | | return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<Dictionary<int, LocaDoorLockObj>>>)(async () => |
| | | { |
| | | // 读取设备中的信息 |
| | | doorLock.localDoorLockUserList.Clear(); |
| | | var getDoorLockInfo = await doorLock.GetDoorlockUserInfoAsync(); |
| | | if (getDoorLockInfo != null && getDoorLockInfo.doorLockUserDetailData != null) |
| | | { |
| | | var dataList = getDoorLockInfo.doorLockUserDetailData.UserObjList; |
| | | foreach (var doorData in dataList) |
| | | { |
| | | var localDoorLockObj1 = new ZigBee.Device.DoorLock.LocaDoorLockObj() |
| | | { |
| | | UserID = doorData.UserId, |
| | | UnlockType = doorData.UserType |
| | | }; |
| | | if ((doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj1.UserID)) == false) |
| | | { |
| | | doorLock.localDoorLockUserList.Add(localDoorLockObj1.UserID, localDoorLockObj1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 读取云端门锁设备中的信息 |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.GetDoorLockData() { }; |
| | | |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | localDoorLockObj.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | localDoorLockObj.IsOtherAccountCtrl = true; |
| | | } |
| | | |
| | | localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark; |
| | | |
| | | { |
| | | localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj); |
| | | |
| | | if (getDoorLockInfoList != null) |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoList.PageData) |
| | | { |
| | | if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId))) |
| | | { |
| | | var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId); |
| | | doorLockObj.UnlockType = curDoorLockUser.OpenLockMode; |
| | | doorLockObj.PrimaryId = curDoorLockUser.Id; |
| | | doorLockObj.EntryTime = curDoorLockUser.EntryTime; |
| | | doorLockObj.UserName = curDoorLockUser.UserIdRemarks; |
| | | doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId; |
| | | doorLock.localDoorLockUserList[int.Parse(curDoorLockUser.DoorLockLocalUserId)] = doorLockObj; |
| | | } |
| | | else |
| | | { |
| | | //门锁中不存在用户ID,云端存在,需要在这里删除云端存在的数据 |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId; |
| | | deleteDoorLockData.PrimaryId = curDoorLockUser.Id; |
| | | deleteDoorLockData.DelDoorLockDelType = 2; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | } |
| | | } |
| | | } |
| | | return doorLock.localDoorLockUserList; |
| | | })); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 所有方式选择 |
| | | /// 生成6位临时密码 |
| | | /// </summary> |
| | | public void SideslipFramelayout(ZigBee.Device.DoorLock doorLock) |
| | | /// <returns></returns> |
| | | public static string GetTempPassword() |
| | | { |
| | | //var dialog = new Dialog |
| | | //{ |
| | | //}; |
| | | //dialog.Show(); |
| | | |
| | | //var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; |
| | | //dialog.AddChidren(flMain); |
| | | //flMain.MouseUpEventHandler += (sender11, e11) => |
| | | //{ |
| | | // dialog.Close(); |
| | | //}; |
| | | |
| | | //var sidelipFrameLayout = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(625), |
| | | // Width = Application.GetRealWidth(449), |
| | | // Y = Application.GetRealHeight(115 + 160), |
| | | // X = Application.GetRealWidth(596), |
| | | // BackgroundImagePath = "DoorLock/SideslipPic.png", |
| | | //}; |
| | | //flMain.AddChidren(sidelipFrameLayout); |
| | | |
| | | //var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(600), |
| | | // Y = Application.GetRealHeight(28), |
| | | //}; |
| | | //sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); |
| | | //Button oldbutton = null; |
| | | //Button oldbuttonText = null; |
| | | //for (var i = 0; i < 4; i++) |
| | | //{ |
| | | // var rowFrameLayout = new RowLayout() |
| | | // { |
| | | // Height = Application.GetRealHeight(150), |
| | | // }; |
| | | // sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout); |
| | | |
| | | // var btnAllMethod = new Button() |
| | | // { |
| | | // Width = Application.GetRealWidth(81), |
| | | // Height = Application.GetRealHeight(81), |
| | | // X = Application.GetRealWidth(81), |
| | | // Y = Application.GetRealHeight(55), |
| | | // }; |
| | | // rowFrameLayout.AddChidren(btnAllMethod); |
| | | |
| | | // var btnMethodText = new Button() |
| | | // { |
| | | // Width = Application.GetRealWidth(311), |
| | | // Height = Application.GetRealHeight(58), |
| | | // X = Application.GetRealWidth(173), |
| | | // Y = Application.GetRealHeight(69), |
| | | // TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | // TextSize = 14, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // }; |
| | | // rowFrameLayout.AddChidren(btnMethodText); |
| | | |
| | | // EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | // { |
| | | // if (!btnAllMethod.IsSelected) |
| | | // { |
| | | // if (oldbutton != null) |
| | | // { |
| | | // oldbutton.IsSelected = false; |
| | | // } |
| | | // if (oldbuttonText != null) |
| | | // { |
| | | // oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; |
| | | // } |
| | | // oldbutton = btnAllMethod; |
| | | // oldbuttonText = btnMethodText; |
| | | // doorLock.currentUserDisplayMethod = btnMethodText.Text; |
| | | // btnAllMethod.IsSelected = true; |
| | | // oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | |
| | | // // 类型区分 |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod)) |
| | | // { |
| | | // RefreshList(); |
| | | // } |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) |
| | | // { |
| | | // DisplayByType(0); |
| | | // } |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) |
| | | // { |
| | | // DisplayByType(15); |
| | | // } |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) |
| | | // { |
| | | // DisplayByType(3); |
| | | // } |
| | | // } |
| | | // dialog.Close(); |
| | | // }; |
| | | // rowFrameLayout.MouseUpEventHandler += hander; |
| | | // btnAllMethod.MouseUpEventHandler += hander; |
| | | // btnMethodText.MouseUpEventHandler += hander; |
| | | |
| | | // switch (i) |
| | | // { |
| | | // case 0: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); |
| | | // break; |
| | | // case 1: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); |
| | | // break; |
| | | // case 2: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock); |
| | | // break; |
| | | // case 3: |
| | | // btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; |
| | | // btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; |
| | | // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); |
| | | // break; |
| | | // } |
| | | |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0) |
| | | // { |
| | | // btnAllMethod.IsSelected = true; |
| | | // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | // oldbutton = btnAllMethod; |
| | | // oldbuttonText = btnMethodText; |
| | | // } |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1) |
| | | // { |
| | | // btnAllMethod.IsSelected = true; |
| | | // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | // oldbutton = btnAllMethod; |
| | | // oldbuttonText = btnMethodText; |
| | | // } |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2) |
| | | // { |
| | | // btnAllMethod.IsSelected = true; |
| | | // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | // oldbutton = btnAllMethod; |
| | | // oldbuttonText = btnMethodText; |
| | | // } |
| | | // if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3) |
| | | // { |
| | | // btnAllMethod.IsSelected = true; |
| | | // btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | // oldbutton = btnAllMethod; |
| | | // oldbuttonText = btnMethodText; |
| | | // } |
| | | //} |
| | | string password = ""; |
| | | password = new Random().Next(100000, 999999).ToString(); |
| | | return password; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过类型筛选显示 |
| | | /// </summary> |
| | | public void DisplayByType(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes curAccountObj, int unlockMethod, VerticalScrolViewLayout bodyView, Button entryStatusPic, Button btnPicTip, Button btnPicTip1) |
| | | /// 将UNIX时间戳转换成系统时间(精确到秒) |
| | | /// <returns></returns> |
| | | public static DateTime GetLocalTime(int unixTimeStamp) |
| | | { |
| | | //bodyView.RemoveAll(); |
| | | //var curAccountDoorLockUserList = new Dictionary<int, ZigBee.Device.DoorLock.LocaDoorLockObj>(); |
| | | DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); |
| | | long lTime = long.Parse(unixTimeStamp + "0000000"); |
| | | TimeSpan toNow = new TimeSpan(lTime); |
| | | DateTime dtResult = dtStart.Add(toNow); |
| | | return dtResult; |
| | | } |
| | | |
| | | //foreach (var curUserId in doorLock.localDoorLockUserList.Keys) |
| | | //{ |
| | | // var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | /// <summary> |
| | | /// 将系统时间转换成UNIX时间戳(精确到秒) |
| | | /// </summary> |
| | | /// <param name="dateTime">北京时间</param> |
| | | /// <param name="accurateToMilliseconds">精确到毫秒,否到秒</param> |
| | | /// <returns>返回一个长整数时间戳</returns> |
| | | public static string GetUnixTimeStamp(DateTime dateTime) |
| | | { |
| | | DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); |
| | | //DateTime dtNow = DateTime.Parse(DateTime.Now.ToString()); |
| | | TimeSpan toNow = dateTime.Subtract(dtStart); |
| | | string timeStamp = toNow.Ticks.ToString(); |
| | | timeStamp = timeStamp.Substring(0, timeStamp.Length - 7); |
| | | return timeStamp; |
| | | } |
| | | |
| | | // if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // else |
| | | // { |
| | | // curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); |
| | | // } |
| | | //} |
| | | |
| | | //if (curAccountDoorLockUserList.Count == 0) |
| | | //{ |
| | | // entryStatusPic.Visible = true; |
| | | // btnPicTip.Visible = true; |
| | | // btnPicTip1.Visible = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // entryStatusPic.Visible = false; |
| | | // btnPicTip.Visible = false; |
| | | // btnPicTip1.Visible = false; |
| | | //} |
| | | |
| | | //foreach (var curUserId in curAccountDoorLockUserList.Keys) |
| | | //{ |
| | | // var curDoorLockUser = curAccountDoorLockUserList[curUserId]; |
| | | // if (curDoorLockUser.UnlockType != unlockMethod) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // #region UI |
| | | // var rowFrameLayout = new RowLayout() |
| | | // { |
| | | // Height = Application.GetRealHeight(173), |
| | | // X = Application.GetRealWidth(58), |
| | | // Width = Application.GetRealWidth(965), |
| | | // LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | // }; |
| | | // bodyView.AddChidren(rowFrameLayout); |
| | | |
| | | // var btnPicFrameLayout = new FrameLayout() |
| | | // { |
| | | // Width = Application.GetRealWidth(81), |
| | | // Height = Application.GetRealHeight(81), |
| | | // X = Application.GetRealWidth(40), |
| | | // Y = Application.GetRealHeight(49), |
| | | // }; |
| | | // rowFrameLayout.AddChidren(btnPicFrameLayout); |
| | | |
| | | // var btnPic = new Button() |
| | | // { |
| | | // Width = Application.GetRealWidth(84), |
| | | // Height = Application.GetRealHeight(84), |
| | | // UnSelectedImagePath = "DoorLock/DoorLockUserPic.png", |
| | | // }; |
| | | // btnPicFrameLayout.AddChidren(btnPic); |
| | | |
| | | // var btnDoorlockUser = new EditText() |
| | | // { |
| | | // Width = Application.GetRealWidth(1080 - 173), |
| | | // Height = Application.GetRealHeight(60), |
| | | // X = Application.GetRealWidth(173), |
| | | // Y = Application.GetRealHeight(35), |
| | | // TextSize = 14, |
| | | // PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | // TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // }; |
| | | // rowFrameLayout.AddChidren(btnDoorlockUser); |
| | | |
| | | // var btnMember = new Button() |
| | | // { |
| | | // Width = Application.GetRealWidth(1080 - 173), |
| | | // Height = Application.GetRealHeight(49), |
| | | // X = Application.GetRealWidth(173), |
| | | // Y = Application.GetRealHeight(95), |
| | | // TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | // TextSize = 14, |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // }; |
| | | // rowFrameLayout.AddChidren(btnMember); |
| | | |
| | | // var btnDel = new Button() |
| | | // { |
| | | // Width = Application.GetRealWidth(1080 - 173), |
| | | // Height = Application.GetRealHeight(49), |
| | | // X = Application.GetRealWidth(173), |
| | | // Y = Application.GetRealHeight(95), |
| | | // Text = Language.StringByID(R.MyInternationalizationString.Delete), |
| | | // TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | // TextSize = 12, |
| | | // TextAlignment = TextAlignment.Center, |
| | | // BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel, |
| | | // }; |
| | | // rowFrameLayout.AddRightView(btnDel); |
| | | // #endregion |
| | | // #region 数据处理 |
| | | // switch (curDoorLockUser.UnlockType) |
| | | // { |
| | | // case 0: |
| | | // if (curDoorLockUser.UserName != "") |
| | | // { |
| | | // btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | // } |
| | | // else |
| | | // { |
| | | // btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID; |
| | | // } |
| | | // break; |
| | | // case 3: |
| | | // if (curDoorLockUser.UserName != "") |
| | | // { |
| | | // btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | // } |
| | | // else |
| | | // { |
| | | // btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID; |
| | | // } |
| | | // break; |
| | | // case 15: |
| | | // if (curDoorLockUser.UserName != "") |
| | | // { |
| | | // btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | // } |
| | | // else |
| | | // { |
| | | // btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID; |
| | | // } |
| | | // break; |
| | | // } |
| | | |
| | | // if (curAccountObj.UserName == "") |
| | | // { |
| | | // btnMember.Text = curAccountObj.Account; |
| | | // } |
| | | // else |
| | | // { |
| | | // btnMember.Text = curAccountObj.UserName; |
| | | // } |
| | | |
| | | // Action<Shared.View> action = async (obj) => |
| | | // { |
| | | // var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); |
| | | // refreshDoorLockData.CloudAccountId = curAccountObj.SubAccountDistributedMark; |
| | | // if (doorLock.DeviceAddr != null) |
| | | // { |
| | | // refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | // } |
| | | // refreshDoorLockData.OpenLockMode = curDoorLockUser.UnlockType; |
| | | // refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | // refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | // refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; |
| | | // var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/UpdateDoorLock", refreshDoorLockData); |
| | | // if (result.StateCode == "Success") |
| | | // { |
| | | // if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | // { |
| | | // doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | // var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | // localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | // localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; |
| | | // localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; |
| | | // localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; |
| | | // localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; |
| | | // doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); |
| | | // RefreshList(); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | // } |
| | | // }; |
| | | // btnDoorlockUser.EditorEnterAction += action; |
| | | |
| | | // btnDel.MouseUpEventHandler += (sender, e) => |
| | | // { |
| | | // var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod), |
| | | // Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | // alert.Show(); |
| | | // alert.ResultEventHandler += async (sender1, e1) => |
| | | // { |
| | | // if (e1) |
| | | // { |
| | | // var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); |
| | | // var resultData = await doorLock.DefaultControlAsync(passData); |
| | | // if (resultData != null && resultData.responseData != null) |
| | | // { |
| | | // if (resultData.responseData.status == 0) |
| | | // { |
| | | // var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | // if (doorLock.DeviceAddr != null) |
| | | // { |
| | | // deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | // } |
| | | // deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | // deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | // deleteDoorLockData.DelDoorLockDelType = 2; |
| | | // var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/DelDoorLock", deleteDoorLockData); |
| | | // if (result.StateCode == "Success") |
| | | // { |
| | | // if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | // { |
| | | // doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | // var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | // localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | |
| | | // //new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | // doorLock.localDoorLockUserList.Remove(curUserId); |
| | | // RefreshList(); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // if (curDoorLockUser.UserID < 10) |
| | | // { |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | // } |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | // } |
| | | // } |
| | | // }; |
| | | // }; |
| | | // #endregion |
| | | //} |
| | | /// <summary> |
| | | /// 门锁编程事件通知 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class LocaDoorLockObj |
| | | { |
| | | /// <summary> |
| | | /// 用户id |
| | | /// <para>管理员10个,0~9,</para>
///<para>普通用户220个,10~234</para>
///<para>一次性用户10个,235~245</para>
///<para>临时密码密码10个,245~255,</para>
///<para>其中指纹100,密码100,卡56</para> |
| | | ///<para>门锁本地录入的密码、指纹、感应卡都有唯一对应的用户Id</para> |
| | | /// </summary> |
| | | public int UserID; |
| | | /// <summary> |
| | | /// 开锁类型 |
| | | /// <para>常用:</para> |
| | | /// <para>0:Keypad(键盘/密码);3:RFID(射频卡);15:指纹</para> |
| | | /// <para>不常用: |
| | | /// <para>1:RF(Zigbee无线);2:Manual(手动);255:Indeterminate(不确定)</para> |
| | | /// </summary> |
| | | public int UnlockType; |
| | | /// <summary> |
| | | /// 关联账户的ID |
| | | /// </summary> |
| | | public string ConnectedAccount = string.Empty; |
| | | /// <summary> |
| | | /// 门锁用户名 |
| | | /// </summary> |
| | | public string UserName = string.Empty; |
| | | /// <summary> |
| | | /// 门锁录入的时 |
| | | /// </summary> |
| | | public DateTime EntryTime = System.DateTime.MinValue; |
| | | /// <summary>
|
| | | /// PrimaryId 门锁云端主 键(非更新字段,以下均为更新字段) -->键名 : PrimaryId默认值: null
|
| | | /// </summary>
|
| | | public string PrimaryId = ""; |
| | | } |
| | | } |
| | | } |