using System;
using Shared.Common;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.DeviceBind
{
public class BindCommonLayout : FrameLayout
{
public BindCommonLayout()
{
}
#region ◆ 变量申明__________________________
public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout };
public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout };
public FrameLayout bottomRadiusFrameLayout = new FrameLayout()
{
Height = Application.GetRealHeight(100),
Y = Application.GetRealHeight(930),
Radius = 17,
BackgroundColor = ZigbeeColor.Current.XMWhite,
};
public FrameLayout titleFrameLayout = new FrameLayout
{
Y = Application.GetRealHeight(92),
X = Application.GetRealWidth(161),
Width = Application.GetRealWidth(1080 - 161),//919
Height = Application.GetRealHeight(69),
};
public Button btnTitle = new Button
{
TextAlignment = TextAlignment.CenterLeft,
TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
Width = Application.GetRealWidth(1080 - 161),//919
Height = Application.GetRealWidth(69),
TextSize = 17,
IsBold = true,
//X = Application.GetRealWidth(161 - 116),
};
///
/// 标题返回布局
///
public FrameLayout btnBackFrameLayout = new FrameLayout
{
Width = Application.GetRealWidth(58 * 2),//116
};
///
/// 标题返回按键
///
public Button btnBack = new Button
{
Height = Application.GetRealHeight(51),
Width = Application.GetRealWidth(30),
X = Application.GetRealWidth(58),
Y = Application.GetRealHeight(98),
UnSelectedImagePath = "DoorLock/Left.png",
};
///
/// 标题下线
///
public Button btnTitleLine = new Button
{
Y = Application.GetRealHeight(181),
Height = 1,
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine,
};
#endregion
///
/// 顶部布局
///
///
public void TopFrameLayout(FrameLayout frameLayout, string titleText)
{
this.AddChidren(topFrameLayout);
topFrameLayout.AddChidren(btnBackFrameLayout);
topFrameLayout.AddChidren(titleFrameLayout);
topFrameLayout.AddChidren(btnTitleLine);
btnBackFrameLayout.AddChidren(btnBack);
titleFrameLayout.AddChidren(btnTitle);
btnTitle.Text = titleText;
}
///
/// 门锁中部布局
///
///
public void MidFrameLayout(FrameLayout frameLayout)
{
//midFrameLayout.BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCBackgroundColor;
midFrameLayout.Y = topFrameLayout.Bottom;
this.AddChidren(midFrameLayout);
}
///
/// 门锁底部布局
///
///
public void BottomFrameLayout(FrameLayout frameLayout)
{
var bottomFrameLayout1 = new FrameLayout()
{
Height = Application.GetRealHeight(806 - 50),
Y = Application.GetRealHeight(930 + 48),
BackgroundColor = ZigbeeColor.Current.XMWhite,
};
this.midFrameLayout.AddChidren(bottomFrameLayout1);
}
public Action FloorAction = null;
///
/// 添加楼层UI
///
public void BindDownFrameLayout(FrameLayout frameLayout, ref Button btnFloorText)
{
var btnAddFrameLayout = new FrameLayout
{
X = Application.GetRealWidth(619),
};
this.titleFrameLayout.AddChidren(btnAddFrameLayout);
btnFloorText = new Button
{
Width = Application.GetRealWidth(300 - 69 - 58),
Text = Language.StringByID(R.MyInternationalizationString.FirstFloor),
TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
TextSize = 14,
IsBold = true,
TextAlignment = TextAlignment.CenterRight,
};
btnAddFrameLayout.AddChidren(btnFloorText);
var btnBindDownFrameLayout = new FrameLayout
{
Width = Application.GetMinReal(69 + 58),
X = Application.GetRealWidth(300 - 69 - 58),
};
btnAddFrameLayout.AddChidren(btnBindDownFrameLayout);
var btnBindDown = new Button
{
Height = Application.GetMinReal(69),
Width = Application.GetMinReal(69),
UnSelectedImagePath = "BindPic/BindDown.png",
Gravity = Gravity.CenterVertical,
};
btnBindDownFrameLayout.AddChidren(btnBindDown);
EventHandler eHandlerBindDown = (sender, e) =>
{
FloorAction?.Invoke();
};
btnBindDown.MouseDownEventHandler += eHandlerBindDown;
btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown;
if (Common.Config.Instance.Home.FloorDics.Count == 0)
{
btnAddFrameLayout.Width = 0;
}
else
{
btnAddFrameLayout.Width = Application.GetRealWidth(300);
}
}
}
}