Raspberry Pi (RaspPi)
Visual Basic via .NET Core
For the most part, discussions in this section are going to be specific to Pi4 running Raspbian and Visual Basic as it exists through .NET Core. At the time of this writing the official release of .NET Core is v3.1; v5 is “just around the corner”.
There are basically two paths to developing for Pi; one is to use another PC (Windows 10 for example) and the other is developing directly on the Pi.
Using Windows 10
- Visual Studio 2019: I prefer the Community Edition: from what I understand it is free for personal use,, small project/team use (5 or less in size) and or active contribution to open source. Hint: This website is actually open source; please feel free to contribute via github. ;-) When you install, be sure to select .NET desktop development and .NET Core cross-platform development.
- GTK# for .NET: Note: Do not need to install Mono; just click the Download Gtk# “button”.
- .NET Core or this HowTo
- How to install Visual Studio Code on a Raspberry Pi 4 in minutes (Scott Hanselman): Please note that the build for this is actually targeting stretch, not buster - but seems to work just fine.
- VB.NET Grammar and Snippets for VSCode: This provides the appropriate experience for writing Visual Basic since the out-of-the-box experience, well to put it plainly, sucks.
- (Todo) Need to verify, validate, update regarding the installation of GTK.
- (Todo) Need to provide instructions for patching the VSCode installation so that you can launch using “code” instead of “code-oss”.
- (Todo) Need to provide instructions for modifying the terminal instances so that the path stuff is automatically attached.
To make things simpler (since I prefer to develop on Windows 10), I also setup remote desktop from Windows 10 to Pi4 following the instructions for Remote desktop with xrdp using this.
Building a GUI-style Application
The following instructions are an overview (500 mile high) set of actions you must do regardless of whether or not you are developing using Visual Studio 2019 (Windows 10) or Visual Studio Code (Raspbian).
- For the first time (once), you’ll need to also install Glade. For Raspbian, see here.
- Create a regular Console application for .NET Core 3.1.
- Need to modify the “<OutputType>Exe</OutputType>” to “<OutputType>WinExe</OutputType>”
- Need to add the nuget package for “GtkSharp”
- Need to add the nuget package for “System.Drawing.Common”
- GtkSharp - Cross Platform Toolkits (5 part series)
- ZetCode - GTK# tutorial
- ZetCode - Widgets II in GTK#
- How to check the OS version at runtime?
- Glade Multiple Window Project
- Can’t center dialog window above main window when using Glade (Quickly)
- Open subwindow in GTK3
- Make GTK widget fill parent window
- How do I access GUI (GTK) from multi threads?
- 5 ways to remote desktop on Raspberry Pi (Windows/Linux/Mac)
- Barrier - Software KVM
- How To Install Visual Studio Code on a Raspberry Pi 4 In Minutes
- Discussion of “Move UI from WinForms to GTK#”
- An introduction to GUI building with Glade (PDF)
For future research
- Convert a GTK application to a Qt application
- QtSharp (GitHub)
- QtSharp (GitLab)
- Cross Platform WinForms (Kinda)
- Programming with gtkmm 3
- GTK+ Reference Manual
- GtkSharp: HelloWorld, second try (scroll down a little bit)
- convert gtkglade to libglade for backwards compatibility
- How do I use gtk builder in C#
- Glade 3.8 Win32 Binaries
- Creating a closable tab in Mono/GTK
- Layout management in PyGTK or GTK+ layout management
- Menus and toolbars in GTK+