Google Merchant Blog Mentions Edgenet

by Damon Payne 10. January 2011 11:31

The Google Merchant Blog mentiones my project directly:

http://googlemerchantblog.blogspot.com/2011/01/going-to-source-to-improve-product-data.html

We are starting this effort through a business partnership with Edgenet, a provider of product data management solutions. Manufacturers and suppliers can work directly with Edgenet's Ezeedata service to submit high-quality product data and images to Google. For more information, you can visit their website, at www.edgenet.com.

This is the gigantic Silverlight/WCF effor I mentioned before.

{Edit: this post puts us on the "Google Acquisition Watch List" http://searchengineland.com/google-partner-brings-big-data-to-product-search-60711 }

Tags:

Migrated to blogengine.net

by Damon Payne 2. January 2011 20:44

This is a test post!

Hopefully this example post down here works and looks super duper!

http://www.damonpayne.com/2010/06/17/GreatFeaturesForMVVMFriendlyObjectsPart0FavorCompositionOverInheritance.aspx 

Tags:

Blog | BlogEngine.NET

PDC Local 2010 Code and Slides

by Administrator 7. November 2010 20:26

The recent PDC local event was a lot of fun this past Friday.  Clark Sell spoke about “Fun with Visual Studio 2010”, I spoke on putting the finishing touches on your Windows Phone 7 application, and Scott Seely ended the day with a very technical look into some new Windows Azure features announced recently at PDC.

My source code includes some useful items such as a basic Command Binding implementation for Windows Phone 7. 

Download the code and slides here.

Tags:

Edgenet to Provide Google with High-Quality Product Data

by Administrator 14. October 2010 01:40

Yes, I dropped off the map for a while.  A long while.  Friends and acquaintances from the community asked what I was doing.  I can now begin to talk about what I’ve been working on.  There are more announcements to come.

http://www.prweb.com/releases/ProductDataManagement/EzeedataOptimization/prweb4644974.htm

http://www.edgenet.com/index.php/ezeedata-search/product-data-optimization.html

“Ezeedata Search” (as the marketing folks have chosen to call it) is, I suspect, one of the largest Silverlight 4 business application projects in production right now.  My team worked outrageously hard, learned new technology very quickly, and generally overcame ridiculous challenges in order to bring this effort to market.  I can’t show you screenshots yet of what Real Time Data Quality looks like, but it’s a challenging system to bring into an internet deployed smart client application.  There should soon be more official press releases and possibly screenshots or screencasts if I get permission.

Now I’m going to play video games and get some rest.

Tags:

Speaking at the Chicago Silverlight User Group

by Administrator 3. October 2010 18:22

This coming Wednesday, October 6th I’ll be talking about Silverlight and MEF at the Chicago Silverlight User Group.  I will be covering some advanced topics, so even if you’ve seen the usual 100 and 200 level stuff with MEF it might be worth your time to come out this week.

Details and registration can be found at http://chicagosilverlight.eventbrite.com/ 

I’ve been having some questions about when I’ll get back to Shinto, or AGT, or my Great Features for MVVM Friendly Objects series.  This is the last week of my Infamous Deathmarch so I hope to slowly return to normalcy this fall.

Tags:

Speaking at the Rockford .NET User Group

by Administrator 26. September 2010 16:07

In just a couple of days I’ll be presenting “What’s new in Silverlight 4” at the Rockford .NETR User Group in Machesney Park, Illinois.  You can find details here: http://rockforddotnet.net/UserGroup/Meetings/MVVM---The-What,-Why-and-When-(1).aspx .  Yes, the URL does not match the title.  Good think I keep at least four presentations on my laptop at all times.

Tags:

Advanced MEF at St. Louis day of .NET

by Administrator 16. August 2010 17:14

This weekend (Saturday morning) I'll be giving an advanced MEF talk at the St. Louis day of .NET. You can find details here I hope to see some familiar faces there!

When last I looked, this was the only MEF talk at the conference, so I'll try not to suck.

Tags:

MEF Talk at LCNUG

by Administrator 23. July 2010 02:02

Next week Thursday in Grayslake, Illinois I’ll be speaking on one of my favorite new topics, in this case MEF !

You can find directions and register here:

http://www.lcnug.org/Home.aspx

I have a great deal of both entry-level and advanced MEF content and how much we get through will depend upon the attendees.  I’ll be using mostly Silverlight and WPF to demonstrate different bits of MEF-Fu though there may be some surprises too…

Tags:

I’m Back

by Administrator 19. July 2010 04:21

I was out of the country last week.  I managed to not touch a computer or Smartphone of any kind for eight full days.  I even made my wife use the check-in kiosks in the airport.

To everyone who contacted me as part of their recruiting efforts, or were seeking to learn the identities of the MSDN subscription winners, or had technical presentation related questions, I apologize.  I don’t advertise the fact that I won’t be home on the same blog where you can find pictures of my toys ;).

This is only the second time my wife and I have been able to get out together for a no-kids vacation. 

DamonChitzenItza

Tags:

Great Features for MVVM Friendly Objects Part 2 – Change/Dirty Tracking

by Administrator 6. July 2010 01:33

It’s often very useful to know when an object we are editing has Changed.  The most iconic example is the “*” that used to appear next to the title of Word documents once you’d made the first change no matter how small.  It’s not an unusual request that a “Save” button be disabled until the User has made a savable change.  This is often referred to as an object being Dirty.

This article is part of a series about useful MVVM friendly features for your data objects and favoring composition over inheritance.  You can read the other parts:

Dirty Aware

Now that we’ve introduced the idea of Property Change Behaviors, it’s easy for us to flag an object as having changed when we set any property value.  Let’s refer back to the BBGrill object in the Metro BBQ sample application.  I find it’s useful to standardize the HasChanges/Dirty state using an interface. 

/// <summary>
/// Capable of storing and notifying Dirty/HasChanged state
/// </summary>
public interface IDirtyAware
{
    bool IsDirty { get; set; }
    bool SuspendChangeNotification { get; set; }
}

We can now author a new IPropertyChangedBehavior that deals with IDirtyAware instances and sets their IsDirty flag to true whenever a property value changes.

public class DirtyPropertyBehavior : IPropertyChangedBehavior
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="owningInstance"></param>
    public DirtyPropertyBehavior(IDirtyAware owningInstance)
        : this(owningInstance, new List<string>() {"IsDirty"})
    {

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="owningInstance"></param>
    /// <param name="exclusions"></param>
    public DirtyPropertyBehavior(IDirtyAware owningInstance, List<string> exclusions)
    {
        _owner = owningInstance;
        _propertyExclusions = exclusions;
    }

    IDirtyAware _owner;
    List<string> _propertyExclusions;

    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="owningInstance"></param>
    /// <param name="oldVal"></param>
    /// <param name="newVal"></param>
    /// <param name="propertyName"></param>
    /// <returns></returns>
    public bool PropertyChanged<T>(object owningInstance, T oldVal, T newVal, string propertyName)
    {
        if (!Object.Equals(oldVal, newVal) 
            && !_propertyExclusions.Contains(propertyName)
            && !_owner.SuspendChangeNotification)
        {
            _owner.IsDirty = true;
        }
        return true;
    }
}

Note that we can easily provide the ability to exclude certain properties from setting IsDirty, which is very useful for the IsDirty property itself.

Obviously we could put this functionality right inside the property setters but we want to make it easy to add/remove behaviors to objects.

Dirty Grill

Going back to the Metro BBQ sample application, I can now make BBQGrill implement IDirtyAware and also use the DirtyPropertyBehavior to flag when any change has been made.

public class BBQGrill : BindableType, INotifyDataErrorInfo, IDirtyAware
{
    public BBQGrill()
    {
        _changeBehaviors.Add(new DirtyPropertyBehavior(this));

Now, this is useful as we can key business logic off of the IsDirty property, however we can also bind to it in the UI which is just as useful.  Recall the Ideal Grill survey page from Metro BBQ.  We wanted to only enable the Save and Rest buttons once the user had made changes.  Now it’s easy to do so:

 <Button Content="Submit" Margin="10,0,10,0" IsEnabled="{Binding Grill.IsDirty}" />
 <Button Content="Reset" Margin="10,0,10,0"  IsEnabled="{Binding Grill.IsDirty}" />

This gives us the effect that we want in the UI for any property with extremely little code.

Screen default state:

buttonsdisabled

After changing one property:

buttonsenabled

Because of the way we structured Property Change Behaviors we just got a Binding-friendly “is dirty” behavior on all properties of the BBQGrill object.  Once we wrote the DirtyPropertyBehavior we got this essentially for free on all properties without writing extra code for every property.

Suspend Notifications

You may already be thinking of situations where you’d like to temporarily turn this property behavior off.  For example, you might be populating BBQGrill object values from a WCF service and obviously invoking property setters in that situation should not instantly mark the object as Dirty or this feature won’t be very useful.  You may have noticed that the IDirtyAware interface included a SuspendChangeNotification property and that the DirtyPropertyBehavior pays attention to this and does not set IsDirty when SuspendChangeNotification is set to true.  This solves the re-entrant problem but we can do a little better in terms of the developer experience around this code using a context class.

/// <summary>
/// Enable nice using(){} semantics for setting property values without firing Dirty state behaviors
/// </summary>
public class SuspendDirtyContext : IDisposable
{
    public SuspendDirtyContext(IDirtyAware target): this( new List<IDirtyAware> { target } )
    {
    }

    public SuspendDirtyContext(IEnumerable<IDirtyAware> targets)
    {
        _targets = targets;
        int index = 0;
        _targets.ForEach(d => 
        {
            _previousValues[index] = d.SuspendChangeNotification;
            d.SuspendChangeNotification = true;
            ++index;
        });
        _previousValues = new bool[_targets.Count()];
    }

    IEnumerable<IDirtyAware> _targets;
    bool[] _previousValues;

    public void Dispose()
    {
        int index = 0;
        _targets.ForEach(d =>
            {
                d.SuspendChangeNotification = _previousValues[index];
                ++index;
            });
    }
}

In C#, classes that implement IDisposable can be used in using() blocks.  While we’re not really getting rid of any resources here the syntactical sugar is too good to pass up. This SuspendDirtyContext allows us to write nice readable code like the following:

var bbqGrill = new BBQGrill();
using (var ctx = new SuspendDirtyContext(bbqGrill))
{
    //... set initial values
}

The using() block in C# winds up creating try/catch/finally semantics in IL, so even if something causes an exception to be thrown our object state won’t be wonky outside of this scope.  As you can see the SuspendDirtyContext can also handle more than one IDirtyAware instance. 

Conclusion

Knowing when a user has made a change to a data entity through the UI is a commonly requested and useful feature, and implementing it can be pretty easy with the right design of your data entities.  Using the Composition approach makes it very easy to turn this feature on and off for different objects or even different instances of the same type depending on your needs. 

There are still situations that can be easily supported using the same techniques we’ve already demonstrated and these will be explored in the following articles. 

Tags:

About the author

Damon Payne is a Microsoft MVP specializing in Smart Client solution architecture. 

INETA Community Speakers Program

Month List

Page List

flickr photostream