Windows Phone 7 – Starting out

July 28, 2010 mikehole 5 comments

The one thing about having to take a train home after an event is that is gives you a chance to create a blog entry after it, yesterday was a long day so please forgive any mistakes!

Yesterday I attended the very 1st UK windows phone user group in London. Thanks to the following people for arranging this: Matt Lacey (@wpug), EMC Consulting UK and of course Michelle Flynn.

If you are thinking of or are already writing applications for the windows mobile phone then events like this are well worth attending. For the following reasons:

  1. You get to meet likeminded people and exchange ideas, problems and solutions.
  2. The event is likely to be attended by a representative from the Microsoft DPE team (people with the best jobs ever). If you ask them something that they don’t know they will know someone who does know.
  3. You are likely to get feedback from people on the application you are in the process of developing.

The event comprised of a talk on XNA development followed by group of 5 demos showing the efforts of us passionate people who obviously have bought into the windows phone platform and it’s developer tools  these demos were from @treeuk, @davehawes, @keyboardp, @hosainnet and me). – correction thanks to Matt’s comment I left out a demo sorry :-s.

There was even a prize (an Xbox) for the application that most deserved it. Howard Scott and I both demonstrated the path finder application that we are in the process of developing. Howard gave the visuals a run through and I showed the app (I should say mumbled about the app – note to self to work on your annunciation / demonstration technique).

Finally the Paul Foster from Microsoft gave a presentation on the platform and the market place – I am sure that there were more slides but he never really got that far a his presentation was hijacked by the QA element.

One thing that I defiantly learnt from the meeting was that you really should sign up for the market place as soon as you can. If you are feel that you may be due a developer phone and you haven’t got a market place membership if may be a few days before you can unlock the phone.

After the meeting I was asked by a couple of people how I managed to add a panoramic. And pivot controls to our application. I used the controls found here http://phone.codeplex.com/ By the way don’t think that if you use this control you are going to have to re work a lot of code after the event to use the official controls from Microsoft.

For the interactive mapping element within the application I used the Bing Maps Silverlight control. This isn’t really supported by Microsoft for the phone platform and won’t actually work with the multi touch gestures (and is therefore not possible to zoom out without using an application bar button).

Again I see no harm in developing with this control for the time being because fingers crossed Microsoft will be providing a phone based version of the control (well if it’s in Silverlight why not the phone too). To get the control running in your application follow what’s in this blog entry: http://www.silverlighthack.com/post/2010/03/21/Using-the-Silverlight-Bing-Maps-control-on-the-Windows-Phone-7.aspx.

Another element of phone application development that I didn’t really demonstrate was the cashing of remote images. This will be key to the Snow + Rock application as the application must be able to present content when a phone signal will be limited or non-existent. For this I have taken code from the following blog post: http://www.ben.geek.nz/2010/07/one-time-cached-images-in-windows-phone-7/. I have had to add code to ensure that URI’s are safe for file name use (in case you are using the asp.net development server where the inclusion of a port number will break the file name).

That’s all for now, there is more to come and I can’t obviously give away too much about our application in case people copy the thing outright.

By the way in the end we didn’t win the Xbox,  congratulations to the winner more deserved since his app was done in his own time.

Categories: Phone, WP7

Dynamics CRM 4 with Silverlight Part 1 – The IFRAME approach.

April 24, 2010 mikehole 1 comment

Introduction

29/72010: Sorry but I am going to be dropping this series because my software focus has change to developing Windows Phone 7 applications. Maybe re visit this in the future (hopefully before CRM 5 is released Winking smile

Hi, this is part 1 of a series of posts giving an introduction to extending Microsoft Dynamics using Silverlight.

In this post I will outline how to add a custom Silverlight control to any of the entity forms.

For these articles I will be using Visual Studio 2010 Professional with All of the usual Silverlight (version 4) tools installed.

At Sequence the company where I work we make use of the eService accelerator this allows our customers to log cases via an extension to our web site.  For this series of posts I am going to create a new tab in the contact entity screen that will display details of the contacts log in details that are stored in a separate ASP.NET authentication database.

How it works

The CRM 4 entity forms allow administrators to customise forms in many different ways but the one way that makes things handy for us is the ability to add IFRAME elements into a form. We will use this customisation to display a Silverlight control inside the form.

 

 

Getting Started

Create a new Silverlight application as normal ensuring that you enable RIA services and create a test web project.

NOTE: In future when you will want to make this live you will need a server available that you can add the .Net framework 4 and host the web site or virtual directory.

Identifying the Entity

So that the Silverlight application knows what entity it is using it will need to be passed the Id of the entity that is being displayed in the entity form. To ensure that this works when you add an IFRAME customisation to an entity you will need to ensure that the I frame is passed the record ID and type:

image

This results in the following URL:

http://localhost:40363/ContactDashboard.aspx?type=2&typename=contact&id={299390EB-049E-DE11-A280-00155D801211}&orgname=Sequence&userlcid=1033&orglcid=1033

To get these values into my Silverlight application I have decided to use Silverlight parameters. To do this I first added the following code to the ASPX page that displays the application:

public string SilverlightParams

{

 

    get

 

    {

       

string sRes = string.Format("id={0},type={1},orgname={2},typename={3}",

            Request["id"], Request["type"], Request["orgname"], Request["typename"]);

 

   return sRes;

    }

}

Then in the page mark-up I added the following to the params for the Silverlight application:

<param name="initParams" value="<% = SilverlightParams %>" />

So we get this:

 

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"

   width="100%" height="100%">

 

    <param name="source"   

      value="ClientBin/Sequence.CRM.SilverlightExtensions.MainDashboard.xap"/>

 

    <param name="onError" value="onSilverlightError" />

 

    <param name="background" value="white" />

 

    <param name="minRuntimeVersion" value="4.0.50303.0" />

 

    <param name="autoUpgrade" value="true" />

 

    <param name="initParams" value="<% = SilverlightParams %>" />

 

    <a href=http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50303.0

        style="text-decoration:none">

 

   <img src=http://go.microsoft.com/fwlink/?LinkId=161376

       alt="Get Microsoft Silverlight" style="border-style:none"/>

 

    </a>

 

</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>

Making the App Know the entity Id

In the Silverlight application project I added the following to the App class code:

 

private Guid? m_ContactID = null;

 

public Guid? ContactID

{

 

    get

    {

 

        return m_ContactID;

    }

}

In the Application_Startup method:

 

private void Application_Startup(object sender, StartupEventArgs e)

{

 

    if (!string.IsNullOrEmpty(e.InitParams["id"]))

        m_ContactID =

new Guid(e.InitParams["id"]);

 

   

    this.RootVisual = new MainPage();

}

We can now access the ContactID anywhere in the code like this:

((

App)App.Current).ContactID

 

Just checking

Here is a screenshot of a simple app in an I frame just to show it works:

image

In part 2 I will show how to hook this app up to the ASP.NET authentication database.

 

Bookmarking …

April 21, 2010 mikehole Leave a comment

Here is something I blogged about in a previous post but then lost:

http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/ASPNET/check-your-msn-status-from-asp-net

Thank god other people blog about these things too :)

That just can’t be right…

April 15, 2010 mikehole Leave a comment

… can it? I am sure I am paying for 20Mbps.

Categories: Uncategorized Tags: ,

Microsoft getting stick for using Flash again.

April 13, 2010 mikehole 2 comments

Somehow I missed it but Microsoft launched a new phone platform recently (Kin). This comprises of two phones that have quite different factors but have one main purpose, to be the users social hub.

To promote the new phones Microsoft have put together a web site that gives the usual brochure-ware details about the product etc.

The Kin web site has been created using  Flash as a method of delivering the rich experience rather than Silverlight.

This has created the usual mutterings from people on Twitter with as you can guess the word ‘Fail’ being used quite a bit.

This really does rattle my cage. I for one can see why Microsoft have used Flash for the front end of the site and yes it is because of the market penetration that Flash currently has over Silverlight.

Imagine if you had a brand new product and you wanted to sell it to the masses but you told the people at the top that although 60% of the web population will get to see it straight away the other 40% will have to download an app first. You have to agree that the people at the top would ask you what pills you have been taking recently. You so have to go with market share on this one.

I am however reserving my bets for the fact that Kin Studio will be written in Silverlight. Kin Studio is the online face of the social aspect of the phones and it looks to be a good showcase of what can be achieved with the Microsoft technology stack including Azure, Silverlight and the new Windows Mobile 7 (platform). If Microsoft have used Silverlight for Kin Studio they will be increasing their penertration of silverlight and you never know maybe oneday they will have enough of a share that they will launch a new product / site with silverlight as the 1st thing people see.

I just hope I am not let down!

BTW: I imagine I will get some flames from this but hay I am sure it won’t be as much as Microsoft themselves.

Categories: Flash, Kin, Silverlight Tags: , ,

And so it starts!

April 11, 2010 mikehole Leave a comment

Tomorrow we see the launch of Visual Studio 2010 and Silverlight V4.

I for one can’t wait as it will give me loads to blog about!

Technorati Tags: ,
Categories: Silverlight, VS2010 Tags:

Move to wordpress…

April 9, 2010 mikehole Leave a comment

Ok after trying to find the time to get my blog running on Oxite (now moving to Orchard) etc. I have decided that the time is never going to happen and wordpress is the way to go.

Categories: Uncategorized