New Open Source Projects

I’m working on a new application that’s going to be open source.  Once it’s a bit further along I’ll provide more details, but essentially it’s a paperless forms solution that encompasses a WPF desktop app, a self-hosted ASP.NET WebAPI service and a Xamarin Forms mobile app all working together.

In the process of getting the foundation up and running, I’m moving a lot of stuff over to Github, but more importantly I’m updating, extending, and creating whole new libraries that can be used for other stuff.  These, too, are open source.

What’s being updated?

  • OpenNETCF.ORM
    I’m primamrily working with SQLite, but I’ve already uncovered and fixed some issues around one-to-many entity relationships
  • OpenNETCF.IoC
    Work and updates to make it more Xamarin/PCL friendly
  • OpenNETCF Extensions
    This thing has been stable and in heavy production use for years.  Support continues for it with some minor changes and improvements in the Validation namespace so far.

What’s New?

  • OpenNETCF.Xamarin.Forms
    Adding things that I’m finding missing or hard in Xamarin’s BCL.  Things like “hey, scale this label to the right size depending on my screen resolution, on any platform”.  Thanks go out to Peter Foot for pointing me in the right direction there.
  • OpenNETCF.MVVM
    No idea why Xamarin didn’t provide a basic navigation framework.  I created one.  Is it awesome?  I don’t know – but it works for my use case (plus 3 other apps I’ve done with it).
  • OpenNETCF.Google.Analytics (moving to it’s own repo soon)
    Again, seems like low-hanging fruit here.  Why isn’t it in the box?  I don’t know, but there’s now a simple, open source library for it.

One note – these are all in active development, so don’t expect a NuGet package updates on them for at least a little while (end of May?).  I’d like to get features in and stable before rolling them out.

Feedback welcome. Testers wanted.  Enjoy.

OpenNETCF IoC now supports Mono for Android (MonoDroid)

In my push to get our fundamental libraries up and working on Mono for Android we’ve added support for OpenNETCF Extensions and OpenNETCF IoC.  What that means is that now you can have a common code for a lot of application infrastructure that works on the Compact Framework, the desktop, Windows Phone, MonoTouch for iOS and Mono for Android.  So you can now create a single, common code base for your applications that includes data access, event aggregation, dependency injection and inversion of control.


Get the latest code over on Codeplex.

OpenNETCF Extensions: Making a REST service call

REST web services are pretty straightforward and really, really common (you used one to read this blog page).  As software gets implemented as services, it’s getting more and more common for us as developers to have to make REST calls programmatically.  Lately I’ve been implementing a lot of services using Padarn on both the device and the PC and then implementing client libraries to access those services.  In doing so, it only made sense to create some infrastructure to make my life a little easier, and so the RestConnector (and DigestRestConnector) was born.


For a simple GET, such as to get the response for this page, the code is trivial:


 

var connector = new RestConnector(“blog.opennetcf.com”);
var response = connector.Get(“/ctacke”);

Other verbs like POST and PUT are nearly as simple.

var response = connector.Post(“/upload”, myData);

For services that require authentication, there’s the DigestRestConnector that behaves the same, except the ctor takes in a UID/PWD pair as well. The classes support the four common verbs I use: GET, PUT, POST and DELETE. Of course since it’s open-source, feel free to extend them as you wish.






The OpenNETCF Extensions library is a collection of extension methods and helper classes that I find useful in a lot of different projects. It’s compatible with the Compact Framework, Tirethe full framework and Windows Phone.

OpenNETCF Extensions: Eliminating Control.Invoke

Marshaling UI access to the proper thread is a very common task in app development, yet it still tends to be a pain in the ass.  You have to check if InvokeRequired is true (well you probably don’t *have* to, but not doing it feels dirty to me) and even using an anonymous delegate tends to be verbose.  And then there are also the simple bugs that are not always easy to spot.

So, like any good developer, I stole someone else’s idea and put it into the OpenNETCF Extensions.  Now, instead of doing this:

void MyMethod()
{
    if (this.InvokeRequired)
    {
        this.Invoke(new EventHandler(delegate
            {
                MyMethod();
            }));
        return;
    }

    // do stuff with the UI
}

You do this:

void MyMethod()
{
    Invoker.InvokeIfRequired(i =>
    {
        // do stuff with the UI
    });
}

Less code.  Less potential for error.  More readable.  What’s not to like?


The OpenNETCF Extensions library is a collection of extension methods and helper classes that I find useful in a lot of different projects. It’s compatible with the Compact Framework, Tirethe full framework and Windows Phone.