using System;
|
using Shared.Common;
|
using ZigBee.Device;
|
namespace Shared.Phone.UserCenter.DoorLock
|
{
|
public class MasterManagementPage : DoorLockCommonLayout, ZigBee.Common.IStatus
|
{
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="doorLock"></param>
|
public MasterManagementPage(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj)
|
{
|
this.doorLock = doorLock;
|
this.accountObj = accountObj;
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
|
}
|
|
#region ◆ 变量申明__________________________
|
ZigBee.Device.DoorLock doorLock;
|
Shared.Phone.UserCenter.MemberInfoRes accountObj;
|
#endregion
|
|
void ReadDoorLockUserInfo()
|
{
|
System.Threading.Tasks.Task.Run(async () =>
|
{
|
Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
|
try
|
{
|
await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocaDoorLocklist(doorLock, accountObj);
|
}
|
catch { }
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
MidFrameLayoutContent();
|
CommonPage.Loading.Hide();
|
});
|
}
|
});
|
}
|
|
/// <summary>
|
/// UI显示
|
/// </summary>
|
public void Show()
|
{
|
string accountTitle = "";
|
if (accountObj.UserName != null)
|
{
|
accountTitle = accountObj.UserName;
|
}
|
else
|
{
|
accountTitle = accountObj.Account;
|
}
|
this.TopFrameLayout(this, accountTitle);
|
|
EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
|
{
|
RemoveFromParent();
|
};
|
this.btnBack.MouseUpEventHandler += eHandlerBack;
|
this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
|
this.MidFrameLayout(this);
|
ReadDoorLockUserInfo();
|
}
|
|
public void MidFrameLayoutContent()
|
{
|
var bodyView = new VerticalScrolViewLayout()
|
{
|
};
|
this.midFrameLayout.AddChidren(bodyView);
|
|
for (int i = 0; i < 2; i++)
|
{
|
var RowView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(161),
|
};
|
bodyView.AddChidren(RowView);
|
|
var btnMemberName = new Button()
|
{
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(58),
|
Width = Application.GetRealWidth(743),
|
Height = Application.GetRealHeight(58),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = 14,
|
};
|
RowView.AddChidren(btnMemberName);
|
|
var btnRight = new Button()
|
{
|
X = Application.GetRealWidth(58 + 899),
|
Y = Application.GetRealHeight(58),
|
Height = Application.GetRealHeight(58),
|
Width = Application.GetRealWidth(58),
|
UnSelectedImagePath = "Item/Next.png",
|
SelectedImagePath = "Item/Down.png",
|
};
|
RowView.AddChidren(btnRight);
|
|
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);
|
|
int currentIndex = i;
|
if (i == 0)
|
{
|
btnMemberName.Text = Language.StringByID(R.MyInternationalizationString.LockMethod);
|
}
|
else
|
{
|
btnMemberName.Text = Language.StringByID(R.MyInternationalizationString.LinkageEvent);
|
}
|
|
EventHandler<MouseEventArgs> eHandler = (sender, e) =>
|
{
|
if (currentIndex == 0)
|
{
|
var unLockMethod = new Shared.Phone.UserCenter.DoorLock.UnLockMethod(doorLock, accountObj);
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(unLockMethod);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
unLockMethod.Show();
|
}
|
else
|
{
|
///备注:WJC的
|
///记录当前用户信息
|
Phone.Device.Logic.Send.UserMemberInfoRes = accountObj;
|
Phone.Device.Logic.Send.CurrentDoorLock = doorLock;
|
if (accountObj == null)
|
{
|
///防止抛异常
|
Phone.Device.Logic.Send.UserMemberInfoRes = new MemberInfoRes();
|
}
|
if (doorLock == null)
|
{
|
///防止抛异常
|
Phone.Device.Logic.Send.CurrentDoorLock = new ZigBee.Device.DoorLock();
|
}
|
///进来刷新一次设备列表;
|
Common.Logic.LogicDviceList.Clear();
|
if (Common.Logic.LogicDviceList.Count == 0)
|
{
|
Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
|
}
|
var doorLockLogicList = new Phone.Device.Logic.DoorLockLogic.LockLogicList();
|
UserView.HomePage.Instance.AddChidren(doorLockLogicList);
|
UserView.HomePage.Instance.PageIndex += 1;
|
doorLockLogicList.Show();
|
}
|
};
|
btnRight.MouseUpEventHandler += eHandler;
|
RowView.MouseUpEventHandler += eHandler;
|
}
|
}
|
|
#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
|
}
|
}
|