Color Dialog


Node Information
Displays a color dialog box, you can choose a color and the color will be returned to 'Color' port.
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
Ok OUT RUN MULTIPLE FALSE FALSE
Cancel OUT RUN MULTIPLE FALSE FALSE
Color OUT Color MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Application.Dialogs
{
    [IsNode("Color Dialog")]
    public class ColorDialog : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Show");
        Port runOK = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Ok");
        Port runCancel = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Cancel");
        Port color = new Port(PortType.OUT, typeof(System.Drawing.Color), AcceptsLinks.MULTIPLE, "Color");
        public ColorDialog()
        {
            NodeType = NodeType.Method;
            Name = "Color Dialog";
            AddPort(run);
            AddPort(runOK);
            AddPort(runCancel);
            AddPort(color);
            color.IsVariable = true;
            color.VariableType = typeof(System.Drawing.Color);
            Information = "Displays a color dialog box, you can choose a color and the color will be returned to 'Color' port.";
        }
        public override string Code()
        {
            color.Instructions = color.ID;
            return "System.Windows.Forms.ColorDialog colordialog = new System.Windows.Forms.ColorDialog();\r\n" +
                "DialogResult result = colordialog.ShowDialog();\r\n" +
                "if(result == DialogResult.OK)\r\n{\r\n" + color.ID + " = colordialog.Color;\r\n" + GetValue(runOK) + "}\r\nelse\r\n{\r\n" + GetValue(runCancel) + "\r\n}";
        }
    }
}