Category Archives: Wndows Forms

Forms-based desktop applications

How to Subclass .NET Classes from IronPython

To subclass .NET classes in IronPythion, tell the Python engine instance runtime to load the assembly; then, use the fully qualified namespace in your Python code. Continue reading

Posted in Libraries, Wndows Forms | Tagged | Leave a comment

Running FluentMigrator Migrations at Runtime

You can run FluentMigrator migrations at runtime, through code. You need to reference the `FluentMigrator.Runner` package, and with some sample code, you can easily check the current/latest version and update to the latest (or to a specific) version. Continue reading

Posted in Libraries, Web, Wndows Forms | Tagged , | Leave a comment

Mocking Base Class Methods with Moq

Moq does allow you to mock base class methods, via the use of the Moq.Protected namespace. You can read about it here. Imagine you have the following scenario: class Animal { private int timesTalked = 0; public void Talk() { … Continue reading

Posted in Libraries, Web, Wndows Forms, WPF | Tagged | Leave a comment

From C# To Javascript and Back Again, Via ClearScript

I created a simple Interactive Fiction engine in C# which exposes a few classes and allows users to write their games in Javascript. It’s awesome, honest. I used ClearScript for the back-end, and worked through some type conversion issues. Continue reading

Posted in Libraries, Wndows Forms | Tagged , | 1 Comment

From C# Ruby and Back Again, via IronRuby

I created a simple Interactive Fiction engine in C# which exposes a few classes and allows users to write their games in Ruby. It’s awesome, honest. I used IronRuby for the back-end, and worked through some type conversion issues. Continue reading

Posted in Libraries, Wndows Forms | Tagged , | Leave a comment

Deserializing to Dynamic with RestSharp

You can use JSON.NET to convert any RestSharp service response to a list of dynamic instances; you just need a bit of plumbing code to do it. Continue reading

Posted in Libraries, Silverlight, Web, Wndows Forms, WPF | Tagged , | 6 Comments

Writing Automated Performance Tests

I found a memory leak in my application, and wrote an automated test using GC.GetTotalMemory to tell if objects were leaking or not. They were (20MB of them in 100k instances). Continue reading

Posted in Core .NET, Silverlight, Wndows Forms, WPF | Tagged , | Leave a comment

DriveInfo: Total vs. Available Free Space

DriveInfo.AvailableFreeSpace gives you free space with quotas applied; on the other hand, TotalFreeSpace gives you the total, physical amount of empty space on the drive. Continue reading

Posted in Core .NET, Wndows Forms | Tagged | Leave a comment

Running Windows Services in Visual Studio

You can run a project that’s a Windows service with an infinite loop (yes, really) by invoking the service and waiting. Forever. You can do this conditionally (while not debugging), instead of running ServiceBase.Run. Continue reading

Posted in Core .NET, Wndows Forms | Tagged | Leave a comment

Using Enumerations as Bit Flags

You can use enumerations as bit flags. The FlagsAttribute is optional; more importantly, you need to assign powers of 2^n to the enum’s values. Depending on the .NET version, checking can be easy (.HasFlag) or hard (bitwise AND operation) Continue reading

Posted in Core .NET, Silverlight, Web, Wndows Forms, WPF | Tagged , | Leave a comment