using System;
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public class UserDoorLock : FrameLayout
|
{
|
|
public UserDoorLock ()
|
{
|
BackgroundColor = SkinStyle.Current.MainColor;
|
}
|
|
public void ShowDoorLockRoom (DoorLock doorLock)
|
{
|
#region 标题
|
FrameLayout topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
AddChidren (topView);
|
|
Button title = new Button () {
|
TextAlignment = TextAlignment.Center,
|
TextID = R.MyInternationalizationString.Menu,
|
TextSize = 19,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
topView.AddChidren (title);
|
|
Button logo = new Button () {
|
Width = Application.GetRealWidth (154),
|
Height = Application.GetRealHeight (90),
|
X = Application.GetRealWidth (486),
|
UnSelectedImagePath = MainPage.LogoString,
|
};
|
topView.AddChidren (logo);
|
Button back = new Button () {
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
topView.AddChidren (back);
|
back.MouseUpEventHandler += (sender, e) => {
|
this.RemoveFromParent ();
|
};
|
#endregion
|
|
var BodyView = new VerticalScrolViewLayout () {
|
Y = topView.Bottom,
|
Height = Application.GetRealHeight (Application.DesignHeight - 126),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
AddChidren (BodyView);
|
|
for (int i = 0; i < 5; i++) {
|
if (i == 3)
|
continue;
|
FrameLayout RowView = new FrameLayout () {
|
Height = Application.GetRealHeight (110),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
BodyView.AddChidren (RowView);
|
|
Button btnIcon = new Button () {
|
Width = Application.GetRealHeight (13),
|
Height = Application.GetRealHeight (13),
|
X = Application.GetRealWidth (40),
|
UnSelectedImagePath = "Item/Point.png",
|
SelectedImagePath = "Item/PointSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
RowView.AddChidren (btnIcon);
|
|
Button UserManagement = new Button () {
|
X = btnIcon.Right + Application.GetRealWidth (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (110),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1,
|
};
|
RowView.AddChidren (UserManagement);
|
if (i == 0) {
|
UserManagement.TextID = R.MyInternationalizationString.RemotelyUnlock;
|
} else if (i == 1) {
|
UserManagement.TextID = R.MyInternationalizationString.UserManagement;
|
} else if (i == 2) {
|
UserManagement.TextID = R.MyInternationalizationString.UnlockRecord;
|
} else if (i == 3) {
|
UserManagement.TextID = R.MyInternationalizationString.RemindSetting;
|
} else if (i == 4) {
|
UserManagement.TextID = R.MyInternationalizationString.SystemSetting;
|
} else if (i == 5) {
|
// UserManagement.TextID = R.MyInternationalizationString.RemindSetting;
|
}
|
|
var btnRight = new Button () {
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
X = UserManagement.Right + Application.GetRealWidth (200),
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
RowView.AddChidren (btnRight);
|
|
var line2 = new Button () {
|
Y = RowView.Height - 1,
|
Height = 1,
|
BackgroundColor = SkinStyle.Current.LineColor,
|
};
|
RowView.AddChidren (line2);
|
|
int currentIndex = i;
|
EventHandler<MouseEventArgs> eHandler = (sender, e) => {
|
if (currentIndex == 0) {
|
if (doorLock.GetDoorLockPassword () == null && !doorLock.isDoorLockConverter) {
|
FirstRemoteUnlock unlockView = new FirstRemoteUnlock (doorLock);
|
UserMiddle.DevicePageView.AddChidren (unlockView);
|
unlockView.ShowDoorLockRoom ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
} else {
|
RemotelyUnlock unlockView = new RemotelyUnlock (doorLock);
|
UserMiddle.DevicePageView.AddChidren (unlockView);
|
unlockView.ShowUserRemoteUnLock ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
}
|
} else if (currentIndex == 1) {
|
DoorLockUserMangement dView = new DoorLockUserMangement (doorLock);
|
UserMiddle.DevicePageView.AddChidren (dView);
|
dView.ShowUserManagement ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
} else if (currentIndex == 2) {
|
DoorLockRecord recordView = new DoorLockRecord (doorLock);
|
UserMiddle.DevicePageView.AddChidren (recordView);
|
recordView.ShowUserHisroryRecord ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
} else if (currentIndex == 3) {
|
DoorLockAlarmScene recordView = new DoorLockAlarmScene (doorLock);
|
UserMiddle.DevicePageView.AddChidren (recordView);
|
recordView.DoorLockAlarmSceneShow ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
} else if (currentIndex == 4) {
|
DoorLockSystemSetting dss = new DoorLockSystemSetting (doorLock);
|
UserMiddle.DevicePageView.AddChidren (dss);
|
dss.ShowUserRemoteUnLock ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
} else if (currentIndex == 5) {
|
DoorLockRemindSetting remindView = new DoorLockRemindSetting (doorLock);
|
UserMiddle.DevicePageView.AddChidren (remindView);
|
remindView.ShowSetTempPassword ();
|
UserMiddle.DevicePageView.PageIndex = UserMiddle.DevicePageView.ChildrenCount - 1;
|
|
}
|
};
|
|
btnRight.MouseUpEventHandler += eHandler;
|
btnIcon.MouseUpEventHandler += eHandler;
|
RowView.MouseUpEventHandler += eHandler;
|
UserManagement.MouseUpEventHandler += eHandler;
|
}
|
}
|
}
|
}
|