Moskus Moskus - 5 months ago 20
Vb.net Question

Getting started with Windows 10 Universal Apps

I'd like to get a jump start on developing Universal Apps for Windows 10. I thought it would be fairly easy, as 1) Universal Apps are already available for Windows 8.1 and 2) Microsoft keep telling us how awesome they are. I therefore concluded there would be many good examples out there.

I was wrong.

Or: I have yet to find them.

I'm no expert, I'm just a hobby developer. I know VB.net, but have gotten into C# in the later years too. I know the basics and then some for Windows Forms, WPF, asp.net and Windows Phone apps.

I've found several tutorials and templates for Windows 8 Universal Apps (some even on Microsoft Virtual Academy). They are easy to follow and offer explanations on what is really going on and why they do certain things in a specific way. The problem is that these don't necessary work great when trying to convert an app to Windows 10.

What I need is a simple sample with:


  1. The hamburger menu

  2. A couple of Pages with simple navigation

  3. A Settings page that saves the settings

  4. (Optional) A way to save state



Everything I've found so far is either based on Windows 8.1 and can't be ported easily, or is based on Visual Studio 2015 RC or 2013, and something has changed since Windows 10 was released.

I'm used to struggle a bit when learning something new, but now it's like there's a new huge obstacle around every corner regardless of which route I take.

Any pointers? :)

Answer

You will need Visual Studio 2015 in order to build and deploy Universal Windows Platform apps, because they utilise NuGet 3.0, and with that, a different package structure. Google "Universal Windows Developer Tools" for those.

For the Navigation Manager, when I started building my UWP app, back in the Technical Preview, I copied the Navigation Helper, Relay Command and Suspension Manager from the Windows 8.1 App Template, and then removed the #IF Windows_Phone and #IF Windows(I believe those are it). Compilation statements (and their containing code For #IF Windows Phone only), although you could probably leave it in, just there is some Windows Phone BackRequested functionality baked in there that I didn't want. It does provide Save and load state functions that you build into the page, if you look into the Navigation Helper Class.

You could instead, check out Jerry Nixon's Template 10: Here, I haven't used it personally because I have already spent over 190+ Hours building my app, it would be a lot of work to switch out the Base (I have already re-written a lot from learning bindings, then x:Bind during development, and I only truly discovered how to make Events and Event Handlers and operating them throughout the app globally just the other day). Template10 is a much cleaner, and probably better Base Template for Making an App than what is provided by Visual Studio by Default.

A Sample of a SplitView APP can be seen here, it is another sample by Jerry Nixon, and it uses MVVM, which is probably a good habit/Structure to learn.

As for saving settings, use ApplicationData.Current.RoamingSettings.Values[_Your Key Here_] = _Object_; Which serializes and stores it in your AppData as a string in a secure Dat file.

To get your object/value back all you need to do is (T)ApplicationData.Current.RoamingSettings.Values[_Your Key Here_]; T being a generic for the Type of object you want to retrieve from settings. You can learn more from MSDN, Google: "Guidelines for app data MSDN", which should provide you with helpful guides (unfortunately I can only have two links in my post).

Hope that helps