The Total App Creator online tool!

by daniel 2. May 2013 13:13

I have built a tool for creating simple and easy to submit Windows Store Apps (C#/XAML).

The tool exploits the grid app from Visual Studio and adds nothing a few tricks here and there to make the life of the developer a bit easier. The tool should be used for learning purposes only, really, because the apps that come out of it has little and static value. Though, in some cases that might okay for certain apps.

image

So please, take a look at http://totalapp.azurewebsites.net/ and have a go at it. If you are from Denmark this has the extra purpose and value of being part of the Developer Achievements program on Facebook.

Take a look at it and try creating an app for the store.

Tags:

A Cover Browser starter kit for Windows Store Apps

by daniel 23. April 2013 12:09

I did another app starter kit, this one based on the website http://coverbrowser.com which provides covers for a whole lot of different cartoon magazine covers.

This starter kit includes a working snap view, a sliding background and some async work. I should be a fairly good starting point for someone who want to learn programming Windows Store Apps!

image

Remeber to check out the GangsterNameYou starter kit as well.

You can fork or download the code for the cover browser app at my Github account.

Tags:

windows store apps

Use AddHandler when working with Routed Events

by daniel 22. April 2013 13:02

Today I felt like I had been drinking to much beer with the dog in the bar, because a simple event handler (PointerPressed) kept not firing when I expected it to.

Looking at the event system of WinRT I could see that the UIElement implements a set of routed events that (hence the name) which each passes through the control stack (parents).

To “catch” the event as you would expect you’ll need to add a handler on the control where the event originates from.

tbFirstname.AddHandler(PointerPressedEvent, new PointerEventHandler(tbFirstname_PointerPressed), true);

Now it will catch your event in given eventhandler specified.

Tags:

windows store apps

A small and easy starter kit for Windows Store Apps

by daniel 22. April 2013 11:32

I really love what the web people inside of the company I work for are doing with the tools and frameworks. They make it easy to pick and choose from a starter kit/template, directly from VS instead of searching for it on Google (where there is basically no starter kits to be found) or Github for that sake. It would add so much more value if the people in the Windows dev division would add the same feature for when choosing a Windows Store project. We still just have those 3 templates available like we did when we came back from BUILD in 2011!

It can be difficult to comprehend all the features at hand when shifting from e.g a browser based environment to Windows apps development, so things like XAML and event bubbling in WinRT might sound like completely nonsense to someone used to do MVC controllers “en masse”. We all need to crawl before we run, right ?

I have talked to a lot of people about the Windows apps stack “level entrance” and the feedback has been that the WinRT platform is failrly lightweight, Silverlight’ish and easy to understand. But a lot of those same people also stated that they don’t have clue about what to “appi’fy”. That might because, primarily, that apps are not like the web and should serve another purpose of something different, catchy, intelligent as well of something that has not been done 3 years ago (not that the isn’t doing that). Those are some hard arguments to contradict, really!

The following template is a piece of cake to understand! It’s even a piece of cake to edit and create other instances of ( with a different name and value perhaps :) ).

I have put “Gangster Name You” on github for you to download, try out and fork. See if you can use it for learning a bit of Windows apps programming, it’s easy enough!

I will be back with more simple templates like this!

Tags:

[DK] Boost dit Developer Achievement level!

by daniel 17. April 2013 13:00

Developer Achievements er åbnet på Facebook og du kan nu få point for at submitte apps til Windows, Windows Phone og sites på Windows Azure. Total gamification!

Du får bla. et point for at melde dig ind i DA og to point for at submitte din første app. De tre point udløser et par høretelefoner med Visual Studio logo som du så kan flashe mens du sidder på jobbet og forsøger at lære JavaScript, eller piller i dine gamle servere istedet for at bestille en virtuel boks på Azure.

image

Deltag i Windows 8 Code Campen for at booste din Developer Achievements level!

Jeg har sat en weekend af for, at du kan komme og kode dine apps, enten starte på dem eller gøre dem færdige. Men vi skal naturligvis også have det lidt sjovt, så jeg sørger for at der er lidt kolde øl, varme pizzaer, et par xboxe og mulighed for at overnatte weekenden over.

Datoen for code campen er d. 10-12 Maj og foregår hos Microsoft i Hellerup. Du tilmelder dig på Geekhub.dk og husk at læse hvad det kræves for at deltage (udover at det naturligvis er gratis!).

 

Code or die!

Tags:

BackgroundDownloader example for Windows

by daniel 16. April 2013 10:37

If you feel like downloading a file in the background of your Windows app, you can use this small of piece code for doing it.

You do the exception handling the way you feel like it, I’ll just throw them for you :)

public async Task DownloadFile() { 
    StorageFile fileToSave = 
        await Windows.Storage.KnownFolders.DocumentsLibrary.
        CreateFileAsync("something.zip", CreationCollisionOption.GenerateUniqueName);

    FileRandomAccessStream stream;
    try {
         stream = (FileRandomAccessStream)await fileToSave.OpenAsync(FileAccessMode.Read);
    } catch (Exception) {                
        throw;
    }

    BackgroundDownloader downloader = new BackgroundDownloader();
    downloader.Method = "GET";

    var operation = 
        await downloader.CreateDownloadAsync(
            new Uri("http://domain.com/file.zip"), fileToSave, stream);
    
    try {
        await operation.StartAsync();
    } catch (Exception) {
        throw;
    }
}

Tags:

Saving stuff to RoamingSettings and LocalSettings in Windows 8

by daniel 15. April 2013 15:25

Under the ApplicationData type in the Windows namespace there are two types we need to look at. Let’s just get the facts straight, which you’d might already have guessed.

RoamingSettings are for saving app settings that will be synced across your Windows 8 devices. This is pretty cool given you sit at work, play WordRecon and suddenly your boss tells you to go home. You go hame and when you come home you open up your Surface and play the same game from where you left off.
LocalSettings is a bit more “local” since this is the place where you save settings that is only meant to be on the local machine. Secret stuff like the picture of the Michael Jackson statue you’ve wanted since last christmas.

Neither of these should be considered as a persistent datastore like your database. Like the type name indicates it’s for “settings”. You can of course “bend the rules” and start experimenting with the store.

How do you use these types ?

It’s very basic to use these to types, really:

public async Task SaveSomething(object data) {
    await ApplicationData.Current.ClearAsync();
    ApplicationData.Current.LocalSettings.Values["someobject"] = data;
    ApplicationData.Current.RoamingSettings.Values["someobject"] = data;
}

public object GetSomething(string key) {
    return ApplicationData.Current.LocalSettings.Values["someobject"];
}

Both setting files are located in your AppData folder, beneath the package ID of your app. E.g: C:\Users\USER\AppData\Local\Packages\PACKAGEID\Settings

Versioning of the data

App updates should not affect already saved data in the settings files. But!

There is one thing to be careful about. That’s versioning of the data you put into the store. You may discover that you’ve written some settings data and after an update of the app, the data is no longer to be found. This has to to with versioning of the files and your data.

If you fall into this akward and hard-to-test-for feature, make sure to add a version number for your data. Like so

await ApplicationData.Current.SetVersionAsync((uint)1, (setVersionRequest) => { });

That is given for both properitary settings and the files you save/create to the Local/Roaming folders as well.

Tags:

Remember to think a bit extra when using async void’s

by daniel 15. April 2013 14:15

I have been caught in this a couple of times, mostly because of lazyness and those fire and forgets that then turn up to be more than that, and throwing exceptions.

Keith Patton over at markermetro has written an excellent blogpost on how to handle these scenario’s. But before you read it try to copy/paste this code into a Win8 app and see what happens when you run it :)

protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState) {
    Error();
}

public async Task Error() {            
    throw new Exception("boo");
}

Respect the code!

PS. Look at this Channel9 video for more background as well.

Tags:

Logo creator for Windows Store apps

by daniel 12. April 2013 14:35

One of the major pains of Windows app submissions is the time spend with the dashboard; uploading and providing details about your apps. Especially if you do a lot of them.

To make your life just a tad easier, I have created a small tool for resizing images for creating logos, needed in your new app. The store logo, the small logo,  the logo “logo” and the splashscreen image.

The code is on github.

Tags:

Someone inside Microsoft made a tool for creating apps

by daniel 26. March 2013 21:13

Have you heard about that new kid in town, called Windows apps ? Someone in the Microsoft ivory tower ran their hand over the magic 8-ball and when it came back showing “more apps” there was no more discussion. More apps is what we need, why not ?!

I think it’s someone in Italy, which i frequently visit for holidays, panforte and great political debates, that has made this marvelous tool, where one can create a Windows Store (or Phone) app in under one Pomodoro sprint. So set your tomato timer and make your app-fingers do the talking.

You’re building apps!  

I forgot to mention that you actually get code to download from the website, so you still get that “I saw the code, felt the build take up some of memory and I am a professional developer” feeling.

Go ahead, try it…

http://www.windowsappframework.com/

Tags:

About Daniel

Technical Evanglist at Microsoft in Denmark.

Community engager by heart.

Software developer by passion.

Learning by failing.