2020-05-11 21:11:29 +08:00
|
|
|
|
/******************************************************************************
|
|
|
|
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
2021-02-20 15:45:47 +08:00
|
|
|
|
* CopyRight (C) 2012-2021 ShenYongHua(沈永华).
|
|
|
|
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
2020-05-11 21:11:29 +08:00
|
|
|
|
*
|
|
|
|
|
* Blog: https://www.cnblogs.com/yhuse
|
|
|
|
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
|
|
|
|
* GitHub: https://github.com/yhuse/SunnyUI
|
|
|
|
|
*
|
|
|
|
|
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
|
|
|
|
* If you use this code, please keep this note.
|
|
|
|
|
* 如果您使用此代码,请保留此说明。
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* 文件名称: UIPage.cs
|
|
|
|
|
* 文件说明: 页面基类,从Form继承,可放置于容器内
|
2021-01-05 16:43:02 +08:00
|
|
|
|
* 当前版本: V3.0
|
2020-05-11 21:11:29 +08:00
|
|
|
|
* 创建日期: 2020-01-01
|
|
|
|
|
*
|
|
|
|
|
* 2020-01-01: V2.2.0 增加文件说明
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-06-09 20:15:39 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
using System.ComponentModel;
|
2020-06-05 22:42:48 +08:00
|
|
|
|
using System.Diagnostics;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
using System.Drawing;
|
2020-06-09 20:15:39 +08:00
|
|
|
|
using System.Drawing.Design;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Sunny.UI
|
|
|
|
|
{
|
|
|
|
|
[DefaultEvent("Initialize")]
|
|
|
|
|
public partial class UIPage : Form, IStyleInterface
|
|
|
|
|
{
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public readonly Guid Guid = Guid.NewGuid();
|
|
|
|
|
private Color _rectColor = UIColor.Blue;
|
|
|
|
|
|
|
|
|
|
private ToolStripStatusLabelBorderSides _rectSides = ToolStripStatusLabelBorderSides.None;
|
|
|
|
|
|
|
|
|
|
protected UIStyle _style = UIStyle.Blue;
|
|
|
|
|
|
2021-03-25 14:49:21 +08:00
|
|
|
|
[Browsable(false)]
|
2021-03-25 14:09:52 +08:00
|
|
|
|
public IFrame Frame { get; set; }
|
2020-11-09 23:41:41 +08:00
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
public UIPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
base.BackColor = UIColor.LightBlue;
|
2020-06-05 22:42:48 +08:00
|
|
|
|
TopLevel = false;
|
|
|
|
|
if (this.Register()) SetStyle(UIStyles.Style);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
|
|
|
|
SetStyle(ControlStyles.UserPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
|
SetStyle(ControlStyles.DoubleBuffer, true);
|
|
|
|
|
UpdateStyles();
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
if (!IsDesignMode) base.Dock = DockStyle.Fill;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
|
|
|
|
Version = UIGlobal.Version;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-11 21:46:38 +08:00
|
|
|
|
public void Render()
|
|
|
|
|
{
|
|
|
|
|
SetStyle(UIStyles.Style);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
private int _symbolSize = 24;
|
|
|
|
|
|
|
|
|
|
[DefaultValue(24)]
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("字体图标大小"), Category("SunnyUI")]
|
2020-06-09 20:15:39 +08:00
|
|
|
|
public int SymbolSize
|
|
|
|
|
{
|
|
|
|
|
get => _symbolSize;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_symbolSize = Math.Max(value, 16);
|
|
|
|
|
_symbolSize = Math.Min(value, 64);
|
|
|
|
|
SymbolChange();
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _symbol;
|
|
|
|
|
|
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
|
|
|
|
[Editor(typeof(UIImagePropertyEditor), typeof(UITypeEditor))]
|
|
|
|
|
[DefaultValue(0)]
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("字体图标"), Category("SunnyUI")]
|
2020-06-09 20:15:39 +08:00
|
|
|
|
public int Symbol
|
|
|
|
|
{
|
|
|
|
|
get => _symbol;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_symbol = value;
|
|
|
|
|
SymbolChange();
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[DefaultValue(false), Description("在Frame框架中不被关闭"), Category("SunnyUI")]
|
2020-06-27 16:53:32 +08:00
|
|
|
|
public bool AlwaysOpen { get; set; }
|
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
protected virtual void SymbolChange()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public Point ParentLocation { get; set; } = new Point(0, 0);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[DefaultValue(-1)]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public int PageIndex { get; set; } = -1;
|
|
|
|
|
|
2020-06-09 20:15:39 +08:00
|
|
|
|
[Browsable(false)]
|
|
|
|
|
public Guid PageGuid { get; set; } = Guid.Empty;
|
|
|
|
|
|
|
|
|
|
[Browsable(false), DefaultValue(null)]
|
|
|
|
|
public TabPage TabPage { get; set; } = null;
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 边框颜色
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The color of the border style.</value>
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("边框颜色"), Category("SunnyUI")]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public Color RectColor
|
|
|
|
|
{
|
|
|
|
|
get => _rectColor;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_rectColor = value;
|
|
|
|
|
AfterSetRectColor(value);
|
|
|
|
|
_style = UIStyle.Custom;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected bool IsDesignMode
|
2020-05-11 21:11:29 +08:00
|
|
|
|
{
|
2020-06-05 22:42:48 +08:00
|
|
|
|
get
|
2020-05-11 21:11:29 +08:00
|
|
|
|
{
|
2020-06-05 22:42:48 +08:00
|
|
|
|
var ReturnFlag = false;
|
|
|
|
|
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
|
|
|
|
|
ReturnFlag = true;
|
|
|
|
|
else if (Process.GetCurrentProcess().ProcessName == "devenv")
|
|
|
|
|
ReturnFlag = true;
|
|
|
|
|
|
|
|
|
|
return ReturnFlag;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
2020-06-05 22:42:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[DefaultValue(ToolStripStatusLabelBorderSides.None)]
|
2021-03-22 21:31:14 +08:00
|
|
|
|
[Description("边框显示位置"), Category("SunnyUI")]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public ToolStripStatusLabelBorderSides RectSides
|
|
|
|
|
{
|
|
|
|
|
get => _rectSides;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_rectSides = value;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-08 21:55:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tag字符串
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DefaultValue(null)]
|
|
|
|
|
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
|
|
|
|
|
public string TagString { get; set; }
|
2020-06-05 22:42:48 +08:00
|
|
|
|
|
|
|
|
|
public string Version { get; }
|
|
|
|
|
|
2020-08-08 21:55:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主题样式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
|
2020-06-05 22:42:48 +08:00
|
|
|
|
public UIStyle Style
|
|
|
|
|
{
|
|
|
|
|
get => _style;
|
|
|
|
|
set => SetStyle(value);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-08 21:55:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自定义主题风格
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DefaultValue(false)]
|
|
|
|
|
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
|
|
|
|
public bool StyleCustomMode { get; set; }
|
2020-06-05 22:42:48 +08:00
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
protected override void OnControlAdded(ControlEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnControlAdded(e);
|
|
|
|
|
|
|
|
|
|
if (e.Control is IStyleInterface ctrl)
|
2020-06-09 20:15:39 +08:00
|
|
|
|
{
|
2020-05-11 21:11:29 +08:00
|
|
|
|
if (!ctrl.StyleCustomMode)
|
2020-06-09 20:15:39 +08:00
|
|
|
|
{
|
2020-05-11 21:11:29 +08:00
|
|
|
|
ctrl.Style = Style;
|
2020-06-09 20:15:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.Control is Panel)
|
|
|
|
|
{
|
|
|
|
|
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
|
|
|
|
foreach (var control in controls)
|
|
|
|
|
{
|
|
|
|
|
if (control is IStyleInterface item)
|
|
|
|
|
{
|
|
|
|
|
if (!item.StyleCustomMode)
|
|
|
|
|
{
|
|
|
|
|
item.Style = Style;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Init()
|
|
|
|
|
{
|
2021-05-21 11:23:20 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ReLoad()
|
|
|
|
|
{
|
|
|
|
|
OnLoad(EventArgs.Empty);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Final()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetStyle(UIStyle style)
|
|
|
|
|
{
|
2020-05-15 10:22:35 +08:00
|
|
|
|
this.SetChildUIStyle(style);
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
|
|
|
|
SetStyleColor(UIStyles.GetStyleColor(style));
|
|
|
|
|
_style = style;
|
2021-02-28 21:06:15 +08:00
|
|
|
|
UIStyleChanged?.Invoke(this, new EventArgs());
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-28 21:06:15 +08:00
|
|
|
|
public event EventHandler UIStyleChanged;
|
|
|
|
|
|
2020-05-11 21:11:29 +08:00
|
|
|
|
public virtual void SetStyleColor(UIBaseStyle uiColor)
|
|
|
|
|
{
|
|
|
|
|
if (uiColor.IsCustom()) return;
|
|
|
|
|
|
|
|
|
|
BackColor = uiColor.PlainColor;
|
|
|
|
|
RectColor = uiColor.RectColor;
|
|
|
|
|
ForeColor = UIFontColor.Primary;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterSetFillColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterSetRectColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterSetForeColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnPaint(e);
|
|
|
|
|
|
2020-06-05 22:42:48 +08:00
|
|
|
|
if (Width <= 0 || Height <= 0) return;
|
2020-05-11 21:11:29 +08:00
|
|
|
|
|
|
|
|
|
if (RectSides != ToolStripStatusLabelBorderSides.None)
|
|
|
|
|
{
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Left))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, 0, 0, 0, Height - 1);
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Top))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, 0, 0, Width - 1, 0);
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Right))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, Width - 1, 0, Width - 1, Height - 1);
|
|
|
|
|
if (RectSides.GetValue(ToolStripStatusLabelBorderSides.Bottom))
|
|
|
|
|
e.Graphics.DrawLine(RectColor, 0, Height - 1, Width - 1, Height - 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnBackColorChanged(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnBackColorChanged(e);
|
|
|
|
|
AfterSetFillColor(BackColor);
|
|
|
|
|
_style = UIStyle.Custom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnForeColorChanged(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnForeColorChanged(e);
|
|
|
|
|
AfterSetForeColor(ForeColor);
|
|
|
|
|
_style = UIStyle.Custom;
|
|
|
|
|
}
|
2020-06-05 22:16:56 +08:00
|
|
|
|
|
|
|
|
|
private void UIPage_Shown(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-06-09 20:15:39 +08:00
|
|
|
|
//SetStyle(UIStyles.Style);
|
2020-06-05 22:16:56 +08:00
|
|
|
|
}
|
2020-09-30 22:43:28 +08:00
|
|
|
|
|
2020-10-15 20:42:40 +08:00
|
|
|
|
#region 一些辅助窗口
|
2021-04-25 22:04:03 +08:00
|
|
|
|
|
2020-10-15 20:42:40 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示进度提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
/// <param name="maximum">最大进度值</param>
|
2021-04-25 22:04:03 +08:00
|
|
|
|
/// <param name="decimalCount">显示进度条小数个数</param>
|
|
|
|
|
public void ShowStatusForm(int maximum = 100, string desc = "系统正在处理中,请稍候...", int decimalCount = 1)
|
2020-10-15 20:42:40 +08:00
|
|
|
|
{
|
2021-04-25 22:04:03 +08:00
|
|
|
|
UIStatusFormService.ShowStatusForm(maximum, desc, decimalCount);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 隐藏进度提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void HideStatusForm()
|
|
|
|
|
{
|
|
|
|
|
UIStatusFormService.HideStatusForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置进度提示窗步进值加1
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void StatusFormStepIt()
|
|
|
|
|
{
|
|
|
|
|
UIStatusFormService.StepIt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置进度提示窗描述文字
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
public void SetStatusFormDescription(string desc)
|
|
|
|
|
{
|
|
|
|
|
UIStatusFormService.SetDescription(desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示等待提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
public void ShowWaitForm(string desc = "系统正在处理中,请稍候...")
|
|
|
|
|
{
|
|
|
|
|
UIWaitFormService.ShowWaitForm(desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 隐藏等待提示窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void HideWaitForm()
|
|
|
|
|
{
|
|
|
|
|
UIWaitFormService.HideWaitForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置等待提示窗描述文字
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="desc">描述文字</param>
|
|
|
|
|
public void SetWaitFormDescription(string desc)
|
|
|
|
|
{
|
|
|
|
|
UIWaitFormService.SetDescription(desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 正确信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowSuccessDialog(string msg, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.SuccessTitle, false, UIStyle.Green, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowInfoDialog(string msg, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.InfoTitle, false, UIStyle.Gray, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 警告信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowWarningDialog(string msg, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.WarningTitle, false, UIStyle.Orange, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowErrorDialog(string msg, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, UILocalize.ErrorTitle, false, UIStyle.Red, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 确认信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
/// <returns>结果</returns>
|
|
|
|
|
public bool ShowAskDialog(string msg, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 正确信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowSuccessDialog(string title, string msg, UIStyle style = UIStyle.Green, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowInfoDialog(string title, string msg, UIStyle style = UIStyle.Gray, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 警告信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowWarningDialog(string title, string msg, UIStyle style = UIStyle.Orange, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
public void ShowErrorDialog(string title, string msg, UIStyle style = UIStyle.Red, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
UIMessageDialog.ShowMessageDialog(msg, title, false, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 确认信息提示框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">标题</param>
|
|
|
|
|
/// <param name="msg">信息</param>
|
|
|
|
|
/// <param name="style">主题</param>
|
|
|
|
|
/// <param name="showMask">显示遮罩层</param>
|
|
|
|
|
/// <returns>结果</returns>
|
|
|
|
|
public bool ShowAskDialog(string title, string msg, UIStyle style = UIStyle.Blue, bool showMask = true)
|
|
|
|
|
{
|
2021-05-09 10:36:31 +08:00
|
|
|
|
return UIMessageDialog.ShowMessageDialog(msg, title, true, style, showMask, Frame?.TopMost ?? false);
|
2020-10-15 20:42:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowInfoTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.Show(text, null, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示成功消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowSuccessTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowOk(text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示警告消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowWarningTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowWarning(text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 显示出错消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowErrorTip(string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowError(text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowInfoTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.Show(controlOrItem, text, null, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示良好消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowSuccessTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowOk(controlOrItem, text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示出错消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowErrorTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowError(controlOrItem, text, delay, floating);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在指定控件附近显示警告消息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="controlOrItem">控件或工具栏项</param>
|
|
|
|
|
/// <param name="text">消息文本</param>
|
|
|
|
|
/// <param name="delay">消息停留时长(ms)。默认1秒</param>
|
|
|
|
|
/// <param name="floating">是否漂浮</param>
|
|
|
|
|
public void ShowWarningTip(Component controlOrItem, string text, int delay = 1000, bool floating = true)
|
|
|
|
|
=> UIMessageTip.ShowWarning(controlOrItem, text, delay, floating, false);
|
|
|
|
|
|
|
|
|
|
public void ShowInfoNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.INFO, UILocalize.InfoTitle, false, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowSuccessNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.OK, UILocalize.SuccessTitle, false, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowWarningNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.WARNING, UILocalize.WarningTitle, false, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowErrorNotifier(string desc, bool isDialog = false, int timeout = 2000)
|
|
|
|
|
{
|
|
|
|
|
UINotifierHelper.ShowNotifier(desc, UINotifierType.ERROR, UILocalize.ErrorTitle, false, timeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2021-05-21 11:23:20 +08:00
|
|
|
|
|
|
|
|
|
private void UIPage_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2020-05-11 21:11:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|