Message Box


Node Information
Displays a message box. You can set the message box Icon, Title, Message, and Buttons, all that is done in the properties window If none of the buttons is clicked 'None' will fire, If OK is clicked 'OK' will fire, if Cancel is clicked, 'Cancel' will fire, If Yes is clicked 'Yes' will fire, if No is clicked, 'No' will fire.If Abort is clicked 'Abort' will fire, if Ignore is clicked, 'Ignore' will fire.If Retry is clicked 'Retry' will fire, if Retry is clicked, 'Retry' will fire.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Show IN RUN MULTIPLE FALSE FALSE
Title IN String ONE FALSE FALSE
Message IN String ONE FALSE FALSE
Buttons IN MessageBoxButtons ONE FALSE FALSE
Icon IN MessageBoxIcon ONE FALSE FALSE
DefaultButton IN MessageBoxDefaultButton ONE FALSE FALSE
Yes OUT RUN MULTIPLE FALSE FALSE
No OUT RUN MULTIPLE FALSE FALSE
Ok OUT RUN MULTIPLE FALSE FALSE
Abort OUT RUN MULTIPLE FALSE FALSE
Cancel OUT RUN MULTIPLE FALSE FALSE
Ignore OUT RUN MULTIPLE FALSE FALSE
Retry OUT RUN MULTIPLE FALSE FALSE
None OUT RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Application.Dialogs
{
    [IsNode("Message Box")]
    public class MessageBox : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Show");
        Port title = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Title");
        Port msg = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Message");
        Port buttons = new Port(PortType.IN, typeof(System.Windows.Forms.MessageBoxButtons), AcceptsLinks.ONE, "Buttons");
        Port icon = new Port(PortType.IN, typeof(System.Windows.Forms.MessageBoxIcon), AcceptsLinks.ONE, "Icon");
        Port defaultbutton = new Port(PortType.IN, typeof(System.Windows.Forms.MessageBoxDefaultButton), AcceptsLinks.ONE, "DefaultButton");
        Port runYes = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Yes");
        Port runNo = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "No");
        Port runOK = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Ok");
        Port runAbort = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Abort");
        Port runCancel = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Cancel");
        Port runIgnore = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Ignore");
        Port runRetry = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Retry");
        Port runNone = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "None");
        public MessageBox()
        {
            NodeType = KGraph.NodeType.Method;
            this.Name = "Message Box";
            this.AddPort(run);
            this.AddPort(title);
            this.AddPort(msg);
            AddPort(buttons);
            AddPort(icon);
            AddPort(defaultbutton);
            this.AddPort(runYes);
            this.AddPort(runNo);
            this.AddPort(runOK);
            this.AddPort(runAbort);
            this.AddPort(runCancel);
            this.AddPort(runIgnore);
            this.AddPort(runRetry);
            this.AddPort(runNone);
            Information = "Displays a message box. " +
                "You can set the message box Icon, Title, Message, and Buttons, all that is done in " +
                "the properties window " +
                "If none of the buttons is clicked 'None' will fire, " +
                "If OK is clicked 'OK' will fire, " +
                "if Cancel is clicked, 'Cancel' will fire, " +
                "If Yes is clicked 'Yes' will fire, " +
                "if No is clicked, 'No' will fire." +
                "If Abort is clicked 'Abort' will fire, " +
                "if Ignore is clicked, 'Ignore' will fire." +
                "If Retry is clicked 'Retry' will fire, " +
                "if Retry is clicked, 'Retry' will fire.";
        }
        public override string Code()
        {
            string code = "DialogResult result = System.Windows.Forms.MessageBox.Show(" + GetValue(msg) + ", "
                + GetValue(title) + ", " + GetValue(buttons) + ", "
                + GetValue(icon) + ", "
                + GetValue(defaultbutton) + ");\r\n";
            if (runAbort.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.Abort)\r\n{\r\n" + GetValue(runAbort) + "}\r\n";
            }
            if (runCancel.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.Cancel)\r\n{\r\n" + GetValue(runCancel) + "}\r\n";
            }
            if (runIgnore.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.Ignore)\r\n{\r\n" + GetValue(runIgnore) + "}\r\n";
            }
            if (runNo.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.No)\r\n{\r\n" + GetValue(runNo) + "}\r\n";
            }
            if (runNone.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.None)\r\n{\r\n" + GetValue(runNone) + "}\r\n";
            }
            if (runOK.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.OK)\r\n{\r\n" + GetValue(runOK) + "}\r\n";
            }
            if (runRetry.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.Retry)\r\n{\r\n" + GetValue(runRetry) + "}\r\n";
            }
            if (runYes.IsConnected)
            {
                code += "if (result == System.Windows.Forms.DialogResult.Yes)\r\n{\r\n" + GetValue(runYes) + "}\r\n";
            }
            return code;
        }
    }
}