using DevExpress.XtraEditors;
using System.Windows.Forms;
namespace TsSFCDevice.Client.Launch
{
///
/// Xtra消息弹框处理
///
public static class XtraMessageBoxHelper
{
public static DialogResult Ask(string text, string caption = "询问", bool allowHtmlText = true, System.Action act = null)
{
act?.Invoke();
if (!text.Contains(""))
{
text = $"{text}";
}
return XtraMessageBox.Show(text, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, allowHtmlText: allowHtmlText ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False);
}
public static DialogResult AskYesNo(string text, string caption = "询问", bool allowHtmlText = true, System.Action act = null)
{
act?.Invoke();
if (!text.Contains(""))
{
text = $"{text}";
}
return XtraMessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, allowHtmlText: allowHtmlText ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False);
}
public static DialogResult Info(string text, string caption = "信息", bool allowHtmlText = true, System.Action act = null)
{
act?.Invoke();
if (!text.Contains(""))
{
text = $"{text}";
}
return XtraMessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Information, allowHtmlText: allowHtmlText ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False);
}
public static DialogResult Error(string text, string caption = "错误", bool allowHtmlText = true, System.Action act = null)
{
act?.Invoke();
if (!text.Contains(""))
{
text = $"{text}";
}
return XtraMessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Error, allowHtmlText: allowHtmlText ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False);
}
public static DialogResult Warn(string text, string caption = "警告", bool allowHtmlText = true, System.Action act = null)
{
act?.Invoke();
if (!text.Contains(""))
{
text = $"{text}";
}
return XtraMessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning, allowHtmlText: allowHtmlText ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False);
}
}
}