using System;
|
using Shared.Common;
|
|
namespace Shared.Phone.Device.CommonForm
|
{
|
public class CustomAlert : FrameLayout
|
{
|
/// <summary>
|
/// CancleBtn
|
/// </summary>
|
public Button CancleBtn;
|
/// <summary>
|
/// ComfrimBtn
|
/// </summary>
|
public Button ComfrimBtn;
|
/// <summary>
|
/// ResultEventHandler
|
/// </summary>
|
public Action<bool> ResultEventHandler;
|
|
public CustomAlert()
|
{
|
Width = Application.GetRealWidth(1080);
|
Height = Application.GetRealHeight(1920);
|
}
|
|
/// <summary>
|
/// Show
|
/// </summary>
|
/// <param name="tip"></param>
|
/// <param name="message"></param>
|
/// <param name="cancle"></param>
|
/// <param name="comfirm"></param>
|
public void Show(string tip,string message,string cancle,string comfirm)
|
{
|
var tipBackGround = new FrameLayout
|
{
|
BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
|
};
|
AddChidren(tipBackGround);
|
|
var tipView = new FrameLayout
|
{
|
Height = Application.GetRealHeight(478),
|
Width = Application.GetRealWidth(792),
|
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
|
Radius = (uint)Application.GetRealHeight(30),
|
Gravity = Gravity.Center
|
};
|
tipBackGround.AddChidren(tipView);
|
|
var tipBtn = new Button
|
{
|
Y=Application.GetRealHeight(69),
|
Width=Application.GetRealWidth(500),
|
Height=Application.GetRealHeight(63),
|
Gravity=Gravity.CenterHorizontal,
|
TextColor=ZigbeeColor.Current.GXCTextBlackColor,
|
TextSize=15,
|
Text=tip
|
};
|
tipView.AddChidren(tipBtn);
|
|
var messageBtn = new Button
|
{
|
Y = Application.GetRealHeight(180),
|
Width = Application.GetRealWidth(674),
|
Height = Application.GetRealHeight(140),
|
Gravity = Gravity.CenterHorizontal,
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
TextSize = 15,
|
Text = message,
|
IsMoreLines=true
|
};
|
tipView.AddChidren(messageBtn);
|
|
CancleBtn = new Button
|
{
|
Y = Application.GetRealHeight(351),
|
Width = Application.GetRealWidth(396),
|
Height = Application.GetRealHeight(127),
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
TextSize = 15,
|
BackgroundColor=ZigbeeColor.Current.GXCButtonUnSelectedColor3,
|
Text = cancle
|
};
|
tipView.AddChidren(CancleBtn);
|
|
ComfrimBtn = new Button
|
{
|
X = Application.GetRealWidth(396),
|
Y = Application.GetRealHeight(351),
|
Width = Application.GetRealWidth(396),
|
Height = Application.GetRealHeight(127),
|
TextColor = ZigbeeColor.Current.GXCTextGrayColor,
|
TextSize = 15,
|
BackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
|
Text = comfirm
|
};
|
tipView.AddChidren(ComfrimBtn);
|
|
CancleBtn.MouseUpEventHandler = (sender, e) =>
|
{
|
RemoveFromParent();
|
ResultEventHandler?.Invoke(false);
|
};
|
|
ComfrimBtn.MouseUpEventHandler = (sender, e) =>
|
{
|
RemoveFromParent();
|
ResultEventHandler?.Invoke(true);
|
};
|
}
|
/// <summary>
|
/// Show
|
/// </summary>
|
/// <param name="message"></param>
|
public void Show(string message)
|
{
|
Show(Language.StringByID(R.MyInternationalizationString.TIP), message, Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim));
|
}
|
|
}
|
}
|