using System;
|
using System.Collections.Generic;
|
using Shared.Common;
|
using ZigBee.Device;
|
namespace Shared.Phone.UserCenter.DoorLock
|
{
|
public class UndistributeDoorlockUserPage : DoorLockCommonLayout, ZigBee.Common.IStatus
|
{
|
/// <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 ◆ 变量申明__________________________
|
ZigBee.Device.DoorLock doorLock;
|
FrameLayout bottomFrameLayout;
|
string currentType = string.Empty;
|
List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList;
|
VerticalScrolViewLayout bodyView;
|
#endregion
|
|
void ReadDoorLockUserInfo()
|
{
|
System.Threading.Tasks.Task.Run(async () =>
|
{
|
Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
|
try
|
{
|
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() { };
|
|
foreach (var curAccountObj in doorLock.localAllAccountList)
|
{
|
localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark;
|
if (doorLock.DeviceAddr != null)
|
{
|
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)))
|
{
|
doorLock.localDoorLockUserList.Remove(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.Add(int.Parse(curDoorLockUser.DoorLockLocalUserId), doorLockObj);
|
}
|
}
|
}
|
}
|
}
|
catch { }
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
RefreshList();
|
CommonPage.Loading.Hide();
|
});
|
}
|
});
|
}
|
|
/// <summary>
|
/// UI显示
|
/// </summary>
|
public void Show()
|
{
|
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();
|
ReadDoorLockUserInfo();
|
}
|
|
public void RefreshList()
|
{
|
bodyView.RemoveAll();
|
foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
|
{
|
var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
|
if (curDoorLockUser.ConnectedAccount != "")
|
{
|
continue;
|
}
|
if (curDoorLockUser.UserID > 245)
|
{
|
continue;
|
}
|
var RowView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(161),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
};
|
bodyView.AddChidren(RowView);
|
|
var btnDistributeUnlockIconFrameLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(84),
|
Width = Application.GetRealWidth(84),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(43),
|
};
|
RowView.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,
|
};
|
RowView.AddChidren(btnText);
|
|
var line2 = new Button()
|
{
|
Y = RowView.Height - 1,
|
X = Application.GetRealWidth(58),
|
Width = Application.GetRealWidth(965),
|
Height = 1,
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
|
};
|
RowView.AddChidren(line2);
|
|
#region 数据处理
|
switch (curDoorLockUser.UnlockType)
|
{
|
case 0:
|
if (curDoorLockUser.UserName != "")
|
{
|
btnText.Text = curDoorLockUser.UserName;
|
}
|
else
|
{
|
btnText.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
|
}
|
break;
|
case 3:
|
if (curDoorLockUser.UserName != "")
|
{
|
btnText.Text = curDoorLockUser.UserName;
|
}
|
else
|
{
|
btnText.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
|
}
|
break;
|
case 15:
|
if (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;
|
RowView.MouseUpEventHandler += eHandler;
|
btnText.MouseUpEventHandler += eHandler;
|
#endregion
|
}
|
}
|
|
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.Center,
|
Text = Language.StringByID(R.MyInternationalizationString.LockMethod),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
|
TextSize = 12,
|
};
|
midTopFrameLayout.AddChidren(btnAllMethod);
|
|
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);
|
btnNext.MouseUpEventHandler += (sender, e) =>
|
{
|
SideslipFramelayout();
|
};
|
|
bodyView = new VerticalScrolViewLayout()
|
{
|
Y = midTopFrameLayout.Bottom,
|
};
|
this.midFrameLayout.AddChidren(bodyView);
|
|
RefreshList();
|
}
|
|
//本地账户
|
public void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
|
{
|
#region UI
|
FrameLayout flMain = new FrameLayout { BackgroundColor = 0x0f000000 };
|
this.midFrameLayout.AddChidren(flMain);
|
flMain.MouseUpEventHandler += (sender11, e11) =>
|
{
|
flMain.RemoveFromParent();
|
bottomFrameLayout.RemoveAll();
|
};
|
bottomFrameLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(100),
|
Y = Application.GetRealHeight(930),
|
Radius = 17,
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
flMain.AddChidren(bottomFrameLayout);
|
|
var bottomFrameLayout1 = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(806 - 50),
|
Y = Application.GetRealHeight(930 + 48),
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
flMain.AddChidren(bottomFrameLayout1);
|
|
var bottomFrameLayout2 = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(806),
|
Y = Application.GetRealHeight(930),
|
};
|
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(446),
|
Y = Application.GetRealHeight(35),
|
Height = Application.GetRealHeight(63),
|
Width = Application.GetRealWidth(284),
|
Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
|
TextSize = 16,
|
};
|
matchUsersFrameLayout.AddChidren(btnMatchUser);
|
|
var btnFinish = new Button
|
{
|
X = Application.GetRealWidth(919),
|
Y = Application.GetRealHeight(40),
|
Height = Application.GetRealHeight(58),
|
Width = Application.GetRealWidth(101),
|
Text = Language.StringByID(R.MyInternationalizationString.Complete),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
TextSize = 14,
|
};
|
matchUsersFrameLayout.AddChidren(btnFinish);
|
|
var btnTopLine = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(5),
|
Y = Application.GetRealHeight(138),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
};
|
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 (currentAccount.UserName != "" && currentAccount.UserName != null)
|
{
|
btnUserName.Text = currentAccount.UserName;
|
}
|
else
|
{
|
btnUserName.Text = currentAccount.Account;
|
}
|
|
EventHandler<MouseEventArgs> eHandler = (sender, e) =>
|
{
|
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 += async (sender, e) =>
|
{
|
if (curAccountId == "")
|
{
|
flMain.RemoveFromParent();
|
bottomFrameLayout.RemoveAll();
|
}
|
else
|
{
|
var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
|
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 (curDoorLockUser.UserName != "")
|
{
|
addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
|
}
|
else
|
{
|
addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
|
}
|
break;
|
case 3:
|
if (curDoorLockUser.UserName != "")
|
{
|
addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
|
}
|
else
|
{
|
addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
|
}
|
break;
|
case 15:
|
if (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 && 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 = curDoorLockUser.UserName;
|
localDoorLockObj.ConnectedAccount = curAccountId;
|
doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
|
RefreshList();
|
flMain.RemoveFromParent();
|
bottomFrameLayout.RemoveAll();
|
}
|
}
|
else
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish);
|
flMain.RemoveFromParent();
|
bottomFrameLayout.RemoveAll();
|
}
|
}
|
};
|
}
|
|
// 侧边导航栏
|
void SideslipFramelayout()
|
{
|
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;
|
}
|
}
|
}
|
|
// 通过类型筛选显示
|
void DisplayByType(int unlockMethod)
|
{
|
bodyView.RemoveAll();
|
foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
|
{
|
var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
|
if (curDoorLockUser.ConnectedAccount != "" || curDoorLockUser.UnlockType != unlockMethod)
|
{
|
continue;
|
}
|
var RowView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(161),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
};
|
bodyView.AddChidren(RowView);
|
|
var btnDistributeUnlockIconFrameLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(84),
|
Width = Application.GetRealWidth(84),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(43),
|
};
|
RowView.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,
|
};
|
RowView.AddChidren(btnText);
|
|
var line2 = new Button()
|
{
|
Y = RowView.Height - 1,
|
X = Application.GetRealWidth(58),
|
Width = Application.GetRealWidth(965),
|
Height = 1,
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
|
};
|
RowView.AddChidren(line2);
|
|
#region 数据处理
|
switch (curDoorLockUser.UnlockType)
|
{
|
case 0:
|
if (curDoorLockUser.UserName != "")
|
{
|
btnText.Text = curDoorLockUser.UserName;
|
}
|
else
|
{
|
btnText.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
|
}
|
break;
|
case 3:
|
if (curDoorLockUser.UserName != "")
|
{
|
btnText.Text = curDoorLockUser.UserName;
|
}
|
else
|
{
|
btnText.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
|
}
|
break;
|
case 15:
|
if (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;
|
RowView.MouseUpEventHandler += eHandler;
|
btnText.MouseUpEventHandler += eHandler;
|
#endregion
|
}
|
}
|
#region ◆ 接口实现__________________________
|
/// <summary>
|
/// 处理变化事件 --将弃用 改用DeviceInfoChange()
|
/// </summary>
|
/// <returns>The changed.</returns>
|
/// <param name="common">Common.</param>
|
public void Changed(CommonDevice common)
|
{
|
|
}
|
/// <summary>
|
/// 处理变化事件
|
/// </summary>
|
/// <param name="common"></param>
|
/// <param name="typeTag"></param>
|
public void DeviceInfoChange(CommonDevice common, string typeTag)
|
{
|
}
|
/// <summary>
|
/// Changeds the IL ogic status.
|
/// </summary>
|
/// <param name="logic">Logic.</param>
|
public void ChangedILogicStatus(ZigBee.Device.Logic logic)
|
{
|
}
|
/// <summary>
|
/// Changeds the IS cene status.
|
/// </summary>
|
/// <param name="scene">Scene.</param>
|
public void ChangedISceneStatus(Scene scene)
|
{
|
}
|
#endregion
|
}
|
}
|