Saturday, May 29, 2010

Prism Template Pack for Visual Studio 2010

Prism Template Pack for Visual Studio 2010: "

Now that we have Release Candidate versions of Visual Studio 2010, as well as WPF and Silverlight 4.0, I’ve updated the Prism Templates so that you can more easily develop Prism applications that target these latest releases.

The templates themselves are similar to those I released a while back – there are templates for Shell and Module projects, as well as ‘QuickStart Solution’ templates that provide a complete, pre-configured, multi-module solution that you can use as a starting point for a complete Prism application. All templates are available for both WPF and Silverlight. They are all in C# at the moment. I’ll work on VB.NET versions soon…

I’ve modified the templates a little to use some of the features that have been introduced since Silverlight 2.0. In particular, I updated the QuickStart Solution to use the Silverlight PagedCollectionView class so that the ViewModel can keep track of the current selection automatically.

The biggest change, though, is that the templates now come in a VSIX package and use the Visual Studio 2010 Extension Manager. This dramatically simplifies the installation and management of the templates!! You can download the VSIX package herenote that you will have to change the file extension from .zip to .vsix in order to install it – or you can find it in the Visual Studio Code Gallery. You can also read the Getting Started release notes here.

You can install the VSIX package by simply double-clicking it (once you’ve changed the file extension to .vsix). You’ll be prompted to accept the license but two clicks is pretty much all it takes. When you run Visual Studio 2010 and open the Extension Manager (from the Tools menu) you’ll see the Prism Template Pack is installed. You can uninstall it or disable it from here too.

ExtensionManager

The templates show up in the Visual Studio 2010 New Project dialog under the Prism category. There are Shell and Module project templates, as well as the QuickStart Solution templates, for Silverlight and WPF.

NewProject

Once you’ve created a project using the templates, a ReadMe file will be shown that details the remaining steps you will need to take before the solution will compile and run. This mainly involves updating the project’s references to point to the Prism assemblies on your system. In some cases, you might also have to add Silverlight App References to the Web project so that the projects are linked together properly. I haven’t yet figured out how to do this automatically without requiring some kind of complicated Visual Studio automation but I’m still working on it…

These templates target the Release Candidate versions of Visual Studio 2010, and WPF and Silverlight 4.0. Once they are fully released, I will update the templates with any changes that are required. I’m also hoping that templates like these will be included ‘in the box’ for Prism 4.0.

In the meantime, I hope you find them useful. Let me know what you think!

"

Silverlight 4 + RIA Services - Ready for Business: Authentication and Personalization

Silverlight 4 + RIA Services - Ready for Business: Authentication and Personalization: "

To continue our series, In real business applications our data is often very valuable and as such we need to know who is accessing what data and control certain data access to only users with privilege. Luckily this is very easy to do with RIA Services. For example, say we want to let only authenticated users access our data in this example. That is as easy to accomplish as adding an attribute, see line 2 below.

  1:     [EnableClientAccess]
  2:     [RequiresAuthentication]
  3:     public class DishViewDomainService : LinqToEntitiesDomainService<DishViewEntities>
  4:     {
  5: 




When we run the application, we now get an error. Clearly you can do a bit better from a user experience angle… but the message is clear enough.



image_thumb[93]





Notice there is a login option, so we can log in…



image_thumb[107]





and even create a new user.



image_thumb[108]





and with a refresh we now get our data



image_thumb[97]



And the application knows who i am on the client and gives me a way to log out.



Now you can also easily interact with the current user on the server. So for example, only return records that they have edited, or, in this case, log every access:





  1:         public IQueryable<Restaurant> GetRestaurants()
  2:         {
  3:             File.AppendAllLines(@"C:\Users\brada\Desktop\log.txt", new string[] {
  4:                 String.Format("{0}:{1}", DateTime.Now,
  5:                 this.ServiceContext.User.Identity.Name)});
  6:             return this.ObjectContext.Restaurants
  7:                 .Where (r=>r.Region != "NC")
  8:                 .OrderBy(r=>r.ID);
  9:         }
 10: 




Line 5 is the key one.. we are accessing the current users on the server. This gives us a nice simple log.



3/7/2010 9:42:57 PM:darb

3/7/2010 9:43:05 PM:darb



Now we can also personalize this a bit. Say we want our users to be able to give us a favorite color and we keep track of that on the server and the client, so it works seamlessly from any machine.



First we need to add BackgroundColor to our backing store. I this case I am using ASP.NET profile storage, so I add the right stuff to web.config



image_thumb[103]



Then I need to access this from the Silverlight client, so I add a property to the User instance in the Models\User.cs



    public partial class User : UserBase
    {
        public string FriendlyName { get; set; }
        public string BackgroundColor { get; set; }
    }


Finally, we need to access it on the client. In main.xaml add lines 2 and 3..



  1:   <Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}"
  2:         Background="{Binding Path=User.BackgroundColor}"
  3:         DataContext="{StaticResource WebContext}">
  4:
  5: 




Run it and we get our great default background color!



image_thumb[104]



Now, that is nice, but it would be even better to give the user a chance to actually edit their settings. So in About.xaml, we use a very similar model as above.



  <Grid x:Name="LayoutRoot"
        DataContext="{StaticResource WebContext}">


and



<sdk:Label Content="Background Color:" />
<TextBox Text="{Binding Path=User.BackgroundColor, Mode=TwoWay}" Height="23" />


Then wire up a save button



        private void button1_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            WebContext.Current.Authentication.SaveUser(false);
        }




And it works!



image_thumb[105]



And what’s better is if you run it from another browser, on another machine, once you log in you get the exact same preferences!



image_thumb[106]

"

On Being a Bad Client

On Being a Bad Client: "

http://businessguysonbusinesstrips.com/

I love these posts. But the thing is, they always come from the agency or designer's side. Here, I intend to give you a little insight from the bad client's side. Because even though I think most of my agency partners find me pleasurable to work with, I sometimes see myself in these 'bad clients' posts. I thought maybe I could help bring some perspective to the relationship.

Bad Client Behavior #1: They Want a Ton of Changes At the Last Minute

You, the designer, probably did exactly what you should do. You went through a business requirements gathering exercise, then talked to some actual users (yes, you were that lucky) and delivered an amazing set of wireframes (on time!). And what did you hear from your client? Crickets.

So you pressed ahead. You sent over the visual comp of the homepage expecting everything to go smoothly, when BAM! Suddenly Mr. Bad Client's feedback is flowing and he's telling you, 'We're way off track here!' You get more and more frustrated as the delivery date looms heavily and you have to cancel your plans to see the Human Centipede movie this weekend.

Here's the problem: Most of the time, your bad clients are super busy and just can't wrap their heads around a wireframe. In fact, they probably scanned it for about two minutes and declared it good. The visual comp is the closest thing to a real site in their heads, so that's when they begin providing the feedback you needed earlier in the process.

The fix? I recommend getting to the visual comp phase as fast as possible, and allowing room in the schedule to deal with feedback on the design.

Bad Client Behavior #2: Ugh! They Want You to Build a Site Without Content!

Ok, I'll admit it. I'm guilty of this. I've actually read Kristina Halvorson's book, Content Strategy for the Web. But I've been in situations where I was the primary contact with the agency, and my stakeholders just didn't have the content ready before putting together the site. Sorry Kristina!

After I apologized profusely, the great agency I worked with did the next best thing: They asked what kind of content would go in the various content blocks, and tried to use existing content instead of lorem ipsum. It actually worked out pretty well.

I was able to give them some guidance and examples of content we used in the past. For example, Microsoft is notorious for using long product names, titles of posts and titles of session for our events. So the typical 'Lorem Ipsum' filler text wouldn't work for us. We were able to plan for that.

I believe that you should have your content prior to building a site. But sometimes reality sets in, and you have to adjust to the situation. This agency has a special place in my heart for working with me vs. lecturing me.

Bad Client Behavior #3: They Want To See 10 Different Comps

As a client, I have to admit I like the idea of having choices. And yes, I will always want a Frankenstein of a web site that combines the best of the three you have shown me. Sorry!

But you have to remember: Most clients are not keeping up-to-date on the latest design trends. Helping give them exposure is a good thing.

Also, remember there are a ton of stakeholders (especially in a large company) that have a say-so in the design (or at least who sign my paycheck). So although you may have created one concept to rule them all, it may be more fruitful in the end to let me choose from different concepts.

Bad Client Behavior #4: They're Obsessed With 'Above The Fold'

First of all, let me just say: I'm with you on this one. Also in this bucket is:

  • Can you make the logo bigger?
  • It just doesn't 'pop' for me.
  • Can you make it more clean?
  • Hey! You left some empty space! Can we put a blog roll or a puppy picture there to fill it up?

These are critical moments for educating the client. Explain the 'why'. Another great agency I worked with was really good about explaining what was not on the page, and why. This made it very easy to go back to the stakeholders and explain why something was done (or NOT done).

Bad Client Behavior #5: They're Just Idiots

First, your clients are not idiots. They probably know their knowledge space just as much as you know yours.

That said, I do believe in firing really bad clients. If they don't pay up, if they don't respect you, if they burn you—by all means, you should never do anything for them again. I recommend Zeldman's 20 Signs You Don't Want That Web Design Project.

But take time when you are frustrated to look at it from the client's side.

Now Say You…

Do you agree? Do you disagree? Please let me know what you think in the comments below. I would be particularly interested in bad clients you have dealt with. Did you 'fire' them? Did you have a Jedi-trick you used to get over a rough patch? Please tell me about it below!

Also, follow me or MIX Online on Twitter if you like.

"

MSDN Video: Introduction to ASP.NET 3.5 (Level 200)

MSDN Video: Introduction to ASP.NET 3.5 (Level 200): "While many developers have enjoyed success with ASP.NET development, and have learned the new capabilities with each successive release, there is a significant group of developers out there who did not get involved with ASP.NET from the beginning, and find it hard to uncover a solid learning path for both current and mature ASP.NET technology. This talk assumes no ASP.NET background, and introduces many of the flagship capabilities of the framework, allowing the vast audience of developers who did not start with ASP.NET 1.0 to get on board. At the end of the talk you will have seen many of the core elements of ASP.NET development, with practical examples to help get you started building solutions with the ASP.NET Framework."

MSDN Video: Introduction to Entity Framework (Level 100)

MSDN Video: Introduction to Entity Framework (Level 100): "This is an introduction to the Microsoft ADO.NET Entity Framework, it covers the basics that will help you get started. "

Prism V2.2 Posted to Codeplex

Prism V2.2 Posted to Codeplex: "

The updates to the Prism source outlined here, have been packaged as downloadable release on Codeplex.

This is largely the same code, with these additional items:

  • Added the Quickstarts and Acceptance test projects back in. These are the same as the ones available in version 2.1.
  • A more complete test pass.
  • A smoke test when targeting all projects to .Net 4.0

Additionally, we’ve posted the source to the ProjectLinker that can also work in VS2010. We plan on shortly posting the ProjectLinker to the Visual Studio Gallery, to make it a bit easier to consume.

"