using System.ComponentModel;
using System.Threading;
using DevExpress.XtraEditors;
using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames;
namespace Gs.DevApp.UserControl
{
public partial class ShowDialogForm : XtraForm
{
#region Events
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
}
#endregion
#region Fields & Properties
///
/// 标题
///
public string Caption { get; set; }
///
/// 消息
///
public string Message { get; set; }
///
/// 描述
///
public string Content { get; set; }
///
/// 进度条最小值
///
public int MinProcess { get; set; } = 1;
///
/// 进度条最大值
///
public int MaxProcess { get; set; } = 100;
#endregion
#region Constructed Function
public ShowDialogForm()
{
InitializeComponent();
}
///
/// 设置
///
/// 提示
public ShowDialogForm(string _caption)
: this(_caption, "", "", 100)
{
}
///
/// 设置
///
///
///
public ShowDialogForm(string _caption, string _message)
: this(_caption, _message, "", 100)
{
}
///
/// 设置
///
///
///
///
public ShowDialogForm(string _caption, string _message, string _content)
: this(_caption, _message, _content, 100)
{
}
///
/// 设置
///
/// 提示
/// 消息内容
/// 详细描述
/// 进度条最大值
public ShowDialogForm(string _caption, string _message, string _content,
int _maxProcess)
: this()
{
Caption = "";
Message = "";
Content = "";
Caption = _caption == "" ? "提示" : _caption;
Message = _message == "" ? "正在加载,请稍后......" : _message;
Content = _content;
MaxProcess = _maxProcess > MinProcess ? _maxProcess : MinProcess;
lblCaption.Text = Caption;
// lblMessage.Text = this.Message;
lblContent.Text = Content;
progressShow.Properties.Minimum = MinProcess;
progressShow.Properties.Maximum = MaxProcess;
progressShow.Properties.Step = 1;
progressShow.PerformStep();
ShowInTaskbar = false;
TopMost = true;
Show();
Refresh();
}
#endregion
#region Methods
///
/// 设置提示
///
///
public void SetCaption(string newCaption)
{
Caption = newCaption;
lblCaption.Text = Caption;
progressShow.PerformStep();
Refresh();
}
///
/// 设置消息
///
///
public void SetMessage(string newMessage)
{
Message = newMessage;
// lblMessage.Text = this.Message;
progressShow.PerformStep();
Refresh();
}
///
/// 设置描述
///
///
public void SetContent(string newContent)
{
Content = newContent;
lblContent.Text = Content;
progressShow.PerformStep();
Refresh();
}
#endregion
}
}