You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
4.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using POSV.Component;
namespace POSV
{
public partial class MDialogForm : BusinessForm
{
public MDialogForm()
{
InitializeComponent();
}
public MDialogForm(string content) : this()
{
this.Text = this.controlBox.Text = "消息提示";
this.lblContent.Text = content;
//this.lblContent.Symbol = "\uf05a";
//this.controlBox.ForeColor = Color.White;
}
public MDialogForm(string title , string content) : this(content)
{
this.Text = this.controlBox.Text = title;
}
public MDialogForm(string title , string content , MessageBoxIcon icon) : this(title , content)
{
switch (icon)
{
case MessageBoxIcon.Information:
//this.lblContent.Symbol = "\uf05a";
break;
case MessageBoxIcon.Warning:
//this.lblContent.Symbol = "\uf06a";
break;
case MessageBoxIcon.Question:
//this.lblContent.Symbol = "\uf059";
break;
case MessageBoxIcon.Error:
//this.lblContent.Symbol = "\uf057";
break;
default:
//this.lblContent.Symbol = "\uf05a";
break;
}
}
public MDialogForm(string title , string content , MessageBoxIcon icon , MessageBoxButtons buttons) : this(title , content , icon)
{
switch (buttons)
{
case MessageBoxButtons.YesNo:
this.ButtonOK.Text = "是";
this.ButtonClose.Text = "否";
break;
case MessageBoxButtons.YesNoCancel:
case MessageBoxButtons.OKCancel:
this.ButtonOK.Text = "确定";
this.ButtonClose.Text = "取消";
break;
case MessageBoxButtons.OK:
this.ButtonOK.Text = "确定";
this.ButtonClose.Visible = false;
this.ButtonOK.Dock = DockStyle.Fill;
break;
case MessageBoxButtons.RetryCancel:
this.ButtonOK.Text = "再查一次";
this.ButtonClose.Text = "更换支付";
break;
case MessageBoxButtons.AbortRetryIgnore:
default:
this.ButtonOK.Visible = false;
this.ButtonClose.Text = "关闭";
this.ButtonClose.Dock = DockStyle.Fill;
break;
}
}
public static void ShowAlert(IWin32Window owner, string title, string message)
{
var dialog = new MDialogForm(title, message, MessageBoxIcon.Information, MessageBoxButtons.OK);
dialog.ShowDialog(owner);
}
private void OnEscapeTouchClick(object sender, TouchEventArgs e)
{
if (sender is ControlBox)
{
ControlBox item = (ControlBox)sender;
switch (item.Action)
{
case ControlBoxEventAction.Closed:
this.DialogResult = DialogResult.No;
break;
}
}
else
{
TouchButtonX item = (TouchButtonX)sender;
if ("否".Equals(item.Text.Trim()))
{
this.DialogResult = DialogResult.No;
}
else
{
this.DialogResult = DialogResult.Cancel;
}
}
}
private void OnEnterTouchClick(object sender, TouchEventArgs e)
{
TouchButtonX item = (TouchButtonX)sender;
if ("是".Equals(item.Text.Trim()))
{
this.DialogResult = DialogResult.Yes;
}
else if ("再查一次".Equals(item.Text.Trim()))
{
this.DialogResult = DialogResult.Retry;
}
else
{
this.DialogResult = DialogResult.OK;
}
}
}
}