Project Demo: Code Snippet Studio and Essential Studio for WPF

Alessandro Del Sole, Microsoft MVP and an author for multiple titles in Syncfusion’s Succinctly e-book series, demonstrates his open-source Code Snippet Studio project in this video. Code Snippet Studio was built using tools from Essential Studio for WPF on our free Community License, which is available to individual developers and small businesses meeting certain criteria.

Why not contribute to Code Snippet Studio yourself? The project is hosted on GitHub and you can find Alessandro on Twitter: @progalex.

The full transcript for this video is below.


Whitney Hill: Thank you for taking the time to sit with me today. Would you like to introduce yourself, and tell us your name, your industry, technologies you like to use, and what inspires you in your work?

Alessandro Del Sole: Yes, of course, and thanks for inviting me first of all. My name is Alessandro Del Sole and I am a senior .NET developer and trainer, and consultant. I work for a company based in Italy called Brain-Sys, and I have been a Microsoft Most Valuable Professional since 2008. I used to be a Visual Basic MVP, then the MVP program has been reorganized and now I am under the Visual Studio & Development Technologies category.

I have been voted MVP of the year five times; I am also a Microsoft Certified Professional and Microsoft Specialist for C#, and I am an author for Syncfusion’s Succinctly series. I wrote four e-books so far, but I’m working on a new e-book that will be coming up in a few months. I also like writing technical articles; I wrote a number of articles for important websites such as MSDN Magazine, InformIT, Visual Basic Developer Center and so on. I also like to produce instructional videos, and Windows Store Applications – and you can find me on Twitter @progalex.

WH: That’s great! And you know, we love having you on to write our e-books for us, we get a lot of great feedback on that series, so thanks for being a part of that. 

ADS: Thank you, thank you. 

WH: So can you tell us: how long have you been using Syncfusion products, and what was the initial attraction?

ADS: Yes, I have been using Syncfusion’s products since a couple of years, and the initial attraction was due to the fact that the company was offering controls for WPF that were very interesting to me and that I did not find in other companies. So that was the reason why I decided to adopt Syncfusion’s controls. More specifically, I needed controls for Windows Presentation Foundation and I found a good offer from Syncfusion. 

WH: Well that’s great, we’re so happy that you chose us. Which product or which tool did you use?

ADS: Yes, I brought some applications that work with WPF and Essential Studio, but probably something that can be more interesting for the developer community is a free and open source tool that I called Code Snippet Studio that I would like to introduce today. It is a free and open source project that allows developers to easily create, edit, and package, and share code snippets for Visual Studio, and Visual Studio code. I made intensive usage of some of the controls for WPF offered by Syncfusion Essential Studio. 

WH: That sounds great, I mean would you be able to show us your project in action?

ADS: Yes. Yes, so we have a couple versions of this tool. One is an extension for Visual Studio and one is a stand-alone application. So one important consideration at this point is that if developers want to use Essential Studio for WPF they can do it both for stand-alone WPF applications and in Visual Studio extensions which are based on WPF, basically.

So, a great opportunity that Visual Studio has been offering since many years, since 2005, is the ability of using the so-called IntelliSense code snippets. Let me show how this works. Let’s create just a very simple, very simple project. 

Okay. So, one of the things developers do the most is, trying to reuse their existing code. So they take their code snippets and save them somewhere. Because of this, Microsoft introduced an important option into Visual Studio, which is the availability of the code snippets. I can right-click, select “Insert Snippet”, and then I can select from one of the available code snippets library, and I can create my own. So for instance, I can scroll a list and select a ready-to-use code snippet. Then I can also replace the highlighted text with a different type name or a different identifier and so on. So the biggest benefit of this is that you can create your own code snippets that can be plugged into the code editor. 

The problem is, you should create your code snippets manually, and this is based on XML complex and XML syntax. There is a number of tools that other developers created during the years to make this simpler, but one of the things I saw that these tools were lacking is the fact that they are not updated for Visual Studio 2015 or 2013, and they do not offer the opportunity of packaging code snippets into an installer. Visual Studio 2012 and ’13 and ’15 rely on the VSIX format extension, file format extension for installing code snippets, so I have created this tool that makes it simple to create, edit, package, and share code snippets.

So, for example, I can write some code inside the code editor and you can see, I have a very basic IntelliSense but this is very useful to make it simpler to write a code snippet. And, I can go on, or I can even open an existing snippet for convenience, like this. So, this code editor is based on the syntax control, syntax editor control, from Syncfusion. This is very helpful, because it provides syntax colorization for a number of programming languages, and is extensible. If you need to use this control with a programming language that is not included out of the box, then you can create your own syntax rules. This tool supports some languages such as Visual Basic, C#, SQL syntax, XML, XAML, C++, HTML, and JavaScript. This is all already included in the Syntax Editor control.

Another important control that I have used from Essential Studio here is the property grid. A code snippet essentially is made of – requires at least – specifying a number of properties such as the author, a description, keywords, the kind of code snippets you are providing, a shortcut that you can use to insert the code snippet quickly. So this control was perfect for my, for my situation. Instead of providing, you know, a text box here, another text box, another text box, this control can be data-bound to the .NET class, the C# class, that represents a code snippet, so it really makes it easy to store properties for a code snippet in this case. 

And other controls that I have been using in this project – for example are DataGrids which provide me with advanced features for filtering, sorting and displaying data. So, in this particular case I have an error list here, this tool is based on the Roslyn compiler. Roslyn is the new compiler from Microsoft which provides open-source compilers with rich code analysis APIs for Visual Basic and C# and you can detect issues, code issues, as you type. So as immediately – when I type, the code editor is able to immediately detect any problems because of Roslyn behind the scenes and all the errors are easily displayed in this DataGrid that you can also filter and sort, and so on. 

I have used the Docking controls, which provides me a very easy way to organize the user interface. So for instance, I have these two windows that I can easily auto-hide, like this, so to have a larger area for writing my code, and then I can simply turn them back. This is something that developers using Visual Studio are very familiar with. This is very, very useful because it allows to organize the user interface according to your preferences. And also, you can take a dialogue and move it to a different position. Okay. 

Then, what I also did was implementing themes. You might not like the default colors I provided for this tool, so you can even set a different theme among a list of built-in themes for WPF. So for example I can use the Blend theme to completely change the layout, or the Visual Studio 2013, or an Office-like theme, and so on. Metro is the one I like most. Another important - 

WH: That’s a really nice-looking tool.

ADS: Yes, oh, thank you, thank you. I hope – I think people are finding this tool very useful, at least from the feedback I got so far, so, very nice. And, another important consideration I want to make about the code editor is that with Visual Basic, you can – of course, this is C# code so you are seeing some errors at the bottom but, in the case you select Visual Basic, code snippets provide an option to specify references to external libraries that you need to compile the code snippet once you add the snippet into Visual Studio. But, for Visual Basic and C#, you can also add a reference to an external assembly and the Syntax Editor control will be able to add a real reference to that library and will improve the IntelliSense as you type, automatically taking the names of the types defined in that external library. So, another interesting feature in the Syntax Editor control, which I really love.

WH: Okay, so can you tell us a bit about the long-term benefits or results that you saw using Essential Studio to build your project?

ADS: Yes. First of all, I saved a lot of time. I think that if I had to build my own Syntax Editor control, I would probably – it would probably take me many months. There are some free, open-source controls for syntax editing but they are not the same. Here you have full word completion support, a number of languages that are supported out of the box, you also have a context menu that is precise for editing such as increasing indentation, decreasing, or line commenting. This is the first benefit I got from using this kind of control in this project. 

And about the other controls I used, they also provided a very convenient way to store the information, to store and present the information related to creating a code snippet. So, I think that, you know, when you create an open-source project, it’s something that you do in your spare free time and the time is very limited, so if you can use some very powerful controls like Essential Studio, you get a better product, a better – a better project, with limited effort. So I think, I think I can strongly recommend Essential Studio for WPF.

WH: Well thank you, I mean, that’s great to see your project and you know, of course we love that you chose Syncfusion for it.

ADS: Thank you. 

WH: Is there anything else you’d like to tell us about, or any kind of quick fact, or something you’re working on currently?

ADS: Currently I’m working on a new e-book for the Succinctly series called WPF Debugging and Performance Succinctly, so for WPF developers who are looking, who are having a look to Essential Studio for WPF, that book might be useful. And, I’m currently planning to start a new project based on Xamarin.Forms, for a cross-platform mobile app, and I will certainly use Essential Studio for Xamarin, too. 

WH: Oh, that’s great to hear. Well, I’m sure everyone will be looking out for your Succinctly e-book, those are – you know as I said, those are very popular and you are one of our top authors so thank you for taking the time to join us today, we really appreciated it, and have a good day!

ADS: Thank you, thank you for taking your time for inviting me, and for the opportunity. Thank you.

WH: Thank you.

Pingbacks and trackbacks (1)+

Loading