diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index ee06ac97..330ed424 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 57875d4e..1f25dc2d 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 2c71bc09..3ae5edce 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index e006f053..0ce64b45 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index 10f70501..afcc5179 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI/Forms/UIFormHelper.cs b/SunnyUI/Forms/UIFormHelper.cs index d29db7b0..5d18e417 100644 --- a/SunnyUI/Forms/UIFormHelper.cs +++ b/SunnyUI/Forms/UIFormHelper.cs @@ -148,7 +148,7 @@ namespace Sunny.UI public static bool ShowMessageDialog(this Form form, string message, string title, bool isShowCancel, UIStyle style) { UIMessageForm frm = new UIMessageForm(); - frm.TopMost = form.TopMost; + frm.TopMost = form != null && form.TopMost; frm.ShowMessage(message, title, isShowCancel, style); frm.ShowDialog(); bool isOk = frm.IsOK; @@ -252,7 +252,7 @@ namespace Sunny.UI 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(); 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 = "请输入字符串:") { - 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 = "请输入字符串:") { - 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) { - 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(); 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 = "请输入密码:") { - 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 = "请输入密码:") { - 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) { - 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(); frm.TopMost = topMost; @@ -340,7 +340,7 @@ namespace Sunny.UI 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(); 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 = "请输入数字:") { - 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 = "请输入数字:") { - 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) { - 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 = "请输入数字:") { - 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 = "请输入数字:") { - 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) { - 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(); frm.TopMost = topMost; @@ -416,7 +416,7 @@ namespace Sunny.UI 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(); 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 = "请输入数字:") { - 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 = "请输入数字:") { - 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) { - 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 = "请输入数字:") { - 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 = "请输入数字:") { - 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) { - 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) { - 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) @@ -512,12 +512,12 @@ namespace Sunny.UI 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) { - 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); } }