using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace BWP.WinFormControl
|
|
{
|
|
public partial class UMessageBox : Form
|
|
{
|
|
private int mCloseMin = 0;
|
|
public static void Show(string msg, int closeMin = 0)
|
|
{
|
|
new UMessageBox(msg, closeMin).ShowDialog();
|
|
}
|
|
|
|
public static void Show(string msg, string title, int closeMin = 0)
|
|
{
|
|
new UMessageBox(msg, title, closeMin).ShowDialog();
|
|
}
|
|
|
|
private UMessageBox(string msg,int closeMin=0)
|
|
{
|
|
InitializeComponent();
|
|
this.msgLabel.Text = msg;
|
|
mCloseMin = closeMin;
|
|
}
|
|
|
|
private UMessageBox(string msg, string title, int closeMin = 0)
|
|
{
|
|
InitializeComponent();
|
|
this.msgLabel.Text = msg;
|
|
this.Text = title;
|
|
mCloseMin = closeMin;
|
|
}
|
|
|
|
private void OKBtn_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void UMessageBox_Load(object sender, EventArgs e)
|
|
{
|
|
if (mCloseMin > 0)
|
|
{
|
|
var timer = new Timer();
|
|
timer.Enabled = true;
|
|
timer.Interval = mCloseMin * 1000;
|
|
timer.Tick += delegate
|
|
{
|
|
this.Close();
|
|
};
|
|
timer.Start();
|
|
}
|
|
}
|
|
}
|
|
}
|