* UIFormHelper:更新帮助类

This commit is contained in:
Sunny 2021-03-15 12:01:07 +08:00
parent 35356066eb
commit b9c52852e4
6 changed files with 28 additions and 28 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -148,7 +148,7 @@ namespace Sunny.UI
public static bool ShowMessageDialog(this Form form, string message, string title, bool isShowCancel, UIStyle style) public static bool ShowMessageDialog(this Form form, string message, string title, bool isShowCancel, UIStyle style)
{ {
UIMessageForm frm = new UIMessageForm(); UIMessageForm frm = new UIMessageForm();
frm.TopMost = form.TopMost; frm.TopMost = form != null && form.TopMost;
frm.ShowMessage(message, title, isShowCancel, style); frm.ShowMessage(message, title, isShowCancel, style);
frm.ShowDialog(); frm.ShowDialog();
bool isOk = frm.IsOK; bool isOk = frm.IsOK;
@ -252,7 +252,7 @@ namespace Sunny.UI
public static class UIInputDialog public static class UIInputDialog
{ {
private static bool InputStringDialog(ref string value, bool checkEmpty = true, string desc = "请输入字符串:", UIStyle style = UIStyle.Blue, bool topMost = false) public static bool InputStringDialog(ref string value, bool checkEmpty = true, string desc = "请输入字符串:", UIStyle style = UIStyle.Blue, bool topMost = false)
{ {
UIInputForm frm = new UIInputForm(); UIInputForm frm = new UIInputForm();
frm.TopMost = topMost; frm.TopMost = topMost;
@ -273,20 +273,20 @@ namespace Sunny.UI
public static bool InputStringDialog(this UIForm form, ref string value, bool checkEmpty = true, string desc = "请输入字符串:") public static bool InputStringDialog(this UIForm form, ref string value, bool checkEmpty = true, string desc = "请输入字符串:")
{ {
return InputStringDialog(ref value, checkEmpty, desc, form.Style, form.TopMost); return InputStringDialog(ref value, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputStringDialog(this UIPage form, ref string value, bool checkEmpty = true, string desc = "请输入字符串:") public static bool InputStringDialog(this UIPage form, ref string value, bool checkEmpty = true, string desc = "请输入字符串:")
{ {
return InputStringDialog(ref value, checkEmpty, desc, form.Style, form.TopMost); return InputStringDialog(ref value, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputStringDialog(this Form form, ref string value, bool checkEmpty = true, string desc = "请输入字符串:", UIStyle style = UIStyle.Blue) public static bool InputStringDialog(this Form form, ref string value, bool checkEmpty = true, string desc = "请输入字符串:", UIStyle style = UIStyle.Blue)
{ {
return InputStringDialog(ref value, checkEmpty, desc, style, form.TopMost); return InputStringDialog(ref value, checkEmpty, desc, style, form != null && form.TopMost);
} }
private static bool InputPasswordDialog(ref string value, bool checkEmpty = true, string desc = "请输入密码:", UIStyle style = UIStyle.Blue, bool topMost = false) public static bool InputPasswordDialog(ref string value, bool checkEmpty = true, string desc = "请输入密码:", UIStyle style = UIStyle.Blue, bool topMost = false)
{ {
UIInputForm frm = new UIInputForm(); UIInputForm frm = new UIInputForm();
frm.TopMost = topMost; frm.TopMost = topMost;
@ -307,20 +307,20 @@ namespace Sunny.UI
public static bool InputPasswordDialog(this UIForm form, ref string value, bool checkEmpty = true, string desc = "请输入密码:") public static bool InputPasswordDialog(this UIForm form, ref string value, bool checkEmpty = true, string desc = "请输入密码:")
{ {
return InputPasswordDialog(ref value, checkEmpty, desc, form.Style, form.TopMost); return InputPasswordDialog(ref value, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputPasswordDialog(this UIPage form, ref string value, bool checkEmpty = true, string desc = "请输入密码:") public static bool InputPasswordDialog(this UIPage form, ref string value, bool checkEmpty = true, string desc = "请输入密码:")
{ {
return InputPasswordDialog(ref value, checkEmpty, desc, form.Style, form.TopMost); return InputPasswordDialog(ref value, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputPasswordDialog(this Form form, ref string value, bool checkEmpty = true, string desc = "请输入密码:", UIStyle style = UIStyle.Blue) public static bool InputPasswordDialog(this Form form, ref string value, bool checkEmpty = true, string desc = "请输入密码:", UIStyle style = UIStyle.Blue)
{ {
return InputPasswordDialog(ref value, checkEmpty, desc, style, form.TopMost); return InputPasswordDialog(ref value, checkEmpty, desc, style, form != null && form.TopMost);
} }
private static bool InputIntegerDialog(ref int value, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false) public static bool InputIntegerDialog(ref int value, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false)
{ {
UIInputForm frm = new UIInputForm(); UIInputForm frm = new UIInputForm();
frm.TopMost = topMost; frm.TopMost = topMost;
@ -340,7 +340,7 @@ namespace Sunny.UI
return false; return false;
} }
private static bool InputIntegerDialog(ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false) public static bool InputIntegerDialog(ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false)
{ {
UIInputForm frm = new UIInputForm(); UIInputForm frm = new UIInputForm();
frm.TopMost = topMost; frm.TopMost = topMost;
@ -367,35 +367,35 @@ namespace Sunny.UI
public static bool InputIntegerDialog(this UIForm form, ref int value, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputIntegerDialog(this UIForm form, ref int value, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputIntegerDialog(ref value, checkEmpty, desc, form.Style, form.TopMost); return InputIntegerDialog(ref value, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputIntegerDialog(this UIPage form, ref int value, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputIntegerDialog(this UIPage form, ref int value, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputIntegerDialog(ref value, checkEmpty, desc, form.Style, form.TopMost); return InputIntegerDialog(ref value, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputIntegerDialog(this Form form, ref int value, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue) public static bool InputIntegerDialog(this Form form, ref int value, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue)
{ {
return InputIntegerDialog(ref value, checkEmpty, desc, style, form.TopMost); return InputIntegerDialog(ref value, checkEmpty, desc, style, form != null && form.TopMost);
} }
public static bool InputIntegerDialog(this UIForm form, ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputIntegerDialog(this UIForm form, ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputIntegerDialog(ref value, minimum, maximum, checkEmpty, desc, form.Style, form.TopMost); return InputIntegerDialog(ref value, minimum, maximum, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputIntegerDialog(this UIPage form, ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputIntegerDialog(this UIPage form, ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputIntegerDialog(ref value, minimum, maximum, checkEmpty, desc, form.Style, form.TopMost); return InputIntegerDialog(ref value, minimum, maximum, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputIntegerDialog(this Form form, ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue) public static bool InputIntegerDialog(this Form form, ref int value, int minimum, int maximum, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue)
{ {
return InputIntegerDialog(ref value, minimum, maximum, checkEmpty, desc, style, form.TopMost); return InputIntegerDialog(ref value, minimum, maximum, checkEmpty, desc, style, form != null && form.TopMost);
} }
private static bool InputDoubleDialog(ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false) public static bool InputDoubleDialog(ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false)
{ {
UIInputForm frm = new UIInputForm(); UIInputForm frm = new UIInputForm();
frm.TopMost = topMost; frm.TopMost = topMost;
@ -416,7 +416,7 @@ namespace Sunny.UI
return false; return false;
} }
private static bool InputDoubleDialog(ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false) public static bool InputDoubleDialog(ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue, bool topMost = false)
{ {
UIInputForm frm = new UIInputForm(); UIInputForm frm = new UIInputForm();
frm.TopMost = topMost; frm.TopMost = topMost;
@ -443,32 +443,32 @@ namespace Sunny.UI
public static bool InputDoubleDialog(this UIForm form, ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputDoubleDialog(this UIForm form, ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputDoubleDialog(ref value, decimals, checkEmpty, desc, form.Style, form.TopMost); return InputDoubleDialog(ref value, decimals, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputDoubleDialog(this UIPage form, ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputDoubleDialog(this UIPage form, ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputDoubleDialog(ref value, decimals, checkEmpty, desc, form.Style, form.TopMost); return InputDoubleDialog(ref value, decimals, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputDoubleDialog(this Form form, ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue) public static bool InputDoubleDialog(this Form form, ref double value, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue)
{ {
return InputDoubleDialog(ref value, decimals, checkEmpty, desc, style, form.TopMost); return InputDoubleDialog(ref value, decimals, checkEmpty, desc, style, form != null && form.TopMost);
} }
public static bool InputDoubleDialog(this UIForm form, ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputDoubleDialog(this UIForm form, ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputDoubleDialog(ref value, minimum, maximum, decimals, checkEmpty, desc, form.Style, form.TopMost); return InputDoubleDialog(ref value, minimum, maximum, decimals, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputDoubleDialog(this UIPage form, ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:") public static bool InputDoubleDialog(this UIPage form, ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:")
{ {
return InputDoubleDialog(ref value, minimum, maximum, decimals, checkEmpty, desc, form.Style, form.TopMost); return InputDoubleDialog(ref value, minimum, maximum, decimals, checkEmpty, desc, form.Style, form != null && form.TopMost);
} }
public static bool InputDoubleDialog(this Form form, ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue) public static bool InputDoubleDialog(this Form form, ref double value, double minimum, double maximum, int decimals = 2, bool checkEmpty = true, string desc = "请输入数字:", UIStyle style = UIStyle.Blue)
{ {
return InputDoubleDialog(ref value, minimum, maximum, decimals, checkEmpty, desc, style, form.TopMost); return InputDoubleDialog(ref value, minimum, maximum, decimals, checkEmpty, desc, style, form != null && form.TopMost);
} }
} }
@ -497,7 +497,7 @@ namespace Sunny.UI
public static bool ShowSelectDialog(this Form form, ref int selectIndex, IList items, UIStyle style = UIStyle.Blue) public static bool ShowSelectDialog(this Form form, ref int selectIndex, IList items, UIStyle style = UIStyle.Blue)
{ {
return form.ShowSelectDialog(ref selectIndex, items, UILocalize.SelectTitle, "", style, form.TopMost); return form.ShowSelectDialog(ref selectIndex, items, UILocalize.SelectTitle, "", style, form != null && form.TopMost);
} }
public static bool ShowSelectDialog(this UIForm form, ref int selectIndex, IList items) public static bool ShowSelectDialog(this UIForm form, ref int selectIndex, IList items)
@ -512,12 +512,12 @@ namespace Sunny.UI
public static bool ShowSelectDialog(this UIForm form, ref int selectIndex, IList items, string title, string description) public static bool ShowSelectDialog(this UIForm form, ref int selectIndex, IList items, string title, string description)
{ {
return form.ShowSelectDialog(ref selectIndex, items, title, description, form.Style, form.TopMost); return form.ShowSelectDialog(ref selectIndex, items, title, description, form.Style, form != null && form.TopMost);
} }
public static bool ShowSelectDialog(this UIPage form, ref int selectIndex, IList items, string title, string description) public static bool ShowSelectDialog(this UIPage form, ref int selectIndex, IList items, string title, string description)
{ {
return form.ShowSelectDialog(ref selectIndex, items, title, description, form.Style, form.TopMost); return form.ShowSelectDialog(ref selectIndex, items, title, description, form.Style, form != null && form.TopMost);
} }
} }