using System;
|
using Shared.Common;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter.DoorLock
|
{
|
public class UserDoorLockPage : DoorLockCommonLayout, ZigBee.Common.IStatus
|
{
|
public UserDoorLockPage(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj)
|
{
|
this.doorLock = doorLock;
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
|
ZigBee.Device.ZbGateway.StatusList.Add(this);
|
}
|
|
#region ◆ 变量申明__________________________
|
ZigBee.Device.DoorLock doorLock;
|
FrameLayout bottomFrameLayout;
|
Action action;
|
#endregion
|
|
/// <summary>
|
/// UI显示
|
/// </summary>
|
public void Show()
|
{
|
this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.DoorLock));
|
|
EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
|
{
|
RemoveFromParent();
|
};
|
this.btnBack.MouseUpEventHandler += eHandlerBack;
|
this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
|
this.MidFrameLayout(this);
|
|
var btnShare = new Button
|
{
|
X = Application.GetRealWidth(850),
|
Height = Application.GetRealHeight(69),
|
Width = Application.GetRealWidth(69),
|
UnSelectedImagePath = "DoorLock/ShareIcon.png",
|
};
|
this.titleFrameLayout.AddChidren(btnShare);
|
|
var btnFuncSet = new Button
|
{
|
X = Application.GetRealWidth(953),
|
Height = Application.GetRealHeight(69),
|
Width = Application.GetRealWidth(69),
|
UnSelectedImagePath = "DoorLock/SettingIcon.png",
|
};
|
this.titleFrameLayout.AddChidren(btnFuncSet);
|
btnFuncSet.MouseDownEventHandler += (sender, e) =>
|
{
|
var userDoorLockPage = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock);
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
userDoorLockPage.Show();
|
};
|
|
btnShare.MouseDownEventHandler += (sender, e) =>
|
{
|
var doorLock = new ZigBee.Device.DoorLock();
|
var memberManagement = new Shared.Phone.UserCenter.DoorLock.MemberManagement(doorLock);
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(memberManagement);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
memberManagement.Show();
|
};
|
|
MidFrameLayoutContent();
|
}
|
|
public void MidFrameLayoutContent()
|
{
|
#region UI
|
var midTopFrameLayout = new FrameLayout()
|
{
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(115),
|
Height = Application.GetRealHeight(1238),
|
Width = Application.GetRealWidth(965),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
};
|
this.midFrameLayout.AddChidren(midTopFrameLayout);
|
|
var btnDoorLockTitle = new Button()
|
{
|
Width = Application.GetRealWidth(250),
|
Height = Application.GetRealHeight(60),
|
X = Application.GetRealWidth(372),
|
Y = Application.GetRealHeight(46),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
Text = Language.StringByID(R.MyInternationalizationString.SmartDoorLock),
|
TextSize = 15,
|
TextAlignment = TextAlignment.Center,
|
};
|
midTopFrameLayout.AddChidren(btnDoorLockTitle);
|
|
var btnRecord = new Button()
|
{
|
Width = Application.GetRealWidth(69),
|
Height = Application.GetRealHeight(69),
|
X = Application.GetRealWidth(752),
|
Y = Application.GetRealHeight(46),
|
UnSelectedImagePath = "DoorLock/RecordIcon.png",
|
};
|
midTopFrameLayout.AddChidren(btnRecord);
|
btnRecord.MouseDownEventHandler += (sender, e) =>
|
{
|
var doorLock = new ZigBee.Device.DoorLock();
|
var doorLockRecord = new Shared.Phone.UserCenter.DoorLock.HistoryRecordPage(doorLock);
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(doorLockRecord);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
doorLockRecord.Show();
|
};
|
|
var btnCollect = new Button()
|
{
|
Width = Application.GetRealWidth(69),
|
Height = Application.GetRealHeight(69),
|
X = Application.GetRealWidth(850),
|
Y = Application.GetRealHeight(46),
|
UnSelectedImagePath = "DoorLock/FavoriteIcon.png",
|
};
|
midTopFrameLayout.AddChidren(btnCollect);
|
btnCollect.MouseDownEventHandler += (sender, e) =>
|
{
|
};
|
|
var btnCurrentText = new Button()
|
{
|
Width = Application.GetRealWidth(100),
|
Height = Application.GetRealHeight(40),
|
X = Application.GetRealWidth(415),
|
Y = Application.GetRealHeight(118),
|
Text = Language.StringByID(R.MyInternationalizationString.Current),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
TextSize = 10,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
midTopFrameLayout.AddChidren(btnCurrentText);
|
|
var btnStatus = new Button()
|
{
|
Width = Application.GetRealWidth(200),
|
Height = Application.GetRealHeight(40),
|
X = btnCurrentText.Right,
|
Y = Application.GetRealHeight(118),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
Text = Language.StringByID(R.MyInternationalizationString.CLose),
|
TextSize = 10,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
midTopFrameLayout.AddChidren(btnStatus);
|
|
var btnDoorLockPic = new Button()
|
{
|
Width = Application.GetRealWidth(383),
|
Height = Application.GetRealHeight(343),
|
X = Application.GetRealWidth(161),
|
Y = Application.GetRealHeight(415),
|
UnSelectedImagePath = "DoorLock/DoorLockPicClose.png",
|
SelectedImagePath = "DoorLock/DooorLockPicOpen.png",
|
};
|
midTopFrameLayout.AddChidren(btnDoorLockPic);
|
|
var btnFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(420 - 46),//639-35
|
Height = Application.GetRealHeight(446),
|
X = btnDoorLockPic.Right,
|
Y = Application.GetRealHeight(354),
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
midTopFrameLayout.AddChidren(btnFrameLayout);
|
|
var openFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(420),//639-35
|
Height = Application.GetRealHeight(446 / 2),
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
btnFrameLayout.AddChidren(openFrameLayout);
|
|
var closeFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(420),//639-35
|
Height = Application.GetRealHeight(446 / 2),
|
Y = Application.GetRealHeight(446 / 2),
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
btnFrameLayout.AddChidren(closeFrameLayout);
|
|
var progressFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(9),//639-35
|
Height = Application.GetRealHeight(446),
|
X = Application.GetRealWidth(95),
|
Y = Application.GetRealHeight(0),
|
BackgroundColor = ZigbeeColor.Current.XMVerticalSeekBar,
|
};
|
btnFrameLayout.AddChidren(progressFrameLayout);
|
|
var progressButton = new Button()
|
{
|
Width = Application.GetRealWidth(81),//639-35
|
Height = Application.GetRealHeight(89),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(347),
|
UnSelectedImagePath = "DoorLock/UnLockButton.png",
|
SelectedImagePath = "DoorLock/UnLockButton.png",
|
};
|
btnFrameLayout.AddChidren(progressButton);
|
|
var btnDoorOpenPic = new Button()
|
{
|
Width = Application.GetRealWidth(81),
|
Height = Application.GetRealHeight(81),
|
X = Application.GetRealWidth(164),
|
Y = Application.GetRealHeight(6),
|
UnSelectedImagePath = "DoorLock/DoorLockOpen.png",
|
};
|
openFrameLayout.AddChidren(btnDoorOpenPic);
|
|
var btnDoorClosePic = new Button()
|
{
|
Width = Application.GetRealWidth(81),
|
Height = Application.GetRealHeight(81),
|
X = Application.GetRealWidth(164),
|
Y = Application.GetRealHeight(117),
|
UnSelectedImagePath = "DoorLock/DoorLockClose.png",
|
};
|
closeFrameLayout.AddChidren(btnDoorClosePic);
|
|
var btnCurrentFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(965),
|
Height = Application.GetRealHeight(138),
|
Y = Application.GetRealHeight(1100),
|
BackgroundColor = ZigbeeColor.Current.XMBlack,
|
};
|
midTopFrameLayout.AddChidren(btnCurrentFrameLayout);
|
|
var btnCurrentRoomPic = new Button()
|
{
|
Width = Application.GetRealWidth(81),
|
Height = Application.GetRealHeight(81),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(29),
|
UnSelectedImagePath = "DoorLock/RoomPic.png",
|
};
|
btnCurrentFrameLayout.AddChidren(btnCurrentRoomPic);
|
|
var btnCurrentRoomName = new Button()
|
{
|
Width = Application.GetRealWidth(172),
|
Height = Application.GetRealHeight(49),
|
X = Application.GetRealWidth(150),
|
Y = Application.GetRealHeight(46),
|
Text = "客厅",
|
TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
TextSize = 12,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
btnCurrentFrameLayout.AddChidren(btnCurrentRoomName);
|
#endregion
|
|
EventHandler<MouseEventArgs> hander1 = async (sender, e) =>
|
{
|
RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus);
|
};
|
openFrameLayout.MouseUpEventHandler += hander1;
|
btnDoorOpenPic.MouseUpEventHandler += hander1;
|
EventHandler<MouseEventArgs> hander2 = (sender, e) =>
|
{
|
//new Tip() { MaxWidth = 150, Text = "不支持远程关锁", Direction = AMPopTipDirection.Down, CloseTime = 2 }.Show(openFrameLayout);
|
btnDoorLockPic.IsSelected = false;
|
progressButton.Y = Application.GetRealHeight(347);
|
};
|
closeFrameLayout.MouseUpEventHandler += hander2;
|
btnDoorClosePic.MouseUpEventHandler += hander2;
|
}
|
|
#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
|
}
|
}
|