All Projects → weihuajiang → WPF-Blockly

weihuajiang / WPF-Blockly

Licence: MIT license
A WPF based visual programming editor and execution engine, which support all the code syntax (including module and object oriented programming), and even you can define your own syntax.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to WPF-Blockly

Ardublockly
Visual programming for Arduino. Based on blockly, implements Arduino code generation and facilitates program uploading.
Stars: ✭ 363 (+53.81%)
Mutual labels:  blockly
Orchestra
One language to be RegExp's Successor. Visually readable and rich, technically safe and extended, naturally scalable, advanced, and optimized
Stars: ✭ 103 (-56.36%)
Mutual labels:  blockly
Django Business Logic
Visual DSL framework for django
Stars: ✭ 134 (-43.22%)
Mutual labels:  blockly
Blocklyduino
BlocklyDuino is a web-based visual programming editor for arduino.
Stars: ✭ 526 (+122.88%)
Mutual labels:  blockly
Blockly At Rduino
[email protected] : Blockly remix for Arduino. Totally new version, enhanced one !
Stars: ✭ 96 (-59.32%)
Mutual labels:  blockly
Robot blockly
A simple way to program ROS robots using blockly.
Stars: ✭ 115 (-51.27%)
Mutual labels:  blockly
Accelerated Text
Accelerated Text is a no-code natural language generation platform. It will help you construct document plans which define how your data is converted to textual descriptions varying in wording and structure.
Stars: ✭ 256 (+8.47%)
Mutual labels:  blockly
Blockly Samples
Plugins, codelabs, and examples related to the Blockly library.
Stars: ✭ 222 (-5.93%)
Mutual labels:  blockly
Plus
Otto DIY+ ("Otto DIY with steroids" + Bluetooth + APP + switch + sensors + strength +...
Stars: ✭ 100 (-57.63%)
Mutual labels:  blockly
Webduino Blockly
📦 The Visual Programming Editor for Webduino
Stars: ✭ 125 (-47.03%)
Mutual labels:  blockly
Code Dot Org
The code powering code.org and studio.code.org
Stars: ✭ 631 (+167.37%)
Mutual labels:  blockly
Blockly Games
A series blockly games which aim to teaching children programming based on Blockly Library.
Stars: ✭ 19 (-91.95%)
Mutual labels:  blockly
Node Blockly
Blockly for Node.js and Browser via CommonJS module
Stars: ✭ 117 (-50.42%)
Mutual labels:  blockly
Pxt Microbit
A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
Stars: ✭ 501 (+112.29%)
Mutual labels:  blockly
Openfpgaduino
All open source file and project for OpenFPGAduino project
Stars: ✭ 137 (-41.95%)
Mutual labels:  blockly
Edublocks
Drag and drop coding tool for creating Python programs
Stars: ✭ 297 (+25.85%)
Mutual labels:  blockly
Pxt
Microsoft MakeCode (PXT - Programming eXperience Toolkit)
Stars: ✭ 1,649 (+598.73%)
Mutual labels:  blockly
Iobroker.javascript
Script engine for JavaScript and Blockly
Stars: ✭ 244 (+3.39%)
Mutual labels:  blockly
Blocklike
Bridging the gap between block programming and JavaScript.
Stars: ✭ 177 (-25%)
Mutual labels:  blockly
Netcoreblockly
.NET Core API to Blockly - generate from WebAPI, Swagger, OData, GraphQL =>
Stars: ✭ 121 (-48.73%)
Mutual labels:  blockly

WPF-Blockly

This is a visual programming editor like google blocky and scratch, but implemented by WPF and dotnet. Compared with existing tools, the visual script is more like real code, and it has more programming feature. With this tool, you can simply enable your application with a visual code editor and run your visual code.

In the demo, we write a visual code editor, and scratch like editor. ScreenShot You can also download it from windows store

Features

Now following feature was achieved

  • function with parameter and return value
  • recursive function
  • variable and variable scope (local variable)
  • operator, including +, -, , /, %, &, |, ^, >>, <<, ++, --, &&, ||, !, +=, -=,=,/=, &=, |=, ^=, >>=, <<=
  • if else, for, while, do while and case statement
  • loop flow control, including break, continue and return
  • try catch finally, exception handling
  • array
  • support string operation
  • support stack, queue, dictionary, list and binary tree
  • support sound synthesis
  • support translation
  • support drawing canvas liking python turtle

Besides the programming feature, this tool has following feature

  • execution step highlight
  • error position highlight
  • script serialization and deserialization

The version in microsoft store achieved following feature

  • support object-oriented programming, write and use object
  • support class inheritance and function override
  • support module programming, use script as library or type
  • support thread and thread synchronization
  • support variable, function and class visibility in library
  • support const variable
  • support array and dictionary initialization expression
  • support code folding
  • support code copy and paste
  • support unod/redo when editing
  • support generating executable application from script
  • more library like file system, string, date and time, json, scratch editor
  • support using COM/Active-X/.Net (property, function and event) in script
  • support using dynamic linked library (dll) in script
  • support EV3 control
  • support internalization, English and Chinese

Use Script Editor in your application

  • Write your own Class instance
  • Add GraphicScriptEditor into your window
  • Set the new toolbar for GraphicScriptEditor
  • Register color for each expression and statement
  • Use Serialization.Load and Serialization.Save method to load your script from and save your script to file or stream

Customize the look of your own expression and statement

To write your own expression and statement, you have inherit the Expression or Statement class, re-write Descriptor or BlockDescriptor to customize the look of your class.

The Descriptor for Expression

  • TextItemDescriptor - text showed (IsKeyword property used to highlight the key word)
  • ExpressionDescriptor - text box for user input or drag a expression here
  • ParameterDescriptor - parameter of function, user can drag this variable to other location
  • VariableDeclarationDescription - variable declaration, user can drag this variable to other location
  • StringInputDesciptor - text box for user input a single line of text
  • MultiLineStringInputDesciptor - text box for user input multiple line of text
  • SelectionItemDescriptor - combo box to show multiple variable for user selection
  • ImageItemDescriptor - show image in expression

Some statement has only one line, the display of statement is the same as expression, so you use Descriptor only for Statement. The definition of Descriptor is the same as expression, write nothing in BlockDescriptor.

For some complex statement, like if-else, while statement, these statements have several BlockStatement and several Expression, you have to customize the BlockDescriptor.

  • TextBlockStatementDescritor - text showed in statement line
  • ExpressionStatementDescription - show an expression in statement
  • BlockStatementDescriptor - BlockStatement position

For exsample, the if-else statement contains following BlockDescriptor,

  1. if - TextItemDescriptor for if and ExpressionDescriptor for Test
  2. BlockStatementDescriptor for Consequent BlockStatement
  3. else - TextItemDescriptor for else
  4. BlockStatementDescriptor for Alternate BlockStatement

Execution of Expression and Statement

Override ExecuteImpl function, to write execution of your expression and statement. To execute other expression and statement, just call the Execute function. ExecutionEnvironment stores all the value of variable, you can register your variable in environment, before registration, you have to make sue the level of your ExecutionEnvironment, and should your use a new ExecutionEnvironment.

Level of ExecutionEnvironment

Level of ExecutionEnvironment

  • 1st Level - Base ExecutionEnvironment to store all the global variable and function
  • 2bd Level - Class environment, store the static variable for each class
  • 3rd Level - Instance environment, store all the non static variable of each instance of class
  • 4th Level - function environment, store the variable of local variable of function
  • 5th or more - store local variable of each block statement

Completion of expression and statement

There are five completion type, Value, Exception, Break, Continue and Return. The loop statement will handle the break, continue completion, function statement will handle the return completion, try-catch statement will handle exception.

If your execution function, you must return the right completion type, return exception completion when exception happens, otherwise the execution of script will go wrong.

Screenshot

community version ScreenShot ScreenShot store version ScreenShot ScreenShot use COM use Active-X use dll

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].