From c1de48884fa145a16a0f8bcee93274dcfaa0ff82 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 07 五月 2020 10:40:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-2020xm
---
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs | 819 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 819 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
new file mode 100755
index 0000000..8a521d7
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -0,0 +1,819 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared.Common;
+using ZigBee.Device;
+namespace Shared.Phone.UserCenter.DoorLock
+{
+ public class UndistributeDoorlockUserPage : DoorLockCommonLayout
+ {
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ /// <param name="doorLock"></param>
+ public UndistributeDoorlockUserPage(ZigBee.Device.DoorLock doorLock, List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList)
+ {
+ this.doorLock = doorLock;
+ this.localAccountList = localAccountList;
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
+ }
+
+ #region 鍙橀噺鐢虫槑
+ /// <summary>
+ /// 褰撳墠闂ㄩ攣
+ /// </summary>
+ ZigBee.Device.DoorLock doorLock;
+ /// <summary>
+ /// 搴曢儴鐧借壊甯冨眬
+ /// </summary>
+ FrameLayout bottomFrameLayout;
+ /// <summary>
+ /// 褰撳墠绫诲瀷
+ /// </summary>
+ string currentType = string.Empty;
+ /// <summary>
+ /// 鏈湴璐︽埛鍒楄〃
+ /// </summary>
+ List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList;
+ /// <summary>
+ /// 婊戝姩甯冨眬View
+ /// </summary>
+ VerticalRefreshLayout bodyView;
+ /// <summary>
+ /// 淇濆瓨涔嬪墠鎼滅储鍒版湰鍦伴棬閿佺敤鎴峰垪琛�
+ /// </summary>
+ Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj> oldLocalDoorLockUserList = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>();
+ #endregion
+
+ /// <summary>
+ /// 鑾峰彇鎵�鏈夎处鎴风殑闂ㄩ攣鐢ㄦ埛鍒楄〃
+ /// </summary>
+ void ReadDoorLockUserInfo()
+ {
+ System.Threading.Tasks.Task.Run(async () =>
+ {
+ try
+ {
+ var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock);
+ if (oldLocalDoorLockUserList.Count != 0)
+ {
+ //濡傛灉鏈娌℃湁鎼滅储鍒帮紝鎻愮ず缃戝叧娌℃湁鍥炲
+ if (list.Count == 0)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+ });
+ }
+ }
+ }
+ catch { }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ TypeRefresh();
+ CommonPage.Loading.Hide();
+ bodyView.EndHeaderRefreshing();
+ });
+ }
+ });
+ }
+
+ /// <summary>
+ /// UI鏄剧ず
+ /// </summary>
+ public void Show()
+ {
+ doorLock.currentUserDisplayMethod = "";
+ this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.UndistributedUnlockMethod));
+ this.btnTitleLine.Visible = false;
+ EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
+ {
+ RemoveFromParent();
+ };
+ this.btnBack.MouseUpEventHandler += eHandlerBack;
+ this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
+ this.MidFrameLayout(this);
+ MidFrameLayoutContent();
+ if (doorLock.localDoorLockUserList.Count == 0)
+ {
+ CommonPage.Loading.Start("Loading...");
+ ReadDoorLockUserInfo();
+ }
+ else
+ {
+ RefreshList();
+ }
+ }
+
+ /// <summary>
+ /// 涓儴甯冨眬
+ /// </summary>
+ public void MidFrameLayoutContent()
+ {
+ var midTopFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(115),
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTopFrameLayout,
+ };
+ this.midFrameLayout.AddChidren(midTopFrameLayout);
+
+ var btnAllMethod = new Button()
+ {
+ Height = Application.GetRealHeight(49),
+ Width = Application.GetRealWidth(141 + 100),
+ Y = Application.GetRealHeight(35),
+ X = Application.GetRealWidth(812 - 100),
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+ TextSize = 12,
+ IsBold = true,
+ };
+ midTopFrameLayout.AddChidren(btnAllMethod);
+ // 绫诲瀷鍖哄垎
+ if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod))
+ {
+ btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
+ }
+ else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
+ {
+ btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock);
+ }
+ else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock))
+ {
+ btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock);
+ }
+ else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock))
+ {
+ btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock);
+ }
+ else
+ {
+ btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
+ }
+
+ var btnNext = new Button()
+ {
+ X = Application.GetRealWidth(953),
+ Y = Application.GetRealHeight(20),
+ Height = Application.GetRealHeight(69),
+ Width = Application.GetRealWidth(69),
+ UnSelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
+ SelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
+ };
+ midTopFrameLayout.AddChidren(btnNext);
+ EventHandler<MouseEventArgs> handerSideLip = (sender, e) =>
+ {
+ SideslipFramelayout();
+ };
+ btnNext.MouseUpEventHandler += handerSideLip;
+ btnAllMethod.MouseUpEventHandler += handerSideLip;
+ var btnLine = new Button
+ {
+ Y = midTopFrameLayout.Bottom,
+ Height = 1,
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine,
+ };
+ this.midFrameLayout.AddChidren(btnLine);
+
+ bodyView = new VerticalRefreshLayout()
+ {
+ Y = btnLine.Bottom,
+ Height = Application.GetRealHeight(1921 - 184 - 115 - 1),
+ };
+ this.midFrameLayout.AddChidren(bodyView);
+ bodyView.BeginHeaderRefreshingAction += () =>
+ {
+ bodyView.BeginHeaderRefreshing();
+ ReadDoorLockUserInfo();
+ };
+ }
+
+ /// <summary>
+ /// 鍒锋柊鍒楄〃
+ /// </summary>
+ void RefreshList(int unlockMethod = -1)
+ {
+ this.midFrameLayout.RemoveAll();
+ MidFrameLayoutContent();
+ bodyView.RemoveAll();
+ var curLocalDoorLockUserList = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>();
+
+ foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
+ {
+ var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
+ if (!string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount))
+ {
+ continue;
+ }
+ if (curDoorLockUser.UserID > 245)
+ {
+ continue;
+ }
+ curLocalDoorLockUserList.Add(curUserId, curDoorLockUser);
+ }
+
+ int i = 0;
+ foreach (var curUserId in curLocalDoorLockUserList.Keys)
+ {
+ oldLocalDoorLockUserList = curLocalDoorLockUserList;
+ var curDoorLockUser = curLocalDoorLockUserList[curUserId];
+ switch (unlockMethod)
+ {
+ case 0:
+ if (curDoorLockUser.UnlockType != unlockMethod)
+ {
+ continue;
+ }
+ break;
+ case 3:
+ if (curDoorLockUser.UnlockType != unlockMethod)
+ {
+ continue;
+ }
+ break;
+ case 15:
+ if (curDoorLockUser.UnlockType != unlockMethod)
+ {
+ continue;
+ }
+ break;
+ default:
+ break;
+ }
+ var rowFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(127 + 23),
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
+ };
+ bodyView.AddChidren(rowFrameLayout);
+
+ var btnDistributeUnlockIconFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(84),
+ Width = Application.GetRealWidth(84),
+ X = Application.GetRealWidth(58),
+ Y = Application.GetRealHeight(43),
+ };
+ rowFrameLayout.AddChidren(btnDistributeUnlockIconFrameLayout);
+
+ var btnDistributeUnlockIcon = new Button()
+ {
+ Height = Application.GetRealHeight(84),
+ Width = Application.GetRealWidth(84),
+ UnSelectedImagePath = "DoorLock/DistributeUnlockIcon.png",
+ };
+ btnDistributeUnlockIconFrameLayout.AddChidren(btnDistributeUnlockIcon);
+
+ var btnText = new Button()
+ {
+ X = Application.GetRealWidth(176),
+ Width = Application.GetRealWidth(300),
+ Height = Application.GetRealHeight(300),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+ Gravity = Gravity.CenterVertical,
+ TextSize = 15,
+ };
+ rowFrameLayout.AddChidren(btnText);
+
+ var line2 = new Button()
+ {
+ Y = rowFrameLayout.Height - 1,
+ X = Application.GetRealWidth(176),
+ Width = Application.GetRealWidth(847),
+ Height = 1,
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+ };
+ rowFrameLayout.AddChidren(line2);
+
+ #region 鏁版嵁澶勭悊
+ int currentIndex = i;
+ if (currentIndex == curLocalDoorLockUserList.Keys.Count - 1)
+ {
+ line2.Visible = false;
+ }
+ switch (curDoorLockUser.UnlockType)
+ {
+ case 0:
+ if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+ {
+ btnText.Text = curDoorLockUser.UserName;
+ }
+ else
+ {
+ btnText.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
+ }
+ break;
+ case 3:
+ if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+ {
+ btnText.Text = curDoorLockUser.UserName;
+ }
+ else
+ {
+ btnText.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
+ }
+ break;
+ case 15:
+ if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+ {
+ btnText.Text = curDoorLockUser.UserName;
+ }
+ else
+ {
+ btnText.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
+ }
+ break;
+ }
+
+ EventHandler<MouseEventArgs> eHandler = (sender, e) =>
+ {
+ MatchUsersFrameLayout(curDoorLockUser);
+ };
+ btnDistributeUnlockIcon.MouseUpEventHandler += eHandler;
+ btnDistributeUnlockIconFrameLayout.MouseUpEventHandler += eHandler;
+ rowFrameLayout.MouseUpEventHandler += eHandler;
+ btnText.MouseUpEventHandler += eHandler;
+ #endregion
+ i++;
+ }
+ }
+
+ /// <summary>
+ /// 鍒嗛厤鏈湴璐︽埛
+ /// </summary>
+ void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
+ {
+ #region UI
+ FrameLayout flMain = new FrameLayout { BackgroundColor = 0x0f000000 };
+ this.AddChidren(flMain);
+ flMain.MouseUpEventHandler += (sender11, e11) =>
+ {
+ flMain.RemoveFromParent();
+ bottomFrameLayout.RemoveAll();
+ };
+ bottomFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(100),
+ Y = Application.GetRealHeight(1253),
+ Radius = (uint)Application.GetRealHeight(100 / 2),
+ BackgroundColor = ZigbeeColor.Current.XMWhite,
+ };
+ flMain.AddChidren(bottomFrameLayout);
+
+ var bottomFrameLayout1 = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(668 - 60),
+ Y = Application.GetRealHeight(1253 + 58),
+ BackgroundColor = ZigbeeColor.Current.XMWhite,
+ };
+ flMain.AddChidren(bottomFrameLayout1);
+
+ var bottomFrameLayout2 = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(668),
+ Y = Application.GetRealHeight(1253),
+ };
+ flMain.AddChidren(bottomFrameLayout2);
+
+ var matchUsersFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(138),
+ };
+ bottomFrameLayout2.AddChidren(matchUsersFrameLayout);
+
+ var btnCancel = new Button
+ {
+ X = Application.GetRealWidth(81),
+ Y = Application.GetRealHeight(40),
+ Height = Application.GetRealHeight(58),
+ Width = Application.GetRealWidth(101),
+ Text = Language.StringByID(R.MyInternationalizationString.Cancel),
+ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+ TextSize = 14,
+ };
+ matchUsersFrameLayout.AddChidren(btnCancel);
+
+ var btnMatchUser = new Button
+ {
+ X = Application.GetRealWidth(159),
+ Y = Application.GetRealHeight(35),
+ Height = Application.GetRealHeight(63),
+ Width = Application.GetRealWidth(762),
+ Text = Language.StringByID(R.MyInternationalizationString.MatchUser),
+ TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+ TextSize = 16,
+ TextAlignment = TextAlignment.Center,
+ };
+ matchUsersFrameLayout.AddChidren(btnMatchUser);
+
+ var btnFinish = new Button
+ {
+ X = Application.GetRealWidth(921),
+ Y = Application.GetRealHeight(40),
+ Height = Application.GetRealHeight(58),
+ Width = Application.GetRealWidth(101 + 81),
+ Text = Language.StringByID(R.MyInternationalizationString.Complete),
+ TextColor = Shared.Common.ZigbeeColor.Current.XMOrange,
+ TextSize = 14,
+ TextAlignment = TextAlignment.CenterLeft,
+ };
+ matchUsersFrameLayout.AddChidren(btnFinish);
+
+ var btnTopLine = new FrameLayout()
+ {
+ Height = 1,
+ Y = Application.GetRealHeight(138),
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+ };
+ bottomFrameLayout2.AddChidren(btnTopLine);
+
+ var matchUserHorizontalScrolViewLayout = new VerticalScrolViewLayout()
+ {
+ Y = Application.GetRealHeight(207),
+ Height = Application.GetRealHeight(806 - 207),
+ };
+ bottomFrameLayout2.AddChidren(matchUserHorizontalScrolViewLayout);
+
+ Button oldbuttonChoose = null;
+ Button oldUserName = null;
+ string curAccountId = string.Empty;
+ for (int i = 0; i < localAccountList.Count; i++)
+ {
+ var currentAccount = localAccountList[i];
+ var rowFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(127),
+ };
+ matchUserHorizontalScrolViewLayout.AddChidren(rowFrameLayout);
+
+ var btnUserName = new Button()
+ {
+ Width = Application.GetRealWidth(743),
+ Height = Application.GetRealHeight(58),
+ X = Application.GetRealWidth(81),
+ Y = Application.GetRealHeight(37),
+ TextSize = 14,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+ };
+ rowFrameLayout.AddChidren(btnUserName);
+
+ var btnChoose = new Button()
+ {
+ Width = Application.GetRealWidth(60),
+ Height = Application.GetRealHeight(60),
+ X = Application.GetRealWidth(861 + 81),
+ Y = Application.GetRealHeight(35),
+ SelectedImagePath = "DoorLock/SelectedIcon.png",
+ Visible = false,
+ };
+ rowFrameLayout.AddChidren(btnChoose);
+
+ var btnLine = new FrameLayout()
+ {
+ Y = rowFrameLayout.Height - 1,
+ X = Application.GetRealWidth(58),
+ Width = Application.GetRealWidth(965),
+ Height = 1,
+ BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+ };
+ rowFrameLayout.AddChidren(btnLine);
+ #endregion
+ #region 鏁版嵁澶勭悊
+ int currentIndex = i;
+ if (currentIndex == localAccountList.Count - 1)
+ {
+ btnLine.Visible = false;
+ }
+
+ if (!string.IsNullOrEmpty(currentAccount.UserName))
+ {
+ btnUserName.Text = currentAccount.UserName;
+ }
+ else
+ {
+ btnUserName.Text = currentAccount.Account;
+ }
+
+ EventHandler<MouseEventArgs> eHandler = (sender, e) =>
+ {
+ if (doorLock.IsFreezeAccount[currentAccount.SubAccountDistributedMark] == true)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+ });
+ return;
+ }
+
+ if (!btnChoose.IsSelected)
+ {
+ if (oldbuttonChoose != null)
+ {
+ oldbuttonChoose.IsSelected = false;
+ oldbuttonChoose.Visible = false;
+ }
+
+ if (oldUserName != null)
+ {
+ oldbuttonChoose.IsSelected = false;
+ oldUserName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
+ }
+ oldbuttonChoose = btnChoose;
+ oldUserName = btnUserName;
+ oldbuttonChoose.IsSelected = true;
+ oldbuttonChoose.Visible = true;
+ oldUserName.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ curAccountId = currentAccount.SubAccountDistributedMark;
+ }
+ };
+ btnChoose.MouseUpEventHandler += eHandler;
+ rowFrameLayout.MouseUpEventHandler += eHandler;
+ btnUserName.MouseUpEventHandler += eHandler;
+
+ }
+ #endregion
+ btnCancel.MouseUpEventHandler += (sender, e) =>
+ {
+ flMain.RemoveFromParent();
+ bottomFrameLayout.RemoveAll();
+ };
+
+ btnFinish.MouseUpEventHandler += (sender, e) =>
+ {
+ System.Threading.Tasks.Task.Run(async () =>
+ {
+ try
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Start("");
+ });
+ if (curAccountId == "")
+ {
+ Application.RunOnMainThread(() =>
+ {
+ flMain.RemoveFromParent();
+ bottomFrameLayout.RemoveAll();
+ CommonPage.Loading.Hide();
+ });
+ }
+ else
+ {
+ var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
+ if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+ {
+ addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ addLockInfo.IsOtherAccountCtrl = true;
+ }
+ addLockInfo.CloudAccountId = curAccountId;
+ if (doorLock.DeviceAddr != null)
+ {
+ addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
+ }
+ addLockInfo.OpenLockMode = curDoorLockUser.UnlockType;
+ addLockInfo.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+ switch (curDoorLockUser.UnlockType)
+ {
+ case 0:
+ if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+ {
+ addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+ }
+ else
+ {
+ addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
+ }
+ break;
+ case 3:
+ if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+ {
+ addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+ }
+ else
+ {
+ addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
+ }
+ break;
+ case 15:
+ if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+ {
+ addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+ }
+ else
+ {
+ addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
+ }
+ break;
+ }
+ addLockInfo.EntryTime = curDoorLockUser.EntryTime;
+ var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
+ if (result != null)
+ {
+ if (result.StateCode == "Success")
+ {
+ //瀛橀棬閿佷俊鎭�
+ var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
+ var uList = new List<int> { };
+ if (resultList != null)
+ {
+ foreach (var a in resultList.Keys)
+ {
+ uList.Add(a);
+ }
+ }
+ var d = uList.Find((value) => { return value == curDoorLockUser.UserID; });
+ if (d != null)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.DistributeSuccess), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+ TypeRefresh();
+ CommonPage.Loading.Hide();
+ flMain.RemoveFromParent();
+ bottomFrameLayout.RemoveAll();
+ });
+ }
+ else
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+ });
+ }
+ }
+ else
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+ });
+ return;
+ }
+ }
+ else
+ {
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(btnFinish);
+ });
+ return;
+ }
+ }
+ }
+ catch { }
+ });
+ };
+ }
+
+ /// <summary>
+ /// 渚ц竟瀵艰埅鏍忔悳绱�
+ /// </summary>
+ void SideslipFramelayout()
+ {
+ #region sidelipFrameLayout UI
+ 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);
+ #endregion
+
+ Button oldbutton = null;
+ Button oldbuttonText = null;
+ for (var i = 0; i < 4; i++)
+ {
+ #region rowFrameLayout UI
+ var rowFrameLayout = new RowLayout()
+ {
+ Height = Application.GetRealHeight(150),
+ LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+ X = Application.GetRealWidth(81),
+ };
+ sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
+
+ var btnAllMethod = new Button()
+ {
+ Width = Application.GetRealWidth(81),
+ Height = Application.GetRealHeight(81),
+ Y = Application.GetRealHeight(35),
+ };
+ rowFrameLayout.AddChidren(btnAllMethod);
+
+ var btnMethodText = new Button()
+ {
+ Width = Application.GetRealWidth(311),
+ Height = Application.GetRealHeight(58),
+ X = Application.GetRealWidth(92),
+ Y = Application.GetRealHeight(49),
+ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+ TextSize = 14,
+ TextAlignment = TextAlignment.CenterLeft,
+ };
+ rowFrameLayout.AddChidren(btnMethodText);
+ #endregion
+
+ #region 鏁版嵁澶勭悊
+ 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;
+ oldbuttonText.IsBold = true;
+ TypeRefresh();
+ }
+ dialog.Close();
+ };
+ rowFrameLayout.MouseUpEventHandler += hander;
+ btnAllMethod.MouseUpEventHandler += hander;
+ btnMethodText.MouseUpEventHandler += hander;
+ DisplayAllUnlockMethod(i, btnAllMethod, btnMethodText);
+
+ if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0)
+ {
+ CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
+ }
+ if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0)
+ {
+ CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
+ }
+ if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1)
+ {
+ CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
+ }
+ if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2)
+ {
+ CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
+ }
+ if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3)
+ {
+ CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
+ }
+ #endregion
+ }
+ }
+
+ /// <summary>
+ /// 绫诲瀷鍖哄垎
+ /// </summary>
+ void TypeRefresh()
+ {
+ if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
+ {
+ RefreshList(0);
+ }
+ else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock))
+ {
+ RefreshList(15);
+ }
+ else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock))
+ {
+ RefreshList(3);
+ }
+ else
+ {
+ RefreshList();
+ }
+ }
+ }
+}
--
Gitblit v1.8.0