As I've been learning C#, I've been thinking "What could I possibly use C# for apart from coursework at this very moment?". Well last night, I came across a solution!
LCD Studio - a program that I have been using for nearly a year now for my Matrix Orbital GX Typhoon display - uses C# as its primary language! Granted you can also use VB and other .NET languages but the code samples were in C# by default.
So, wanting a couple more things on my display, I turned to the
LCD Studio forums which are not used much any more but contain some great starting points. The program is a little old, so you have to do all kinds of things when starting a new project. What I wanted was a display of my CPU speed and also the current day of the week. Simple enough in C#, but getting it to display it is more complex, especially with legacy software (for example, the 16 GB you can see on the display above is just text, as the program is 32bit and could only see 4GB of my RAM).
Firstly, I looked at
this post which gave me a good starting point. As the program is quite old, I had to change some things around in the program. When you create the project, it is easiest to create it with what you want to call the plugin for LCD Studio, otherwise you have to go around and change all of the properties of the project. Not that it is that big a deal.
Copied and pasted the default code from that post, and put it in a project (which was just called MyPlugin at the start), and then you need to add a reference to the LCD Studio CoreInterfaces.dll which is stored in the LCDStudio folder where it is installed (so for me, C:\Program Files(x86)\LCDStudio\CoreInterfaces.dll).
For my project I also had to add System.Management, which is in the default list of .dlls, as I wanted to get the CPU speed using it.
Then, right clicking on the solution and selecting Properties, I get to a screen where you need to change the target framework to .NET Framework 2.0. You have to do this as this was the latest framework that LCD Studio supported.
You can debug the program using LCD Studio too, if you go to Tools > Attach To Process... while LCD Studio is running, you can get warnings and errors for incorrect code and redundant parts of code. As I did that last night I don't have any screen shots but to be honest, its quite simple. Here is a screenshot of the Attach window and that is all you have to do.
And from there, I implemented the code in the Class1.cs file, put the Build Mode to Release, and pressed F6 to build the project. This creates the compiled .dll file for you to use and copy across to your LCD studio folder.
I have put up all my work for download here if you want to see it. I just worked out the code from the code sample that was there. To make it work, you also need to add a .plugin file to the LCD Studio folder which is a simple XML file, where the code is available at the same blog post as before. I have also put my entire Visual Studio project available for download
here along with the plugin file and the .dll.
After I moved the .dll file and the .plugin file to the LCD studio folder, I had to restart it a couple of times before it would appear in the Options window in LCD Studio but it eventually came up, and to my delight it worked very well! (It says My Plugin due to my .plugin file I think but it doesn't seem to change - not really an issue for the moment!)
So that's my little intro to my experiences with C# in LCD studio. May end up releasing a more full featured plugin for BF3 or something in the near future, possibly over the summer when I have lots of time on my hands.