Blob Method Call


Blob Method Call

Table of Contents

A Blob Method Call is a Method Call that returns a Blob Expression.

Code Example

 

private IntegerProperty Number => IntegerProperty(null, IntegerDefinition.GetInstance(IntegerSize.Integer, false, maxValue:10));
private ReadOnlyBlobProperty ComposedBlob => CalculatedBlobProperty(ComposeTheBlob);

protected override IUIElement CreateGui()
{

    return new VBox
    {
        new HBox(alignH:AlignH.Fill, alignV:AlignV.Fill)
        {
            new GroupBox("example")
            {
                new VBox(2)
                {
                    new Label("number (1 till 10):"),
                    new TextBox(Number),

                    new Label("calculated string:"),
                    new PictureEdit(ComposedBlob, PictureBoxSize.FixedXLarge),
                },
            },
            CodeContent
        },

        new HBox(alignH:AlignH.Fill)
        {
            EmptySpace.FillH,
            new Button(Close())
        }
    };
}


private BlobMethodCall ComposeTheBlob()
{
    return BlobMethod(() => new Body
    {
        new If(Number.IsEqualTo(1))
        {
            new Return(Images.Label.ConvertToBlob())
        },

        ...

        new ElseIf(Number.IsEqualTo(10))
        {
             new Return(Images.Valid.ConvertToBlob())
        },
        new Else
        {
            new Return(Images.ByteArray.ConvertToBlob())
        }
    });
}

 

Explanation of the code example

Example of the result

A form like the one defined above, could look like this.

When nothing has been entered:

 

When 10 has been entered:

 

 



Article ID: 426
Created: Thu, Mar 19, 2020
Last Updated: Fri, Mar 20, 2020

Online URL: https://wiki-ai-framework.abstract-it.nl/article/blob-method-call-426.html