5

I'm currently developing an application that allow the user to program some scripts. I've developed a "compiler" to analyse the script made by the user, but now i want create a visual editor with all the possibilities that the user have, something similar to this: Blockly - A visual programming editor .

I am currently using C# and I have no idea how to develop something like the above. I thought about doing my own draggable UI on top of my DSL, but not sure how to start.

Thanks

user1845593
  • 1,736
  • 3
  • 20
  • 37

4 Answers4

1

For other Wpf developers trying to do something similar, I would not recommend doing this yourself but actually use a webpage within Wpf and then communicate with Blockly through that. I promise you that this will be a lot easier than actually trying to do this yourself.

Use Blockly inside a WebBrowser

If you don't feel like recreating all your script generation code you could also create a custom xml generator for Blockly and then just print out which blocks are connected so like :

<block>
   <whileblock repeat="20"/>
<block/>

Then decipher this and generate your script from c# depending on the connected blocks.

Lloyd
  • 1,119
  • 10
  • 29
0

Blockly is open source, so feel free to use it for your editor. You don't really need to know much JavaScript in order to use the Blockly libraries, and there's a support group.

Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101
0

For anyone stumbling across this: With Blazor it is now possible to create WPF programs and use razor files (HTML/CSS/JS/C#) for the UI description (https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/wpf?view=aspnetcore-7.0)

This enables the usage of JS functions like Blockly directly inside the UI of the C# application, just by following the Blockly instructions (https://developers.google.com/blockly/guides/get-started/web?hl=en) and using JSInterop of Blazor.

devbf
  • 412
  • 5
  • 15
-1

You can do it with WPF. Using Drag and Drop you can get real closer. Watching this video will help you get sense hou this mechanism works. Try improving it slowly and playing with it. 2nd step will be to play with lists and drag and drop Like shown here . Improve it even more by using data you get from your mouse position, a good way to do it demonstrated here.

Community
  • 1
  • 1
Itzik Gili
  • 324
  • 3
  • 16