using System;
|
using System.Collections.Generic;
|
using System.Threading;
|
using HDL_ON.UI.CSS;
|
using Shared;
|
|
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
|
{
|
public class TipPopView
|
{
|
/// <summary>
|
/// 大框圆角值
|
/// </summary>
|
public int RradiusFrameLayout = 15;
|
/// <summary>
|
/// 小框圆角值
|
/// </summary>
|
public int radiusEditFrameLayout = 4;
|
/// <summary>
|
/// 输入框
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="tnputEditTxet">显示文本</param>
|
/// <param name="errorId_IsNullOrEmpty">输入框文本为空自定义提示错误文本</param>
|
/// <param name="errorId_PresenceP">检索已存在名称自定义提示错误文本</param>
|
/// <param name="confirmAction">回调函数</param>
|
/// <param name="List">被检索列表</param>
|
/// <param name="confirmAction">回调函数</param>
|
public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string,Dialog> confirmAction, Action action,bool tag=true)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout whiteView = new FrameLayout()
|
{
|
//Gravity = Gravity.Center,
|
X = Application.GetRealWidth(53),
|
Y = Application.GetRealHeight(264),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(172),
|
BackgroundColor = CSS_Color.view,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(whiteView);
|
|
Button btnTitle = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(35),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(200),
|
TextColor = CSS_Color.textConfirmColor,
|
TextSize = TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID = titleId,
|
|
};
|
whiteView.AddChidren(btnTitle);
|
|
FrameLayout editBjView = new FrameLayout()
|
{
|
// Gravity = Gravity.CenterHorizontal,
|
Y = btnTitle.Bottom + Application.GetRealHeight(16),
|
X = Application.GetRealWidth(24),
|
Width = Application.GetRealWidth(222),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.viewMiddle,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
|
};
|
whiteView.AddChidren(editBjView);
|
|
EditText editText = new EditText()
|
{
|
X = Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(10),
|
Width = Application.GetRealWidth(160),
|
Height = Application.GetRealHeight(20),
|
Text = tnputEditTxet,
|
TextColor = CSS_Color.textColor,
|
TextSize = TextSize.text14,
|
TextAlignment = TextAlignment.CenterLeft,
|
|
};
|
editBjView.AddChidren(editText);
|
|
Button clearIconBtn = new Button
|
{
|
X = Application.GetRealWidth(194),
|
Y = Application.GetRealHeight(8),
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
UnSelectedImagePath = "MusicIcon/clear.png",
|
};
|
editBjView.AddChidren(clearIconBtn);
|
clearIconBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
editText.Text = "";
|
};
|
|
Button btnLine = new Button()
|
{
|
Y = whiteView.Height - Application.GetRealHeight(44 + 1),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
whiteView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text16,
|
TextID = StringId.cancelMusic,
|
Gravity = Gravity.BottomLeft,
|
};
|
whiteView.AddChidren(btnCancel);
|
btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
|
Button btnConfirm = new Button()
|
{
|
X = btnCancel.Right,
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.view,
|
IsBold = true,
|
TextSize = TextSize.text16,
|
TextID = StringId.confirmMusic,
|
BackgroundColor = CSS_Color.textConfirmColor,
|
Gravity = Gravity.BottomRight,
|
};
|
whiteView.AddChidren(btnConfirm);
|
btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
|
|
dialog.Show();
|
btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
dialog.Close();
|
action();
|
|
};
|
Button btnTip = new Button
|
{
|
Width = Application.GetRealWidth(0),
|
};
|
whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
string listNameText = editText.Text.Trim();
|
if (string.IsNullOrEmpty(listNameText) || List.Contains(listNameText))
|
{
|
string tipMsgString = "";
|
if (string.IsNullOrEmpty(editText.Text.Trim()))
|
{
|
tipMsgString = Language.StringByID(errorId_IsNullOrEmpty);
|
}
|
else
|
{
|
tipMsgString = Language.StringByID(errorId_PresenceP);
|
}
|
|
whiteView.Height = Application.GetRealHeight(183);
|
btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
|
btnCancel.Y = btnLine.Bottom;
|
btnCancel.Gravity = Gravity.BottomLeft;
|
btnConfirm.Y = btnLine.Bottom;
|
btnConfirm.Gravity = Gravity.BottomRight;
|
|
btnTip.X = Application.GetRealWidth(24);
|
btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
|
btnTip.Width = Application.GetRealWidth(222);
|
btnTip.Height = Application.GetRealHeight(17);
|
btnTip.Text = tipMsgString;
|
btnTip.TextColor = CSS_Color.textRedColor;
|
btnTip.TextSize = TextSize.text12;
|
btnTip.TextAlignment = TextAlignment.CenterLeft;
|
|
return;
|
}
|
|
|
confirmAction(editText.Text.Trim(),dialog);
|
if (tag) {
|
dialog.Close();
|
}
|
};
|
|
}
|
|
/// <summary>
|
/// 输入框
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="tnputEditTxet">显示文本</param>
|
/// <param name="errorId_IsNullOrEmpty">输入框本文为空自定义提示错误文本</param>
|
/// <param name="confirmAction">回调函数</param>
|
public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction,Action action)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout whiteView = new FrameLayout()
|
{
|
//Gravity = Gravity.Center,
|
X = Application.GetRealWidth(53),
|
Y = Application.GetRealHeight(264),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(172),
|
BackgroundColor = CSS_Color.view,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(whiteView);
|
|
Button btnTitle = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(35),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(200),
|
TextColor = CSS_Color.textConfirmColor,
|
TextSize = TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID = titleId,
|
|
};
|
whiteView.AddChidren(btnTitle);
|
|
FrameLayout editBjView = new FrameLayout()
|
{
|
// Gravity = Gravity.CenterHorizontal,
|
Y = btnTitle.Bottom + Application.GetRealHeight(16),
|
X = Application.GetRealWidth(24),
|
Width = Application.GetRealWidth(222),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.viewMiddle,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
|
};
|
whiteView.AddChidren(editBjView);
|
|
EditText editText = new EditText()
|
{
|
X = Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(10),
|
Width = Application.GetRealWidth(160),
|
Height = Application.GetRealHeight(20),
|
Text = tnputEditTxet,
|
TextColor = CSS_Color.textColor,
|
TextSize = TextSize.text14,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
editBjView.AddChidren(editText);
|
|
|
Button clearIconBtn = new Button
|
{
|
X = Application.GetRealWidth(194),
|
Y = Application.GetRealHeight(8),
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
UnSelectedImagePath = "MusicIcon/clear.png",
|
};
|
editBjView.AddChidren(clearIconBtn);
|
clearIconBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
editText.Text = "";
|
};
|
|
Button btnLine = new Button()
|
{
|
Y = whiteView.Height - Application.GetRealHeight(44 + 1),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
whiteView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text16,
|
TextID = StringId.cancelMusic,
|
Gravity = Gravity.BottomLeft,
|
};
|
whiteView.AddChidren(btnCancel);
|
btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
|
|
Button btnConfirm = new Button()
|
{
|
X = btnCancel.Right,
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.view,
|
IsBold = true,
|
TextSize = TextSize.text16,
|
TextID = StringId.confirmMusic,
|
BackgroundColor = CSS_Color.textConfirmColor,
|
Gravity = Gravity.BottomRight,
|
};
|
whiteView.AddChidren(btnConfirm);
|
btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
|
dialog.Show();
|
btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
dialog.Close();
|
action();
|
|
};
|
|
Button btnTip = new Button
|
{
|
Width = Application.GetRealWidth(0),
|
};
|
whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
|
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
if (string.IsNullOrEmpty(editText.Text.Trim()))
|
{
|
|
whiteView.Height = Application.GetRealHeight(183);
|
btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
|
btnCancel.Y = btnLine.Bottom;
|
btnCancel.Gravity = Gravity.BottomLeft;
|
btnConfirm.Y = btnLine.Bottom;
|
btnConfirm.Gravity = Gravity.BottomRight;
|
|
btnTip.X = Application.GetRealWidth(24);
|
btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
|
btnTip.Width = Application.GetRealWidth(222);
|
btnTip.Height = Application.GetRealHeight(17);
|
btnTip.Text = Language.StringByID(errorId_IsNullOrEmpty);
|
btnTip.TextColor = CSS_Color.textRedColor;
|
btnTip.TextSize = TextSize.text12;
|
btnTip.TextAlignment = TextAlignment.CenterLeft;
|
return;
|
}
|
|
|
confirmAction(editText.Text.Trim());
|
dialog.Close();
|
};
|
|
}
|
|
/// <summary>
|
/// 输入框
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="tnputEditTxet">显示文本</param>
|
/// <param name="confirmAction">回调函数</param>
|
public void InputBox(int titleId, string tnputEditTxet, Action<string> confirmAction)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout whiteView = new FrameLayout()
|
{
|
//Gravity = Gravity.Center,
|
X = Application.GetRealWidth(53),
|
Y = Application.GetRealHeight(264),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(172),
|
BackgroundColor = CSS_Color.view,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(whiteView);
|
|
Button btnTitle = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(35),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(200),
|
TextColor = CSS_Color.textConfirmColor,
|
TextSize = TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID = titleId,
|
|
};
|
whiteView.AddChidren(btnTitle);
|
|
FrameLayout editBjView = new FrameLayout()
|
{
|
// Gravity = Gravity.CenterHorizontal,
|
Y = btnTitle.Bottom + Application.GetRealHeight(16),
|
X = Application.GetRealWidth(53),
|
Width = Application.GetRealWidth(157),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.viewMiddle,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(radiusEditFrameLayout),
|
};
|
whiteView.AddChidren(editBjView);
|
|
EditText editText = new EditText()
|
{
|
// X = Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(10),
|
Width = Application.GetRealWidth(157),
|
Height = Application.GetRealHeight(20),
|
Text = tnputEditTxet,
|
TextColor = CSS_Color.textColor,
|
TextSize = TextSize.text14,
|
TextAlignment = TextAlignment.Center,
|
IsNumberKeyboardType=true,
|
};
|
editBjView.AddChidren(editText);
|
|
Button btn_subtract = new Button
|
{
|
X = Application.GetRealWidth(17),
|
Y = Application.GetRealHeight(66),
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
UnSelectedImagePath = "LogicIcon/-.png",
|
};
|
whiteView.AddChidren(btn_subtract);
|
Button btn_add = new Button
|
{
|
X = Application.GetRealWidth(222),
|
Y = Application.GetRealHeight(66),
|
Width = Application.GetRealWidth(24),
|
Height = Application.GetRealWidth(24),
|
UnSelectedImagePath = "LogicIcon/+.png",
|
};
|
whiteView.AddChidren(btn_add);
|
btn_subtract.MouseUpEventHandler += (sender, e) =>
|
{
|
|
string editTextValue = editText.Text;
|
if (!string.IsNullOrEmpty(editTextValue))
|
{
|
int intValue = int.Parse(editTextValue);
|
if (intValue>1)
|
{
|
editText.Text = (intValue - 1).ToString();
|
|
}
|
}
|
|
};
|
btn_add.MouseUpEventHandler += (sender, e) =>
|
{
|
|
string editTextValue = editText.Text;
|
if (!string.IsNullOrEmpty(editTextValue))
|
{
|
int intValue = int.Parse(editTextValue);
|
if (intValue <100)
|
{
|
editText.Text = (intValue + 1).ToString();
|
}
|
}
|
};
|
|
Button btnLine = new Button()
|
{
|
Y = whiteView.Height - Application.GetRealHeight(44 + 1),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
whiteView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text16,
|
TextID = StringId.cancelMusic,
|
Gravity = Gravity.BottomLeft,
|
};
|
whiteView.AddChidren(btnCancel);
|
btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
|
|
Button btnConfirm = new Button()
|
{
|
X = btnCancel.Right,
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.view,
|
IsBold = true,
|
TextSize = TextSize.text16,
|
TextID = StringId.confirmMusic,
|
BackgroundColor = CSS_Color.textConfirmColor,
|
Gravity = Gravity.BottomRight,
|
};
|
whiteView.AddChidren(btnConfirm);
|
btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
|
dialog.Show();
|
btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
dialog.Close();
|
};
|
|
Button btnTip = new Button
|
{
|
Width = Application.GetRealWidth(0),
|
};
|
whiteView.AddChidren(btnTip);//一直错误,一直猛点,一直加控件
|
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
string errorId_IsNullOrEmpty = "";
|
if (string.IsNullOrEmpty(editText.Text.Trim()))
|
{
|
errorId_IsNullOrEmpty = Language.StringByID(StringId.nullvalue);
|
}
|
else
|
{
|
var editTextValue = editText.Text.Trim();
|
int intValue = int.Parse(editTextValue);
|
if (intValue <= 0 || intValue > 100)
|
{
|
errorId_IsNullOrEmpty = Language.StringByID(StringId.setvalue);
|
}
|
}
|
if (errorId_IsNullOrEmpty!="")
|
{
|
whiteView.Height = Application.GetRealHeight(183);
|
btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
|
btnCancel.Y = btnLine.Bottom;
|
btnCancel.Gravity = Gravity.BottomLeft;
|
btnConfirm.Y = btnLine.Bottom;
|
btnConfirm.Gravity = Gravity.BottomRight;
|
|
btnTip.X = Application.GetRealWidth(53);
|
btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
|
btnTip.Width = Application.GetRealWidth(157);//200
|
btnTip.Height = Application.GetRealHeight(24);//17
|
btnTip.Text = errorId_IsNullOrEmpty;
|
btnTip.TextColor = CSS_Color.textRedColor;
|
btnTip.TextSize = TextSize.text12;
|
btnTip.TextAlignment = TextAlignment.CenterLeft;
|
btnTip.IsMoreLines = true;
|
return;
|
}
|
|
confirmAction(editText.Text.Trim());
|
dialog.Close();
|
};
|
|
}
|
/// <summary>
|
/// 确定提示框
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="tipTxet">自定义提示文本</param>
|
/// <param name="confirmAction">回调函数</param>
|
public void TipBox(int titleId, int tipTxet, Action confirmAction)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout whiteView = new FrameLayout()
|
{
|
//Gravity = Gravity.Center,
|
X = Application.GetRealWidth(53),
|
Y = Application.GetRealHeight(264),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(140),
|
BackgroundColor = CSS_Color.view,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(whiteView);
|
|
Button titleBtn = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(35),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(270 - 35 * 2),
|
TextColor = CSS_Color.textConfirmColor,
|
TextSize = TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID = titleId,
|
};
|
whiteView.AddChidren(titleBtn);
|
|
Button tipBtn = new Button()
|
{
|
Y = titleBtn.Bottom + Application.GetRealHeight(8),
|
X = Application.GetRealWidth(20),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(270 - 20 * 2),
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text12,
|
TextAlignment = TextAlignment.Center,
|
TextID = tipTxet,
|
};
|
whiteView.AddChidren(tipBtn);
|
|
|
Button btnLine = new Button()
|
{
|
Y = whiteView.Height - Application.GetRealHeight(44 + 1),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
whiteView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text16,
|
TextID = StringId.cancelMusic,
|
Gravity = Gravity.BottomLeft,
|
};
|
whiteView.AddChidren(btnCancel);
|
btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
|
Button btnConfirm = new Button()
|
{
|
X = btnCancel.Right,
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.view,
|
IsBold = true,
|
TextSize = TextSize.text16,
|
TextID = StringId.confirmMusic,
|
BackgroundColor = CSS_Color.textConfirmColor,
|
Gravity = Gravity.BottomRight,
|
};
|
whiteView.AddChidren(btnConfirm);
|
btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
|
dialog.Show();
|
btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
dialog.Close();
|
};
|
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
confirmAction();
|
dialog.Close();
|
};
|
|
}
|
|
/// <summary>
|
/// 确定提示框
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="tipTxet">自定义提示文本</param>
|
/// <param name="confirmAction">回调函数</param>
|
public void TipBox(int titleId, string tipTxet, Action<Dialog> confirmAction,Action action,bool tag=true)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout whiteView = new FrameLayout()
|
{
|
//Gravity = Gravity.Center,
|
X = Application.GetRealWidth(53),
|
Y = Application.GetRealHeight(264),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(140),
|
BackgroundColor = CSS_Color.view,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(whiteView);
|
|
Button titleBtn = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(35),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(270 - 35 * 2),
|
TextColor = CSS_Color.textConfirmColor,
|
TextSize = TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID = titleId,
|
};
|
whiteView.AddChidren(titleBtn);
|
|
Button tipBtn = new Button()
|
{
|
Y = titleBtn.Bottom + Application.GetRealHeight(8),
|
X = Application.GetRealWidth(20),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(270 - 20 * 2),
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text12,
|
TextAlignment = TextAlignment.Center,
|
Text= tipTxet,
|
};
|
whiteView.AddChidren(tipBtn);
|
|
|
Button btnLine = new Button()
|
{
|
Y = whiteView.Height - Application.GetRealHeight(44 + 1),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
whiteView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text16,
|
TextID = StringId.cancelMusic,
|
Gravity = Gravity.BottomLeft,
|
};
|
whiteView.AddChidren(btnCancel);
|
btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
|
Button btnConfirm = new Button()
|
{
|
X = btnCancel.Right,
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.view,
|
IsBold = true,
|
TextSize = TextSize.text16,
|
TextID = StringId.confirmMusic,
|
BackgroundColor = CSS_Color.textConfirmColor,
|
Gravity = Gravity.BottomRight,
|
};
|
whiteView.AddChidren(btnConfirm);
|
btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
|
dialog.Show();
|
btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
action();
|
dialog.Close();
|
};
|
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
confirmAction(dialog);
|
if (tag) {
|
dialog.Close();
|
}
|
};
|
|
}
|
|
/// <summary>
|
/// 确定提示框
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="tipTxet">自定义提示文本(换行)</param>
|
/// <param name="confirmAction">回调函数</param>
|
public void TipBox1(int titleId, int tipTxet, Action confirmAction)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout whiteView = new FrameLayout()
|
{
|
//Gravity = Gravity.Center,
|
X = Application.GetRealWidth(53),
|
Y = Application.GetRealHeight(264),
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(155),
|
BackgroundColor = CSS_Color.view,
|
BorderColor = CSS_Color.viewTranslucence,
|
BorderWidth = 0,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(whiteView);
|
|
Button titleBtn = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
X = Application.GetRealWidth(35),
|
Height = Application.GetRealHeight(22),
|
Width = Application.GetRealWidth(270 - 35 * 2),
|
TextColor = CSS_Color.textConfirmColor,
|
TextSize = TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID = titleId,
|
};
|
whiteView.AddChidren(titleBtn);
|
|
Button tipBtn = new Button()
|
{
|
Y = titleBtn.Bottom + Application.GetRealHeight(8),
|
X = Application.GetRealWidth(20),
|
Height = Application.GetRealHeight(22 + 15),
|
Width = Application.GetRealWidth(270 - 20 * 2),
|
TextColor = CSS_Color.textTipColor,
|
TextSize = TextSize.text12,
|
TextAlignment = TextAlignment.Center,
|
Text = Language.StringByID(tipTxet).Replace("{\\r\\n}", "\r\n"),
|
IsMoreLines = true,
|
};
|
whiteView.AddChidren(tipBtn);
|
|
|
Button btnLine = new Button()
|
{
|
Y = whiteView.Height - Application.GetRealHeight(44 + 1),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
whiteView.AddChidren(btnLine);
|
|
Button btnCancel = new Button()
|
{
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.viewLine,
|
TextSize = TextSize.text16,
|
TextID = StringId.cancelMusic,
|
Gravity = Gravity.BottomLeft,
|
};
|
whiteView.AddChidren(btnCancel);
|
btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
|
Button btnConfirm = new Button()
|
{
|
X = btnCancel.Right,
|
Y = btnLine.Bottom,
|
Width = Application.GetRealWidth(135),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.view,
|
IsBold = true,
|
TextSize = TextSize.text16,
|
TextID = StringId.confirmMusic,
|
BackgroundColor = CSS_Color.textConfirmColor,
|
Gravity = Gravity.BottomRight,
|
};
|
whiteView.AddChidren(btnConfirm);
|
btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
|
dialog.Show();
|
btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
dialog.Close();
|
};
|
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
confirmAction();
|
dialog.Close();
|
};
|
|
}
|
|
/// <summary>
|
/// 信息提示窗口,自动关闭
|
/// </summary>
|
/// <param name="msg">提示错误文本</param>
|
public void FlashingBox(string msg,int time=2)
|
{
|
new PublicAssmebly().TipMsgAutoClose(msg, false, time*1000);
|
}
|
|
/// <summary>
|
/// 错误信息提示窗口,手动确定关闭
|
/// </summary>
|
/// <param name="titleId">标题文本</param>
|
/// <param name="msgId">提示错误文本</param>
|
public void TipBox(int titleId, int msgId)
|
{
|
Dialog dialog = new Dialog()
|
{
|
BackgroundColor = CSS_Color.viewTrans60lucence,
|
};
|
|
FrameLayout contentView = new FrameLayout()
|
{
|
Gravity = Gravity.Center,
|
Width = Application.GetRealWidth(270),
|
Height = Application.GetRealHeight(140),
|
BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
|
};
|
dialog.AddChidren(contentView);
|
|
Button btnTitle = new Button()
|
{
|
Y = Application.GetRealHeight(20),
|
Height = Application.GetRealHeight(22),
|
TextColor = CSS_Color.MainColor,
|
TextSize = LogicView.TextSize.text16,
|
TextAlignment = TextAlignment.Center,
|
TextID= titleId,
|
};
|
contentView.AddChidren(btnTitle);
|
|
Button btnMsg = new Button()
|
{
|
Height = Application.GetRealHeight(17),
|
Y = Application.GetRealHeight(50),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.TextualColor,
|
TextSize = LogicView.TextSize.text12,
|
TextID = msgId,
|
};
|
contentView.AddChidren(btnMsg);
|
|
Button btnLine = new Button()
|
{
|
Y = Application.GetRealHeight(96),
|
Height = Application.GetRealHeight(1),
|
BackgroundColor = CSS_Color.viewLine,
|
};
|
contentView.AddChidren(btnLine);
|
|
Button btnConfirm = new Button()
|
{
|
Y = btnLine.Bottom,
|
Height = Application.GetRealHeight(43),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.MainColor,
|
TextSize = TextSize.text16,
|
TextID = StringId.Close,
|
};
|
contentView.AddChidren(btnConfirm);
|
dialog.Show();
|
btnConfirm.MouseUpEventHandler += (sender, e) =>
|
{
|
dialog.Close();
|
};
|
|
}
|
}
|
}
|