Azure, Cloud, Development, Featured, ITPro, Open Source, Silverlight, Students, USCloud, Web, Windows, Windows 8, WP7, WP8

BizSpark for Startups

My good friend and colleague Taylor Cowan has begun working on a blog post series entitled “25 Ways Software Startups can use BizSpark”.  Even if you haven’t already formed a company around your latest great idea, Taylor’s series will help you understand how startups can take the best advantage of all the amazing features that BizSpark has to offer. Today was Day 6 (I know, I’m a little behind) but there are still 19 more days to come!

Tune into 25 Ways Software Startups can use BizSpark at http://taylorcowanonline.com

BizSpark, for those that don’t know, Microsoft® BizSpark® is a global program that helps software startups succeed by giving them access to software development tools, connecting them with key industry players, and providing marketing visibility.  The program also includes access to Windows Azure, a flexible, comprehensive, and powerful cloud platform for the creation of web applications and services.  In addition, BizSpark offers technical support, business training and a network of over 2,000 partners to connect members with incubators, investors, advisors, government agencies and hosters.  Since it was established in 2008, more than 45,000 companies in over 100 countries have joined BizSpark.

Here is the BizSpark membership critera:

  1. Privately-held company
  2. Less than 5 years old
  3. Earns less than $1M US per year
  4. In the business of developing software (on any platform, with any language, for any type of device)

That means, if you are building a Windows 8 or Windows Phone 8 application that you intend to sell on in their respective marketplaces, you qualify for BizSpark and can get access to ALL of those amazing benefits!  Contact Taylor today via his blog at http://taylorcowanonline.com to find out more about joining the BizSpark family today!

Azure, Cloud, Development, MVVM, Open Source, Silverlight, USCloud, Windows, Windows 8, WP7, WP8

Scaling Collaborative Applications

One of our local MVPs, Michael Perry, has written a great article about scaling collaborative Windows 8 applications with Correspondence and Windows Azure.

Azure is a great way to quickly deploy and scale your web sites. Correspondence is a rich framework for bringing collaborative experiences to multiple platforms. When these two come together, amazing things can happen.

http://qedcode.com/content/scaling-collaborative-applications-azure-and-correspondence

For those that don’t know, Correspondence is Michael’s innovative collaboration framework for occasionally connected smart clients and web applications. Correspondence is hosted on CodePlex at http://correspondence.codeplex.com/ and samples can be found on Michaels blog at http://qedcode.com.

Development, Product Announcements, Silverlight

Silverlight 5 RC Now Available!

The Silverlight team announced yesterday the availability of the Silverlight 5 Release Candidate for public download.

This package is an add-on for Visual Studio 2010 Service Pack 1 to provide tooling for Microsoft Silverlight 5 RC and Microsoft WCF RIA Services V1.0 SP2 Preview (April 2011). It can be installed on top of either Visual Studio 2010 Service Pack 1 or Visual Web Developer 2010 Express Service Pack 1. It extends existing Silverlight 4 features and multitargeting capabilities in Visual Studio 2010 Service Pack 1 to also create applications for Silverlight 5 Beta using C# or Visual Basic.

This download will install all components necessary for Silverlight 5 RC and Microsoft WCF RIA Services V1 SP2 Preview (April 2011) development:

  • Silverlight 5 Beta Developer Runtime
  • Silverlight 5 Beta SDK (software development kit)
  • Update for Visual Studio 2010 Service Pack 1 and Visual Web Developer Express 2010 Service Pack 1 (KB2502836)
  • Microsoft WCF RIA Services V1.0 SP2 Preview (April 2011)

There is also a companion download for Expression Blend for Silverlight 5 available as well.  Expression Blend Preview for Silverlight 5 provides support for creating Silverlight 5 Beta projects, including Silverlight 5 Beta SketchFlow projects.
Expression Blend Preview for Silverlight 5 installs side-by-side with Expression Blend 4.

Get them both today and try them out!

Azure, Cloud, Dallas, Events, Houston, Silverlight, State of .NET, Texas, Web, Windows, WP7

Free “State of .NET” Events!

Two Locations – Houston & Dallas
  • Dallas:   Tuesday, May 24, 2011  1:30 – 4:30 PM
    Microsoft Dallas Office –  7000 SR-161 (George Bush Turnpike), Irving, TX 75039
  • Houston: Thursday, May 26, 2011  1:30 – 4:30 PM
    Microsoft Houston Office – 2000 W Sam Houston Parkway S, Houston, TX 77042

Brought to you by Microsoft, CODE Training & EPS Software, this free afternoon event presents an unbiased look at the current and future development with .NET. Join Microsoft Regional Director and MVP Markus Egger, for an afternoon of free and independent information about current Microsoft development technologies! What is the state of .NET today? Which of the many .NET technologies have gained traction? Which ones can you ignore for now? What other Microsoft technologies should you include in your development efforts? This event is completely free of charge and is designed for developers as well as IT decision makers. Specific prior knowledge is not required. Attendees of this event will come away with a clear understanding of which technologies to use for various technical challenges.

Topics will include:

  • Cloud (Azure & others)
  • The State of Services
  • IE9
  • HTML 5
  • Windows Phone 7 and other devices
  • ASP.NET MVC, Razor and jQuery
  • Visual Studio Async
  • Productivity Power Tools
  • Various .NET Framework Topics
  • Visual Studio LightSwitch
  • and more!

Dallas Signup Link– Tuesday, May 24, 2011  1:30 – 4:30
Houston Signup Link– Thursday, May 26, 2011  1:30 – 4:30

Development, Events, MVVM, Oklahoma, School of Dev, Silverlight, Tulsa, Windows, WP7

Tulsa School of Dev

Mark your calendars – it's time for the annual Tulsa School of Dev community conference!

May 27, 2011 at 700 N Greenwood Ave in Tulsa, OK

[bingMap location=”700 N Greenwood Ave, Tulsa, OK 74106-0702″ zoom=”13″]

6 Tracks!

36 sessions!

Amazing speakers!

Tons of Prizes!

 

All it takes to get in is a donation of 2 cans of food for the Oklahoma Food bank – surely you have some extra canned goods lying around that you can bring with you?  You';ll get some great training on the latest mobile, .NET, SQL Server, SharePoint and Java technologies and help your fellow man along the way.

I will be there, speaking on Blend and WPF as well as discussing the latest in Windows Phone 7 (you've heard of Mango by now, haven't you?)

Come join us for a great time by registering today at http://tulsasod2011.eventbrite.com

Design, Development, Events, MIX, Open Source, Silverlight, Videos, Web, WP7

Getting ready for MIX11

Mix0321_220_ch9[1]The cool dudes and dudettes at Channel9 have started a series of videos leading us up to MIX 11. Each video is only about 10 minutes long, and they’ve got some interesting sounding topics. AS of this post, here are the titles with links to the sessions

Click on these links to see the individual shows, or you can subscribe to their channel to stay up-to-date.

SO – visit the Channel9 site and watch these videos, get all pumped up for MIX11, and visit http://live.visitmix.com and get your registration complete!  I’ll see you there Smile

Arkansas, Development, Events, ITPro, NWA, Silverlight, TechFest, WP7

NWA TechFest–Friday, March 25th

TECHFESTS.COM

Coming to the Center for Non-Profits @ St. Mary’s, for the second year in a row, is the fabulous Northwest Arkansas TechFest!

For those new to TechFest, it is a technical conference with a primary focus to provide training/teaching sessions that are immediately beneficial to the broadest range of IT professionals in their day-to-day jobs. They accomplish this with numerous national and international speakers delivering 75 minute sessions across 10 separate tracks. Even though TechFest is a free event, the organizers ask that you support the community and PLEASE bring TWO CANS or TWO BUCKS. All canned food will be donated to the NWA Food Bank and all proceeds will be donated to the The Jones Center.

NWA TechFest is organized again this year by former MVP, current Microsoft Employee and founder of Tulsa TechFest David Walker. The event is always outstanding with amazing content from the areas best speakers. I’ll be there too, presenting in the Silverlight track on Windows Phone 7 Performance Tips and SketchFlow.

If you think you have the right stuff and want to present at NWA TechFest, submit your talk today!.

For more details, visit the NWA TechFest website.

Cloud, Design, Development, Events, MIX, Silverlight, Web, WP7

MIX11 BootCamps

mix11

This year at MIX11 the team is hosting a series of BootCamp events to help jumpstart and supercharge your development skillz. For a mere $350, you can get in-depth knowledge about some of the latest technologies from some of the smartest folks on the planet.  Here’s the schedule for Monday, April 11:

  • HTML5/CSS3 Boot Camp – Stephanie Sullivan (W3Conversions)
  • Design, Content, Code: Start-to-finish – Roman Blagovirnyy , Tony Walt, Chad Bakeman, Anthony Franco, and Cindy Vanover (Effective UI)
  • Silverlight 5 Boot Camp – John Papa (Microsoft), Mike Taulty (Microsoft)
  • Cloud Boot Camp – To Be Announced
  • jQuery Boot Camp – Joe Marini (Microsoft)
  • HTML5 Canvas Mastery – Lanny McNie (Microsoft), Shawn Blais (Microsoft)
  • Windows Phone 7 Boot Camp – Grant Hinkson (Microsoft), Adam Kinney (Pixel Lab)
  • Silverlight for SharePoint Boot Camp – Paul Stubbs (Microsoft)

For more information about the BootCamps, or anything else about MIX11, visit the website at http://live.visitmix.com/

I’m still not sure if I’m going to be able to make it to MIX this year, but if I do, I’ll definitely be attending the sessions. Of particular interest to me are the HTML5/CSS2 and Silverlight 5 sessions…

Development, Featured, MVVM, Silverlight, WP7

Gestures in Windows Phone 7

A friend contacted me yesterday asking me how to enable some sort of side-to-side scrolling of images, similar to the way to that the Pictures Viewer works. He looked at taking a ListBox, turning it on its side and just scrolling sideways, but it didn’t give him the “feel” that he wanted.  I thought it would be a fun diversion from the other stuff I was doing to use this request as an excuse to start looking at the gesture support in WP7.

As it turns out, doing this was very easy, and only required the addition of 2 libraries – both from the XNA Framework for WP7.  I’ll use this blog post to document how I did it, and hopefully come back later and add some snazzy transitions and other stuff in the future.  I used my Netflix Browser application as the inspiration for this application, so if you’re familiar with what I did there the data access portion will make total sense.  I also used MVVM Light, which is my current favorite MVVM framework, although using MVVM is not necessary for this type of demonstration.

In this application, I have one main page that displays the BoxArt from the currently selected movie. As you swipe left and right, the application swaps out the images, in order, to create a “previous/next” type of effect.  I haven’t added any animations or anything yet – hopefully that will come in a future version. The magic here is all in the ViewModel and the Silverlight Manipulation Events – so lets dive in and take a look…

The ViewModel

We start off by creating a simple view model with two properties:

  • Items – this is a collection of the movies that we’re tracking. In my code I limit this to 20 movies just so things don’t take too long to load.
  • CurrentItem – this is the currently selected item from the Items collection that the UX will data bind to. As necessary, this item switches its source from one movie to the next, with the expectation that the UX will automatically update to reflect the newly selected movie.

I’m also tracking an internal variable, SelectedIndex, that will help us keep track of where the CurrentItem is in the list of Items.  We use logic to constrain this index to the bounds of the Items list so we don’t get any out-of-range or out-of-bounds types of exceptions.

Since the ViewModel is responsible for loading up our data, we need to add that next.  I’ve shown the new OData library before – this time, we’re also responding to the LoadCompleted event on our DataServiceCollection<T> so that we can initialize the SelectedIndex property and the CurrentItem property to correspond with the first item in the list.

private void LoadRuntimeData()
{
    Uri serviceUri = new Uri("http://odata.netflix.com/catalog", UriKind.Absolute);
    NetflixCatalog catalog = new NetflixCatalog(serviceUri);

    Uri queryUri = new Uri("/Titles?$filter=Rating eq 'PG' and ReleaseYear eq 1988&$orderby=AverageRating desc&$top=20", UriKind.Relative);

    _items = new DataServiceCollection<Title>(catalog);
    _items.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(_items_LoadCompleted);
    _items.LoadAsync(queryUri);
}

private void _items_LoadCompleted(object sender, LoadCompletedEventArgs e)
{
    this.SelectedIndex = 0;
    this.CurrentItem = this.Items[this.SelectedIndex];
}

Once the data is loaded, the method that does the heavy lifting here is called ChangeSelectedIndex and takes an integer (+1 or –1) as a parameter.

internal void ChangeSelectedIndex(int modifier)
{
    // validate input
    var selectedIndex = this.SelectedIndex;
    if (selectedIndex + modifier < 0)
        return;
    if (selectedIndex + modifier >= this.Items.Count)
        return;

    // change the index and reset the current item
    this.SelectedIndex += modifier;
    this.CurrentItem = this.Items[this.SelectedIndex];
}

This parameter is used to track the direction of movement within the Items collection and ultimately determines which item needs to be displayed. We do some bounds checking to make sure that we’re staying within the range of the Items collection, but other than that we use it just to find the correct item and set it to the CurrentItem property.

How does this method get called?  We use the MVVM Light Messaging infrastructure to make that happen.  In the ViewModel constructor, I add one line of code to listen for the right message:

Messenger.Default.Register<SelectionChangedMessage>(
    this, (message) => ChangeSelectedIndex(message.Modifier));

At this point, everything is wired up and we're ready to move on to the UX

The User Experience

Once the ViewModel is created, we need to build the UX.  This time, instead of a ListBox to display all the downloaded movies, we’re using only an Image control that’s been configured to respond to user gestures. In Silverlight for WP7, we do that through 3 different event handlers:

  • ManipulationStarted – user is initiating a gesture (pan, flick, etc)
  • ManipulationDelta – user gesture is “in progress”
  • ManipulationCompleted – user has completed gesture (removed fingers, etc)

Each of them are valuable in their own right, but for our purposes, we only want to track the times that a user completes a gesture so that we can respond to it.  To make sure that I captured the gesture from anywhere on the page, I added an event handler to the PhoneApplicationPage object (the root of our XAML document). 

For the next part, Silverlight itself does not contain all the framework bits to do what we want it to.  For additional help, we’re going to bring in 2 of the XNA libraries.  For those of you playing along at home, you’ll need to add 2 references:

  • Microsoft.Xna.Framework
  • Microsoft.Xna.Framework.Input.Touch

These libraries serve to extend our gesture-handling capabilities allowing us to capture all the data related to these gestures and use them in our applications.  Without these references included, we’d get compile errors saying that certain types we were trying to access were not defined in the project, and suggest that we were missing some project references.

Now that the references are in place, we can finish configuring our gesture listener.  Inside the codebehind for the page, we do a little bit of testing to make sure we are tracking the right kind of gesture, and send the processing on to the Messaging infrastructure.

private void Image_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
{
    while (TouchPanel.IsGestureAvailable)
    {
        // Read and respond to the current gesture
        GestureSample gesture = TouchPanel.ReadGesture();

        if (gesture.GestureType == GestureType.Flick)
        {
            // determine direction
            var modifier = gesture.Delta.X > 0 ? -1 : 1;

            // send message to ViewModel
            Messenger.Default.Send<SelectionChangedMessage>(new SelectionChangedMessage(modifier));
        }
    }
}

In this code, we first check to make sure that we’re actually responding to a real gesture using the IsGestureAvailable property of the TouchPanel object (yep – this is one of those XNA objects I was telling you about).  To limit the scope of what gestures we want to work with, we can also add the following line to the constructor to tell the TouchPanel that we’re only interested in Flick gestures:

TouchPanel.EnabledGestures = GestureType.Flick;

Once we’ve determined that we’re working with a Flick gesture, we have to figure out whether the user was flicking to the left, intending to go to the next picture, or flicking to the right, intending to go back.  Luckily for us, that’s really easy to do with the GestureSample class’s Delta property.  The delta we want is along the X axis, tracking left to right or right to left movement.  If  the GestureSample.Delta.X value is positive, that means the user flicked from left to right, indicating that they wanted to move back in the picture stack. If the GestureSample.Delta.X value is negative, the user flicked from right to left and wants to go to the next picture (I know, this sounds upside down, but really – it does work).

When we have the direction the user wanted to go, we can set the index modifier to either +1 (next picture) or –1 (previous picture) and send it to the VM.  We do this through the Messaging infrastructure provided by MVVM.  I created a simple class called SelectionChangedMessage that has only one int property, Modifier, to express that value.  Once dumped into the message bus, the ViewModel will pick it up, run the code we wrote earlier, and switch out the current picture with the next one.  Magic!

At this point you might be saying to yourself "gosh Chris, I thought with MVVM we weren't supposed to have any code in our codebehind files?” To that I say "nay, nay". Code in the codebehind is perfectly acceptable so long as what you're doing relates to the UX itself. If you're manipulating business objects, or doing something related to business or data access logic, then you definitely need to work in the VM.

Summary

Adding gesture support to your WP7 application is really easy – it’s a bit trickier to make some nice looking transitions between elements, or within gestures. I hope to add to this post later with some tips on how you can do that. For now, you can download the code from this post using the link below.