Windows Phone 7 Passing Data Between Applications

Windows Phone 7 Passing Data Between Applications

So you really want to transfer data between application in Windows Phone 7? If so, then here’s how you can do it by leveraging the pictures hub. Essentially the pictures hub is exposed to your application through the MediaLibrary class that forms part of the xna namespace. One of the things you can do with the pictures hub is that you can save an image into the “saved pictures” folder using the medialibrary.SavePicture method. It doesn’t take a rocket scientist to realise that an image is just an arrangement of bytes and that you can of course include data embedded in the image.

Now I’m not an expert in the field of embedding data into an image, so I’m sure there are much better/cleaner and more efficient mechanisms for doing this but here’s a simple code snippet that will embed a text string into an image returned from the CameraCaptureTask:

void camera_Completed(object sender, PhotoResult e)
{
    var buffer = new byte[e.ChosenPhoto.Length];
    e.ChosenPhoto.Read(buffer, 0, buffer.Length);
    var bytes = Encoding.UTF8.GetBytes(this.TextToSend.Text + new string(‘ ‘,20-this.TextToSend.Text.Length));
    Length.Text = bytes.Length.ToString();
    for (int i = 0; i < bytes.Length; i++)
    {
        buffer[i+100] = bytes[i];
    }

    var x = new MediaLibrary();
    x.SavePicture("SendDataImage.jpg",buffer);
}

Essentially we’re writing a string of 20 character into the image (there is an indent of 100 characters to avoid the image header). To read this string back out, either in the same or a different application you simply reverse the process.

private void ReadDataButton_Click(object sender, RoutedEventArgs e)
{
    var x = new MediaLibrary();

    var pict = x.SavedPictures.First((pic) => pic.Name == "SendDataImage.jpg");
    var strm = pict.GetImage();
    var buffer = new byte[strm.Length];
    strm.Read(buffer, 0, buffer.Length);
    var len = 20;
    var bytes = new byte[len];
    for (int i = 0; i < len; i++)
    {
        bytes[i] = buffer[i + 100];
    }
    TextSent.Text = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
}

Windows Phone 7 Deep Dive Workshop visiting Perth

Windows Phone 7 Deep Dive Workshop visiting Perth

Brian’s already blogged thisbut I’d thought I’d reiterate the point. The Windows Phone 7 Deep Dive Workshop I’ve been running in the capital cities is coming to Perth. Get in early to secure your place at this workshop. Anyhow, here are the details:

Date/Time:     14 & 15th October

Cost:                FREE

Venue:             Enex100 Perth, Seminar Room, Level 3, 100 St Georges Terrace

Registration:  Click this link…

 
Prerequisites:

To get involved, you need Silverlight/WPF, C# .NET Framework skills and you should have completed a subset of hands on labs from the following:

The workshop will be run by Nick Randolph (that’s me!) from Built to Roam.  In case you’ve been wondering I’ve been working with Windows Phone for quite some time and have just a few blog posts talking about developing for Windows Phone. You can find my blog, here (http://nicksnettravels.builttoroam.com)  and my public profile at https://mvp.support.microsoft.com/profile/Nick.Randolph

Course Content (approximate schedule):
Day 1
  • Session 1: Introduction and Windows Phone User Experience Overview
  • Session 2: Animation, Orientation and Overlays
  • Session 3: Application Lifecycle, Navigation, Application Tiles and Notification
  • Session 4: Tasks and Touch
  • Session 5: Working with the Accelerometer, Sounds and Location
Day 2
  • Session 6: Connecting and Consuming the Web
  • Session 7: Retrieving, Storing and Synchronizing Data
  • Session 8: Silverlight Analytics, Unit Testing and other Frameworks
  • Session 9: Security, Authentication and Performance

Resco MobileLight Toolkit Beta download available for Windows Phone 7

Resco MobileLight Toolkit Beta download available for Windows Phone 7

On the eve of the release of the development tools for Windows Phone 7, Resco have released a beta version of their MobileLight Toolkit. I posted a while ago on a prototype wheel control I built. I’m happy to say that Resco have a similar control for date and time picking that absolutely rocks – it behaves just like the real date/time selectors on the device.

image

For more information check out the Resco MobileLight Toolkit website

Samsung Galaxy S: Android messes things up

Samsung Galaxy S: Android messes things up

One of the things I’ve struggled with over the last couple of months is that I have never owned or developed for Android. Whilst I don’t see this as a limitation, I do feel that I’ve become somewhat overly biased against Android – it is quite common to dismiss what we don’t know. Over the weekend I decided to take action, so I’m now the owner of a shiny new Samsung Galaxy S (Oh, did I mention I’m also paying $30 less per month on my new phone plan!). This post covers some initial thoughts I’ve had in the few hours that I’ve been using it.

Firstly, the hardware, whilst significantly lighter, is very reminiscent of the iphone 3G. In fact, the Samsung experience in general is very much an iphone knock off. That said, it’s much snappier than the iphone 3G I have running iOS4. I’m yet to see what the final Windows Phone 7 hardware will be like.

My complaint about Android has always been that it was designed for the tech crowd. Unfortunately the Galaxy S didn’t disappoint. Like HTC, Samsung have opted for a black box, which opens up to reveal the device. The screen was covered with protector that was coloured with a mess of icons. After digging through the rest of the box to find the battery I managed to boot the device, only to see another mess of icons, this time on the home screen.

The user experience of the Galaxy S is actually not that bad, but it does require a bit to get used to. There are all sorts of things that you can tweak and configure, ranging from the 7 home screen panels through to which services (eg GPS, WiFi) are running. I definitely like having the program meter widget which you can click on to give you a list of running apps and the ability to kill them. Of course, this does bode the question as to why you need this – wouldn’t it be better to control how apps can use the resources of the device?

Connecting the device to the desktop was another challenge in itself. Why do all these phones insist on having heavily desktop companion software? After a lengthy install process and some painful digging to update drivers I managed to get the device connected and syncing. One big thing for me over the prototype WP7 device I’ve been working with was the ability to do internet sharing (aka tethering). This actually worked pretty smoothly and was quick!

Personally my overall feeling about the Galaxy S is that it’s a great device for the technically inclined but to be honest way way way way too complex for the average consumer out there. “Long live the Google geek” – it’s a bit of a myth that everyone likes technology, a bit like “pervasive connectivity” . Like all the hype around Linux, Android will only make it big once they get that building a great phone is about end user simplicity. I should turn it on and it should work!

Windows Phone 7 Deep Dive Workshop (Adelaide) and the SQL Server User Group (Conor Cunningham)

Windows Phone 7 Deep Dive Workshop (Adelaide) and the SQL Server User Group (Conor Cunningham)

For those interested in attending the Windows Phone 7 Deep Dive workshop in Adelaide later this month but also want to attend the SQL Server User Group where Conor Conningham (Query Optimizer guru) will be presenting, fear not. As part of the WP7 workshop we will make sure we align the lunch break so that you can attend the user group session.

Full details for the Windows Phone 7 Deep Dive Workshop (follow link for all cities and to register):

Date: 27th-28th September
Venue: Board Room | Level 26, Santos House, 91 King William Street Adelaide SA 5000

Day 1
  • Session 1: Introduction and Windows Phone User Experience Overview
  • Session 2: Animation, Orientation and Overlays
  • Session 3: Application Lifecycle, Navigation, Application Tiles and Notification
  • Session 4: Tasks and Touch
  • Session 5: Working with the Accelerometer, Sounds and Location
Day 2
  • Session 6: Connecting and Consuming the Web
  • Session 7: Retrieving, Storing and Synchronizing Data
  • Session 8: Silverlight Analytics, Unit Testing and other Frameworks
  • Session 9: Security, Authentication and Performance

 

Full details for the SQL Server User Group (Adelaide):

Venue: L2 Westpac House (91 King William St, cnr Currie St) 
Duration 12:00-14:00
On: Tuesday, 28 September 2010

So how does SQL Server pick which plan to run? If you’ve ever wanted to get a better understanding of how the Query Optimizer works, this is the talk to attend. Come listen to a member of the Query Processor development team explain how a query goes from SQL to the final plan. This talk will cover conceptual topics like how query trees are built and how the optimizer stores all of the alternatives it is considering. Additionally, the talk will examine examples in areas including index matching, parallel query generation, and update processing so that you can apply these concepts to better debug your own queries using the same techniques.

Conor Cunningham is a Principal Software Architect at Microsoft on the SQL Server Query Processor Team. He’s worked on database technologies for Microsoft for over 10 years and is holds numerous patents related to Query Optimization and Query Processing. Conor is the author of a number of peer-reviewed articles on query optimization techniques. Recently, he authored a chapter for the book "Microsoft SQL Server 2008 Internals" on how the Query Optimizer works. He publishes a blog called "Conor vs. SQL" (where he answers questions about databases.

Conor will be joining us via LiveMeeting. If you are unable to attend in person, please ask Rob Farley for the link so that you can join remotely.

Windows Phone 7 Deep Dive Workshops (Melbourne, Sydney, Adelaide and Brisbane)

Windows Phone 7 Deep Dive Workshops (Melbourne, Sydney, Adelaide and Brisbane)

Update: This event is FREE! Register by clicking the links below but please make sure that you read the prerequisites and only register if you 110% able to make it for the two days in your city.

…coming to a city near you

Are you interested in Windows Phone 7 Development? Are you keen to get ahead of the competition to create apps for the Windows Phone 7?

Windows Phone 7 is a fresh exciting mobility platform and potentially a land of opportunity for killer apps! These “Free of Charge” workshops are designed to take your skills to the next level beyond the online training kits and helps you explore some more complex scenarios.

Prerequisites:

To get involved, you need Silverlight/WPF, C# .NET Framework skills and you should have completed a subset of hands on labs from the following:

The workshop will be run by Nick Randolph (that’s me!) from Built to Roam.  In case you’ve been wondering I’ve been working with Windows Phone for quite some time and have just a few blog posts talking about developing for Windows Phone. You can find my blog, here (http://nicksnettravels.builttoroam.com)  and my public profile at https://mvp.support.microsoft.com/profile/Nick.Randolph

Course Content:

Day 1
  • Session 1: Introduction and Windows Phone User Experience Overview
  • Session 2: Animation, Orientation and Overlays
  • Session 3: Application Lifecycle, Navigation, Application Tiles and Notification
  • Session 4: Tasks and Touch
  • Session 5: Working with the Accelerometer, Sounds and Location
Day 2
  • Session 6: Connecting and Consuming the Web
  • Session 7: Retrieving, Storing and Synchronizing Data
  • Session 8: Silverlight Analytics, Unit Testing and other Frameworks
  • Session 9: Security, Authentication and Performance

When/Where and Registration:

  • Melbourne: 20th-21st September
    • Exhibition Room| Level 5, 4 Freshwater Place, Southbank VIC 3006 | Map
    • Register Now >
  • Sydney: 23rd-24th September
  • Adelaide: 27th-28th September
    • Board Room | Level 26, Santos House, 91 King William Street Adelaide SA 5000 | Map
    • Register Now >
  • Brisbane: 29th-30th September
    • Theatre 2 | Level 9, Waterfront Place 1 Eagle Street Brisbane QLD 4000 | Map
    • Register Now >

We look forward to seeing you there!

Windows Phone Team

Microsoft Australia

PS – please register soon as places are limited