-
-
Notifications
You must be signed in to change notification settings - Fork 109
Integrate WPF Blockly to your application
Huajiang Wei edited this page Nov 5, 2021
·
1 revision
-
Define your script class, which must implement the "Class" interface. Add your script related information to the script class. Using the load and save function in Serialization, you can achieve the loading and saving your script.
-
Add GraphicScriptEditor into your GUI
<editor:GraphicScriptEditor Name="Editor"/>
- Define your own expression, statement, function and event, and all these types to the toolbar
List<ScriptStepGroup> toolbar = new List<ScriptStepGroup>();
toolbar.Add(new ScriptStepGroup()
{
Name = "comment",
Types = new List<object>() {
new Label(){Content="comment"},
new ScriptStep(new CommentStatement()),
new ScriptStep(new CommentStatement(){AllowMultiLine=true })
}
});
Editor.SetToolBar(toolbar);
- Hanle the library import event. When user click the '+/-' button, this event will be raised. You can write your own library functions.
public event EventHandler<EventArgs> ChangeImportLibrary;
Please the check the demo application, and how to realize the library and use it.
- In the visual script, there are three types of AST (abstract syntax tree) node, they are expression, statement and function. Based on these three types, you can define your own script node.