Monday, 15 August 2011

Windows Phone Training with Andy Wigley and Rob Miles

Just to let you know there is online training for Windows Phone 7 courtesy of Andy Wigley from Appa Mundi and Rob Miles from The University Of Hull, which is based mainly on the new features of Mango (Windows Phone 7.1) including relevant topics like Multi-tasking, Application Data Storage with Database CE, and Windows Azure.

Day One August 23, 2011 | 8am-4pm PDT | Live online training

• Building Windows Phone Apps with Visual Studio 2010

• Silverlight on Windows Phone – Introduction

• Silverlight on Windows Phone – Advanced

• Using Expression to Build Windows Phone Interfaces

• Windows Phone Fast Application Switching

• Windows Phone Multi-tasking & Background Tasks

• Using Windows Phone Resources (Bing Maps, Camera, etc.)

Day Two — August 24, 2011 | 8am-4pm PDT | Live online training
• Application Data Storage on Windows Phone

• Using Networks with Windows Phone

• Windows Azure and Windows Phone
• Notifications on Windows Phone

• XNA for Windows Phone

• Selling a Windows Phone Application

What’s a “Jump Start” Course? | Training specifically designed for experienced developers and technologists whose jobs demand they know how to best leverage new, emerging Microsoft technologies. These advanced courses assume a certain level of expertise and domain knowledge, so they move quickly and cover topics in a fashion that enables teams to effectively map new skills to real-world situations.

Here is the sign up link https://www.eventbuilder.com/microsoft/event_desc.asp?p_event=m58m12c5

Thursday, 7 July 2011

Plants vs Zombies review

Having heard all about the rave of Plants vs Zombies in the mobile gaming world, and that Microsoft have backed the game to be top 6 games, I had to find out yourself why this game got some commotion and praise.
The simple tower defence game entails you to set various plants on the outlay of the garden to block hordes of zombies going along the same of line of path to the house, you have to prevent them from entering and strategically put them for them to fire projectiles (flower power I guess) to the kill the zombies after several attacks till they simply drop and fall apart.
Even though I had thought that graphically, Popcap had made it as simple in design as possible in terms of cheery cartoon visuals I thought they have bitten off more than can chew (excuse the pun for the title), but I was wrong. The thing I like is that it is simple as possible, the menu at top to select sunflowers, pea shooters and cherry bombs, and other plants are clear and simple, with the notion that 100 sunshine items gives you another plant to purchase to place in the garden. I thought that maybe too simple but the faster the sunshine drops, the quicker you need to place convert these to plants and place them on the garden (if you are too slow, you're gonna get bitten and infected, not literally).
The thing I like is the sheer simplicity of it all which is why it is my top 6 Windows Phone games, the instructions are brief and clear even the storyline is so ever simple, and you can see how many zombies you need to attack at the start of each stage. The thing that entices you in, is the fast pace action of it all, and the quirkiness of the enemy zombies which they are dressed as leading protesters holding signs up, to wearing eighties' back-up dancer leotard's, the light humour of it all even gives you the happiness to possibly hug the zombies rather than destroy them.
For the arsenal, the various plant types you can do to attack such as daisies in the first stage, to cacti and cherry bombs that make the attacks very interesting like blasting zombies to smithereens usually ending in a nasty mess, and there's even wall-nuts to block enemies to go further to save you time.
Achievements are easily viewable in the game and attainable as well linking with Xbox achievements like Soil Your Plants for planting ten peashooters to Explodonator for planting 10 cherry bombs that explode successfully.
The other thing is the multiversity of strategic gameplay, you can place the pea shooter attackers to throw projectiles to the back so they can attack further without being eaten whilst the sunflowers can be near the front, and you don't know where to see the zombies walk on which path so its all guesswork, and whether you wait 1 minute more to get the more devastating attack plants, it's this open end style to gameplay which makes the game worthwhile.
All in all, the game is brilliantly poised.

Wednesday, 6 July 2011

Isolated Storage Tips #3

It has been a while since I wrote more Isolated Storage Tips, so I am going to explain a bit more about the various useful coding implementations in Isolated Storage in terms of creating text files, writing to it, and then later reading that data and appending to it.

Here is the code: -

using System.IO;
using System.IO.IsolatedStorage;
using System.Windows;
using Microsoft.Phone.Controls;

namespace WP7IsolatedStorage
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}

private void btnSave_Click(object sender, RoutedEventArgs e)
{
string fileName = "mytestfile.txt";

using (var isoStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
// 0. Check to see if the file exists
if (!isoStorage.FileExists(fileName))
{
// file doesn't exist...create it.
isoStorage.CreateFile(fileName);
}

// 1. As we are appending to the file, we use FileMode.Append
using (var isoStream = new IsolatedStorageFileStream(fileName, FileMode.Append, isoStorage))
{
// opens the file and writes to it.
using (var fileStream = new StreamWriter(isoStream))
{
fileStream.WriteLine(txtText.Text);
}
}

// 2. Cannot read from a stream that you opened in FileMode.Append.
using (var isoStream = new IsolatedStorageFileStream(fileName, FileMode.Open, isoStorage))
{
// opens the file and reads it.
using (var fileStream = new StreamReader(isoStream))
{
txtCurrentText.Text = fileStream.ReadToEnd();
}
}
}
}
}
}


In point 0, we have created an IsolatedStorage File object that creates and holds the physical location of the Isolated Storage, and we then check if a current object file exists, if it doesn’t then we can create a new one.



In point 1, once we find out the file exists, we open the file which we called the object here isoStream, and set it to FileMode.Append which we then use the StreamWriter class to write to it. It is then, the contents of txtText.Text is stored into the object isoStream, where that line is appended to the file.



In point 2, finally, we have to use the using annotation again as you cannot read whilst appending. We then set the StreamReader, and use the code fileStream.ReadToEnd() to read the whole file, and place it into the txtCurrentText textbox.

Monday, 4 July 2011

How to redirect to error page in view?

Recently I made a forum answer post to how you can redirect to a customised error page in ASP NET MVC 2 for error pages?

Here is the answer: -

<customErrorsmode="On"defaultRedirect="CustomErrorView" >
<errorstatusCode="404"redirect="Error/Error404" />
<errorstatusCode="500"redirect="Error/Error500" />
< /customErrors>

The controller:

public class ErrorController : Controller
{
// Return the 404 not found page
public ActionResult Error404()
{
return View();
}

// Return the 500 not found page
public ActionResult Error500()
{
return View();
}
}


This could be done with a static page if needed:



<customErrorsmode="On" >

<errorstatusCode="404"redirect="Static404.html" />


< /customErrors>



The link to the forum post is http://forums.asp.net/t/1693685.aspx/1?How+to+redirect+to+error+page+in+view+

Friday, 1 July 2011

Free icon set for GUI designers on WP7, Android and iPhone

I wanted to make a blog post on some really good simple toolbar icons in particular for the WP7, and I have found a few of these.

First is the Noun Project which has a “Metro” themed design style to the icons, it is a collective collaborative effort by designers that uses free pictograms and icons and contains so far 500+ icons in the “Metro” theme. It is run and community funded by www.kickstarter.com (the largest funding platform for creative projects) which the CEO (Perry Chan) gave some really insightful talks at the Guardian Summit (thumbs up to them). It is called www.thenounproject.com and its funding is going really well at $14,366. You get a free t shirt of 3 icons of your choice if you fund them of over $30.

The other is Gentleface Toolbar Icon Set made for GUI designers, it is along the same vein of “Metro” styled icons with 8 sets of cursors and 296 icons in black and white versions. The free version gives away the entire set totalling 304 original icons in 32-bit PNG format optimized for 16x16 pixel size and available in 16x16, 32x32 and 48x48 pixel sizes. This is given as a license for the Creative Commons as a non commercial product but if you want the royalty free license which includes .eps and even Flash SWF formats, this costs $29.99 if you want to use these commercially. See http://www.gentleface.com/free_icon_set.html.

Monday, 20 June 2011

WP7 Mango Phones leaked out used in Italy

According to some reports, some people have got their hands on the WP7 Mango developer phones a bit earlier than anticipated according to the Dude WIMU application which shows that 67 phones run “other versions” of the OS out of the 14,595, and as a WP7 developer, its most probably from the user agent taken from the phone and logged into their application when they made the HTTP request notably the 7.10.7605 build.

See the below snippet: -

WMPU today dug up a couple of instances of Mango running on current handsets, first off they picked up on Alessandro Teglia @alead, Community Program Manager for CEE and Italy Microsoft, tweeting about using Mango features on his HTC Mozart. and continues to do so.

alead_mango_tweets_thumb

alead_bingmusicsearch_thumb

There is also a video associated with this also.

This will cause a slight uproar on when they are actually releasing the WP7 Mango phone, as already developers have their hands on it a lot sooner than most people expected. If they keep to their word rather than guessing and throwing surprise updates and announcements, this update on the phone and new handset releases can help dampen the damage that’s already caused to the Microsoft ecosystem or will it play down again to the guessing game.

You can see on the video that the guy is showcasing mostly the Avatar, and it can interact more than the standard version 7, but I expect there to be more notable updates in the future, but obviously you can see they have made full use of the Shake gestures in WP7.

Friday, 17 June 2011

Pet List

Here are snippets of code which I found really useful when setting a drop down list element using HtmlHelpers in MVC 2 to a ViewData to be displayed on the view pages.

Dim petList As List(Of String) = New List(Of String)
petList.Add("Dog")
petList.Add("Cat")
petList.Add("Hamster")
petList.Add("Parrot")
petList.Add("Gold fish")
petList.Add("Mountain lion")
petList.Add("Elephant")

DialogScreenView.ViewData("pets") = New SelectList(petList)

or…..

Dim petList As List(Of String) = New List(Of String)

For Each petName In oPetList.PetList
    petList.Add(petName.Text)
Next

DialogScreenView.ViewData("pets") = New SelectList(petList)

DialogScreenView.ViewData("Screen") = TempData("Screen")

or….


Dim petList As New List(Of SelectListItem)()

For Each petName In oPetList.PetList
    Dim petItem As SelectListItem = New SelectListItem
    petItem.Text = petName.Text
    petItem.Value = petName.Value
    petList.Add(petItem)
Next

DialogScreenView.ViewData("pets") = petList

DialogScreenView.ViewData("Screen") = TempData("Screen")

Sunday, 5 June 2011

Pivot Controls discovered

I started working on my WP7 again, only to discover that I need some form of tabbing on it, and having investigated Pivot Controls but never use it, now would be the best time to look into in depth.

Having used the tag <controls:Pivot >….</controls:Pivot> inside the <Grid> tag, Visual Studio didn’t recognise this tag, baffled I looked a various samples, but most of them seem to point that you need the controls tag, else there was no namespace for WP7 to adhere to.

Upon discovery by accident, I realised from the Panorama demo, you must require the header reference in the XAML, the naming inside the PhoneApplicationPage: -

xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"

Finally I could get the Pivot Controls working as a result Smile

You can denote your Pivots as structured below as the barebones: -

<controls:Pivot Title="header" Name="pivot1">

    <controls:PivotItem Header="item1">

     ………..contents of PivotItem of item1 here…….

    </controls:PivotItem>

     <controls:PivotItem Header="item2">

     ………..contents of PivotItem of item2 here…….

     </controls:PivotItem>

     <controls:PivotItem Header="item2">

      ………..contents of PivotItem of item3 here…….

      </controls:PivotItem>

</controls:Pivot>

Having seen the way Pivots are structured, they seem very simple to code, and for effective as a result, and makes your application less cluttered and more ordered in its layout.