var status = ""; // "#" for Error, "!" for Warning title color
var button = "OK"; // "OKCancel", etc. see https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.messageboxbuttons?view=windowsdesktop-7.0#fields
var title = "Title"
var message = "Message"
var result = exec.Informplugin("Messages.dll",
string.Format("{0}{1}:{2}|{3}",
status, button, title, messsage
));
// ================================================================================================ Dialogs
// Dialogs
// ================================================================================================
static string _macro_title = "UCCNC";
static string _error_msg = _macro_title + " error";
// ================================================================================================ ShowError
void ShowError(string str)
{
ShowDialog(str, _error_msg, MessageBoxButtons.OK, "*#");
// exec.AddStatusmessage(_error_msg + ": " + str);
}
// ================================================================================================ ShowDialog
DialogResult ShowDialog(string msg, string caption = "", MessageBoxButtons buttons = MessageBoxButtons.OK, string style = "")
{
// style: "[*][!|#]", * for cancel if reset, ! for warning, # for error
if (caption == "")
caption = _macro_title;
bool isMessagesEnabled = false;
object returnValue = exec.Informplugin("Messages.dll", (object)null);
if (returnValue is bool) isMessagesEnabled = (bool)returnValue;
if (isMessagesEnabled)
return (DialogResult)exec.Informplugin("Messages.dll",
(object)(style + buttons.ToString() + ":" + caption + "|" + msg));
else
return MessageBox.Show(exec.mainform, msg, caption, buttons);
}
Users browsing this forum: No registered users and 18 guests