New Series: .NET MAUI — Forget Me Not

My buddy in Argentina, Roberto Juarez, and I have set out to create a real-world, non-trivial program using .NET MAUI. This is a learning exercise, and I’d like to invite you to join us. We anticipate that (eventually) this will be in the stores, and we hope it will be open source (we are discussing a commercial video which might get in the way of giving away the copyright, but the source will definitely be available).

You can see an associated video here.

Associated (partial) code here.

Forget Me Not

This app was conceived and designed by Robin Liberty.

The premise is that you want to buy gifts for your “buddies,” and allow them to buy gifts for you. You start by filling out our form on your preferences (shirt size, favorite books, favorite food, etc. ect.). You then invite others to join (securely). Once they register as your buddy, they can see your list and you can see theirs. You can have as many buddies as you want, but the sharing is always 1:1.

In addition, you can put in shared occasions (birthdays, anniversaries, etc.) and be notified when one is coming up so you have time to buy a gift.

The server will provide an API for the client so that we can manage most of the data in the cloud (certain set-up preferences will be stored locally). In version 1 this is an on-line only app, running only on iOS, Android and Windows (though in theory it should also run on MacOS, watch, etc.)

Getting Started

Rodrigo is busy writing the API and I’ve started the client (he will join as soon as the API is in place). We can only put in about 6 hours a week, and we estimate this to be a 200-250 hour project, so it will span several months.

I expect we’ll publish the source code periodically in case you want to follow along. I’ll be showing the relevant code snippets here as different topics are discussed.

If you are new to .NET MAUI, you may want to start with my 15 part series on creating a simple .NET MAUI application.

What you need

We’ll be developing this using Visual Studio 2022 Preview running on Windows machines. As VS evolves, we’ll keep up to date. Development should work with any version of VS, but we’re using the Professional (your mileage may vary).

Once again, in theory you should be able to create all this in Visual Studio Mac, but we won’t be trying to do so, and as they say “In theory, theory and practice are the same. But in practice, they never are.”

We’ll also be using the Community Toolkit and CommunityToolkit.MVVM nuget packages (they are fantastic and I can’t imagine wanting to write a MAUI app without them).

If you are writing for iOS you’ll also need access to a Mac of some sort.

First Steps

The hard part is usually the first five minutes (okay, and then all the minutes after).

Let’s create some folders we’ll need: View, Model, ViewModel, Services, Helpers are the ones I usually start with (note that the first three are singular, you might to make them plural).

Get the nuget packages (Community Toolkit and CommunityToolkit.MVVM) and modify MainProgram.cs to look like this…

public static MauiApp CreateMauiApp()
{
	var builder = MauiApp.CreateBuilder();
	builder
		.UseMauiApp<App>()
        .UseMauiCommunityToolkit()
        .ConfigureFonts(fonts =>
		{
			fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
			fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
		});

	return builder.Build();
}

Note that you do not need to explicitly name the maui mvvm toolkit here. Also note that you do not want the Microsoft Community MVVM toolkit - that has been deprecated.

Key here is the addition of .UseMauiCommunitToolkit. I recommend reading the documentation on the toolkit before going much further.

In the next posting, we’ll add (and wire up) an About page.

Comments, corrections, and adulation welcome. See comments block below each posting.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Microsoft MVP.
This entry was posted in Essentials. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.