using System;
|
using Shared.Common;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.UserCenter.DoorLock
|
{
|
public class FunctionSetting : DoorLockCommonLayout, ZigBee.Common.IStatus
|
{
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="doorLock"></param>
|
public FunctionSetting(ZigBee.Device.DoorLock doorLock)
|
{
|
this.doorLock = doorLock;
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
|
ZigBee.Device.ZbGateway.StatusList.Add(this);
|
}
|
|
#region ◆ 变量申明__________________________
|
ZigBee.Device.DoorLock doorLock;
|
#endregion
|
|
/// <summary>
|
/// UI显示
|
/// </summary>
|
public void Show()
|
{
|
this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.FunctionSetting));
|
|
EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
|
{
|
RemoveFromParent();
|
};
|
this.btnBack.MouseUpEventHandler += eHandlerBack;
|
this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
|
this.MidFrameLayout(this);
|
|
MidFrameLayoutContent();
|
|
}
|
|
public void MidFrameLayoutContent()
|
{
|
|
var MidTopFrameLayout = new FrameLayout()
|
{
|
X = Application.GetRealWidth(449),
|
Y = Application.GetRealHeight(58),
|
Width = Application.GetRealWidth(184),
|
Height = Application.GetRealHeight(184),
|
BackgroundImagePath = "DoorLock/DoorlockPicture.png",
|
};
|
this.midFrameLayout.AddChidren(MidTopFrameLayout);
|
BottomFrameLayout();
|
}
|
|
public void BottomFrameLayout()
|
{
|
#region UI
|
var bottomFrameLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(100),
|
Y = Application.GetRealHeight(418),
|
Radius = 17,
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
this.midFrameLayout.AddChidren(bottomFrameLayout);
|
|
var bottomFrameLayout1 = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(1319 - 50),
|
Y = Application.GetRealHeight(418 + 48),
|
BackgroundColor = ZigbeeColor.Current.XMWhite,
|
};
|
this.midFrameLayout.AddChidren(bottomFrameLayout1);
|
|
var bottomFrameLayout2 = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(1319),
|
Y = Application.GetRealHeight(418),
|
};
|
this.midFrameLayout.AddChidren(bottomFrameLayout2);
|
|
var informationEdit = new Button()
|
{
|
Height = Application.GetRealHeight(60),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(81),
|
Text = Language.StringByID(R.MyInternationalizationString.InformationEdit),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = 12,
|
};
|
bottomFrameLayout2.AddChidren(informationEdit);
|
|
for (int i = 0; i < 7; i++)
|
{
|
var bottomRowLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(58),
|
};
|
bottomFrameLayout2.AddChidren(bottomRowLayout);
|
|
var btnName = new Button()
|
{
|
Width = Application.GetRealWidth(233),
|
Height = Application.GetRealHeight(58),
|
X = Application.GetRealWidth(58),
|
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = 12,
|
};
|
bottomRowLayout.AddChidren(btnName);
|
|
var btnNextFrameLayout = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(104),
|
Height = Application.GetRealHeight(58),
|
X = Application.GetRealWidth(861 + 58),
|
};
|
bottomRowLayout.AddChidren(btnNextFrameLayout);
|
|
var btnNext = new Button()
|
{
|
Width = Application.GetRealWidth(58),
|
Height = Application.GetRealHeight(58),
|
};
|
btnNextFrameLayout.AddChidren(btnNext);
|
|
var btnLine = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(965),
|
Height = Application.GetRealHeight(5),
|
X = Application.GetRealWidth(58),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
|
Visible = false,
|
};
|
bottomFrameLayout2.AddChidren(btnLine);
|
|
if (i == 0)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(204);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.DeviceRemarkXm) + ":";
|
btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58);
|
btnNextFrameLayout.X = btnName.Right;
|
btnNext.TextAlignment = TextAlignment.CenterLeft;
|
btnNext.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
btnNext.Text = doorLock.DeviceName;
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(308);
|
}
|
else if (i == 1)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(343);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.BelongZone) + ":";
|
var btnArea = new Button()
|
{
|
Width = Application.GetRealWidth(789 - 109 - 58),
|
Height = Application.GetRealHeight(58),
|
X = btnName.Right,
|
Y = btnName.Y,
|
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
|
Text = "一楼,客厅",
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
bottomRowLayout.AddChidren(btnArea);
|
btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(446);
|
}
|
else if (i == 2)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(481);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.BelongModel) + ":";
|
btnNextFrameLayout.Width = btnNext.Width = Application.GetRealWidth(789 - 58);
|
btnNextFrameLayout.X = btnName.Right;
|
|
btnNext.TextAlignment = TextAlignment.CenterLeft;
|
btnNext.Height = Application.GetRealHeight(58);
|
btnNext.Text = "HDL-Doorlock";
|
btnNext.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(1025 - 449);
|
}
|
else if (i == 3)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(585 + 35);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.TemporaryPassword);
|
|
btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
|
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(619 + 58 + 35);
|
}
|
else if (i == 4)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(723 + 35);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.RemotelyUnlock);
|
btnNext.Width = Application.GetRealWidth(104);
|
btnNext.Height = Application.GetRealHeight(63);
|
btnNext.UnSelectedImagePath = "DoorLock/Switch.png";
|
btnNext.SelectedImagePath = "DoorLock/SwitchOn.png";
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(723 + 127);
|
if (ZigBee.Device.DoorLock.RemoteUnlockPassword == "")
|
{
|
btnNext.IsSelected = false;
|
}
|
else
|
{
|
btnNext.IsSelected = true;
|
}
|
}
|
else if (i == 5)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(861 + 35);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.DoorLockTime);
|
btnNextFrameLayout.Y = btnName.Y;
|
btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(861 + 127);
|
}
|
else if (i == 6)
|
{
|
bottomRowLayout.Y = Application.GetRealHeight(999 + 35);
|
btnName.Text = Language.StringByID(R.MyInternationalizationString.Shared);
|
btnNext.UnSelectedImagePath = "DoorLock/RightIcon.png";
|
btnLine.Visible = true;
|
btnLine.Y = Application.GetRealHeight(999 + 127);
|
}
|
int currentIndex = i;
|
EventHandler<MouseEventArgs> eHandler = (sender, e) =>
|
{
|
if (currentIndex == 1)
|
{
|
}
|
else if (currentIndex == 3)
|
{
|
var temporaryPassword = new Shared.Phone.UserCenter.DoorLock.TemporaryPassword(doorLock);
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(temporaryPassword);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
temporaryPassword.Show();
|
}
|
else if (currentIndex == 4)
|
{
|
btnNext.IsSelected = !btnNext.IsSelected;
|
if (btnNext.IsSelected)
|
{
|
if (ZigBee.Device.DoorLock.RemoteUnlockPassword == "")
|
{
|
RemotePasswordDialog(doorLock, btnNext);
|
}
|
}
|
else
|
{
|
ZigBee.Device.DoorLock.RemoteUnlockPassword = "";
|
}
|
}
|
else if (currentIndex == 5)
|
{
|
var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime");
|
Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage);
|
Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
|
tempPage.Show();
|
}
|
else if (currentIndex == 6)
|
{
|
}
|
};
|
bottomRowLayout.MouseDownEventHandler += eHandler;
|
btnNext.MouseDownEventHandler += eHandler;
|
btnName.MouseDownEventHandler += eHandler;
|
btnNextFrameLayout.MouseDownEventHandler += 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
|
}
|
}
|