WPF in LOB

Not to overflow you with too many TLA (Three Letter Acronyms) but one of the most talked about things in the WPF world is, is it ready for Line-of-Business?

The purpose of this post is not to debate if it is ready, but rather link too 2 videos of WPF applications used in LOB environment!

Lawson Smart Office brings WPF goodness to the enterprise

This is a very detailed video of how the Lawson application works… It is a very slick user interface build using WPF… and it rocks!!!

[UPDATE] Here is another one done by Frog Design (http://windowsclient.net/learn/video.aspx?v=48556)

Billy Hollis on Getting Smart with WPF

Billy Hollis has a EXCELLENT example of real world use of WPF

Do yourself a huge favor and check these 2 videos out… well worth it!!!

PS. If you really have time for more TLA… learn more about CAL, CAG, CAB, MEF, etc…

Here are 2 podcasts that will get you on your way:

Episode 11- Glenn Block on Prism, Unity, and MEF (part 1)

Episode 12- Glenn Block on Prism, Unity, and MEF (part 2)

And as always, if you found it useful, please kick it on DotNetKicks.com

Posted by rudi | 2 comment(s)

RoboHum V2 (Part 2 – The operating system)

 

If you missed part 1, please read it here

Next in our series of upgrading RoboHum from V1 to V2, we decided to change our operating system from Windows XP Embedded to Windows CE.

The only real problem I ran into here was that I first downloaded the board support package (BSP) for the EBOX-2300 (Not realizing that I should have actually downloaded the EBOX-2300SX). Here is the links for the board support package, etc

Windows CE 6

Vortex86SX Windows Embedded CE 6.0 BSP Version B (2008-07-24)

Windows Embedded CE 6.0 step by step guide

Windows CE 5

Vortex86SX Windows CE 5.0 BSP Version D5 (2008-05-06)

Demo images are also available on the www.vortex86sx.com website!

Now that we have a hardware platform running Windows CE, we can start focusing on the software development. The first problem we have is that we have to turn digital IO’s on and off!

Here is a PDF explaining the IO layout of the EBOX-2300SX-JSK

Now that we know which address spaces we need to access, we need direct IO access!!! The following CodeProject article has a nice explanation on how to do direct IO access in managed code…

In old DOS days we had inp() and outp() functions to do direct IO access. I took what I learned from the previous CodeProject article and made a wrapper that allow me to make direct IO calls. I also made my library so that it works in .NET Framework and .NET Compact Framework. Here is a example of how to use it:

int value = RudiGrobler.DirectIO.PortAccess.inp(0x300);
RudiGrobler.DirectIO.PortAccess.outp(0x300, 0xFF);

My library uses SXIO.dll in CE and winio.dll in Win32. In my wrapper I just call the correct P/Invoke based on the current operating system type!

And that is it for part 2, in part 3 we will dig into the actual Robotic Studio 2008…

RoboHum V2 (Part 1 – The hardware)

 

Ok, this is a 3 part series that I had on the back-burner for a while… never had the time to finish it!!! Well, after listening to a DotNetRocks show #364 (Stacy Harris Does Home Automation!) I decided it is time to finish it! For more info about RoboHum V1, read the post here!

The first part of this series will cover the hardware… The new “PC” I selected is the VERY cost-effective EBOX-2300SX-JSK from DM&P.

Here is a comparison between RoboHum V1 & RoboHum V2

  RoboHum V1 RoboHum V2
Hardware Wafer-LX EBOX-2300SX-JSK
OS Windows XP Embedded Windows CE 6
Estimated Cost (Including board, storage, RAM and OS) R3000 ($375) R1200 ($150)
Supplier www.ieiworld.com http://www.compactpc.com.tw/
CPU AMD Geode LX800 MSTI PSX-300 SoC-366MHz

The Wafer-LX is a excellent board but way to over-speced (and priced) for the real hobbyist type user. I selected to rather use the more cost effective EBOX-2300SX-JSK from DM&P. The added benefit of using this board is that it has a 24-bit onboard GPIO (Which we can use to control the motors)

The EBOX-2300SX-JSK is often used in the robotics space (I think it was also the default equipment used in the Imagine cup – embedded). Here is some pictures of other people using the EBOX in robotics

 

Now that we have a hardware platform we can use, in part 2 I will cover the operating system. This is the next huge change between V1 & V2. We now make use of Windows CE!!!

Posted by rudi | 2 comment(s)

Disposing my crap…

[UPDATED] OK, ignore this post and read the IDispose Guidelines. This is a very lengthy post but well worth the read!!!

 

When using unmanaged resources, you have 2 options cleaning up after using the resources:

1. Override the Finalize.

Pro: Finalize() is called by the GC… just implement it and be sure that the GC will call it

Cons: Performance hit

2. Implement IDisposable

Pro: Lightweight and easy to implement

Cons: Developer must remember to call Dispose() (And we are only human)

Why not combine the 2?

public class MyUnmanagedResource : IDisposable
{
    ~MyUnmanagedResource()
    {
        // Cleanup resources
   
}

    public void Dispose()
    {
        // Cleanup resources

       
GC.SuppressFinalize(this);
    }       
}

Now this might seem a little excessive but I have a Dispose() that can be called by the developer to do the cleanup (This will also ensure that the finalize never happen by calling GC.SuppressFinalize(this)) but if he “forgets” to call the Dispose(), the finalize does the cleanup!!

 

 

 

Over-engineered, maybe! But it is SAFE…

Posted by rudi | 4 comment(s)

Slides and demos from Tech-ed

I had a few emails asking for my slides and demos so here goes:

DEV314 - Building Data Driven Applications using Windows Presentation Foundation
Most rich applications present data, often lots of it. To avoid writing lots of code to support the presentation of that data, you should take full advantage of the data binding capabilities of your presentation platform. This session discusses and demonstrates the data binding capabilities of Windows Presentation Foundation (WPF). It explains what data contexts are and how they work with the element hierarchy. It shows you what Bindings are, how to declare them, and what optional capabilities they support. It demonstrates binding to data sets as well as custom objects and collections, and discusses the considerations for implementing those types. The session shows you how to use data templates to define reusable chunks of UI that can be rendered automatically for each item in a data collection. It also discusses the way you can interact with your bound data programmatically to control the presentation of that data and to make changes to it in code.

Slides

Demos

Comments:

The Good

  • Gave me a starting insight into what to expect if I start doing it but nothing concrete to work with yet. But the ideas presented gave a direction to expect. Lunch was a little distracting as well which didn't help.
  • It would have been better if I knew something about the topic. But a good experience still

The Bad

  • Presenter was not engaging and did not seem confident on the topic
  • mostly duplicate content
  • I actually only got the tail end of the presentation, so my eval may not be fair

The WTF?

  • I DID NOT ATTEND THIS SESSION, BUT BOOKED IT IN THE SESSION PICKER! DON'T KNOW HOW TO "UNBOOK". Please disregard ratings!

DEV315 - Five Cool Things to Know and Use for Smart Client Development with Microsoft Visual Studio 2008 and the Microsoft .NET Framework 3.5
While the world has gone overboard with building Web applications and many developers are focusing purely on the server-side, there are still huge opportunities for creating compelling rich client-based applications that play well in the software-plus-services world. With over 50 minutes of demo time, in this session we explore five new enhancements in Visual Studio 2008 and .NET Framework v3.5 for building smart Windows applications. Demonstrations include Windows Presentation Foundation interoperability, ADO.NET Sync Services, Client Application Services, the Managed AddIn Framework, and customizing Office Applications (Visual Studio Tools for the Microsoft Office System v3.0).

Slides

Demos

Comments:

The Good

  • Good one, need more of these, for all tools.
  • Rudi could become a firm favorite in future sessions! Absolutely brilliant presentation enabled by a high level of comfort with his subject matter.

The Bad

  • The presentation was not always providing solution for smart clients! Maybe the title should be FAT Clients! Did not touch on some IsolatedStorage namespaces or one click client updates; things that are very important for Smart Clients. And also cannot say it was an Advanced course; Maybe 'Intermediate'. Thanks
  • Description was not what was presented on.
Posted by rudi | 3 comment(s)

Silverlight 2 + WCF Service Deployment Issue

While deploying a very simple Silverlight application using a Silverlight enabled WCF service, I ran into this little problem:

On my development machine hosting the app using the normal VS host (By running the app using F5) everything works perfectly (Creating a random port number for the app and service)

If I now deploy this app and service to my production machine, the Silverlight app works but it can’t access the WCF service!!!

Things I double checked:

  1. Make sure the Silverlight application runs. If not, add the MIME types
  2. Make sure the service is working

My service is called MISService.svc so to check that it worked, I opened it in IE (http://localhost/MISService.svc)

If both your Silverlight application and service work, it might indicate a cross domain boundaries problem, here is a document how to fix it.

If it still doesn’t work, try the following:

The problem is that in the ServiceReference.ClientConfig file (Created by using VS Add Service Reference), the endpoint is setup with a specific port number (1192 in the following example)

<client>
  <endpoint address="http://localhost:1192/MISViewerWeb/MISService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MISService"
        contract="MISViewer.MISServiceReference.MISService" name="BasicHttpBinding_MISService" />
</client>

 

 

 

Now if I create the client, I get a UnexpectedHttpResponseCode exception. Here is the code that creates the service client

MISServiceClient client = new MISServiceClient()

To make it work again, I changed this to the following


Uri address = new Uri(Application.Current.Host.Source, "../MISService.svc");

MISServiceReference.MISServiceClient client = new MISServiceReference.MISServiceClient("BasicHttpBinding_MISService", address.AbsoluteUri);

This bypasses the ServiceReference.ClientConfig file!

If you found this useful, please kick it on DotNetKicks.com

The WPF DataGrid is finally here!!!

Well, their is a huge hype surrounding the release of .NET Framework 3.5 SP1 & Visual Studio 2008 SP1! The one release that has silently gone unnoticed is the release of the WPF DataGrid (CTP)

The binaries and source is available for download here

Here is a list of some of the features:

  • Auto-generation of Columns. Simply hook up the DataGrid to an ItemsSource and at runtime it will auto-populate with variety of pre-built column types. You can also hook into column generation events to modify the columns as they’re created, or specify columns in the XAML.
  • Variety of Column Types. Text, CheckBox, ComboBox, Button, and Hyperlink columns are standard column types. You can also use the TemplateColumn to create your own custom column.
  • Row and Column Headers. Headers for both rows and columns can be toggled on and off.
  • Grid Lines. Horizontal and vertical grid lines can be toggled on and off and styled.
  • Column Width Behaviors. Columns can be set to auto-size to header or cell content, fill the remaining space (* behavior), respect max and min values, or set to an absolute width.
  • Cell Editing. Edit cell content and submit changes back to the database.
  • Selection. Row-only, cell-only, or row and cell selection can be enabled.
  • Keyboard Navigation. The entire grid can be navigated with keyboard only.
  • Column Resizing and Reordering. Columns can be resized and reordered programmatically or by the user through drag and drop in the UI.
  • Column Sorting. Columns support sorting and multi-sorting by end-user and programmatically.
  • Fully Style-able and Template-able. The DataGrid and all of its elements are fully style-able and template-able. Customize the look and feel of the grid, or make it look nothing like a grid at all (e.g. card view).
  • Add and Remove Rows. Add new items to the DataGrid or delete items from it. Customize the default value for a new row.
  • Row Validation. Create groups of validation rules to apply to rows.
  • Filtering/Grouping Support. Support for filtering and grouping data through CollectionViews.
  • Clipboard Operations. Built-in Copy support with extensibility for Cut and Paste.
  • Performance. Strong performance for scenarios with thousands of rows and many columns.
  • Read more here

    [UPDATE] Here is a short CodeProject article on how to get started!

    Vincent Sibal has a excellent post about the DataGrid

    Jaime Rodriquez has a EXCELLENT 3 part series on how to customize the DataGrid (Part 1, Part 2 & Part 3)

    If you found this blog post useful, please kick it on DotNetKicks.com

    Tech-ed South Africa 2008 Review

    Just finished my first Tech-ed and I must admit that this was a eye opening experience!!! Although speaking at Tech-ed looks easy… think again!!!

    Here is a list of my favorite sessions I attended:

    Introduction to Microsoft Sync Framework (DAT316) & Unlocking the Power of Microsoft SQL Server Compact Edition 3.5 (DAT304) by David Russell

    Optimizing your WPF Application (DEV318) by Tamir Khason

    First glance at Composite Application Library (CAL) for WPF by Ayal Rosenberg

     

    Developing solutions with LINQ to SQL – Lessons from the trenches by Hilton Giesenow

    [He did not pose for a picture :(]

    Why should I use Windows Workflow Foundation by Ron Jacobs

     

    The opening and closing keynotes was brilliant, Stephen Attenborough from Virgin Galactic showed a video of their first test flights!!!

    Although my main interest is UX technologies, I think the idea about Tech-ed is you should challenge yourself and attend sessions you know nothing about…

    What about my sessions… As expected, my first session had me very nervous and I rushed it a bit (10 minutes early) but the second talk was way more relaxed…

    Now I just have to wait to see the ratings…

    Posted by rudi | 3 comment(s)
    Filed under:

    My Podder Skins

    Well, the extended deadline for the Podder skinning competition is fast approaching (4th August 2008). Today is my last day at the office (Tech-ed preparation) so I decided to post what I have… I created 2 skins and both of them are pretty simple:

    The old skin (WMP11), and

    And my slightly newer skin (iTunes)

    Here is the source

    Both these skins are based on design work done by Jose Fajardo

    If you have time this weekend and want to also enter, here is the basics:

    • Follow these instructions on how to create a blank skin (or download the template here)
    • Binding to the collection of available podcasts (Master)
    <ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Podcasts}" />
    • Binding to the collection of episodes for the selected podcast (Detail)
    <ListBox x:Name="_podcastsListBox" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=.}" />

    • Add buttons to play, pause and stop active episode
    <Button Content="Play" Command="Play" />
    <Button Content="Pause" Command="Pause" />
    <Button Content="Stop" Command="Stop" />
    
    • Bind slider to current volume
    <Slider Minimum="0" Maximum="100" Value="{Binding Path=EpisodePlayerSettings.Volume}"

    • Information about active episode
    <TextBlock Text="{Binding Path=EpisodePlayerSettings.ActiveEpisode.Name, Mode=Default}"/>
    • Information about active podcast
    <TextBlock Text="{Binding Path=EpisodePlayerSettings.ActivePodcast, Mode=Default}" />

    This is just the basics to get started… but dig round in this applications architecture… It’s a learning experience!

    For more information

    The WPF Podcatcher Series - Part 1 (Introducing Podder)

    The WPF Podcatcher Series - Part 2 (Structural Skinning)

    The WPF Podcatcher Series – Part 3 (The Podcast Management Conundrum)

    And if you want some inspiration, check out this creative skin created by Gary Winter

    Posted by rudi | 2 comment(s)
    Filed under:

    ConferencePlanner: Tech-ed South Africa 2008

    Well, in less than 1 week Tech-ed will start. As mentioned earlier, I am very busy preparing for my first Tech-ed… But probably the most difficult part of preparing for Tech-ed is deciding which sessions to attend! As a side project, I created ConferencePlanner! ConferencePlanner allow you to select sessions to attend! Although the Tech-ed website offer a planning service, it doesn’t allow multiple sessions to be selected per time slot or filter by track!

    To download ConfrencePlanner, click here or here (ClickOnce)

    Features

    Mark multiple sessions as favorites

    Filter sessions by track type

    More detail on the fly

    The project will also be released on CodePlex.

    Disclaimer

    As this is a project in my spare time I do not have the resources to ensure that all the sessions are still on their initial allocated time… Please double check you selected sessions!

    Also thank you to Eben for his valuable input in making this application!!!

    And as always, if you found this useful, please kick it on DotNetKicks.com

    Posted by rudi | 2 comment(s)

    Cars SmashPack©

    My 2 year old son is currently on a Cars phase! From the morning he wakes up till the evening he goes to bed all he wants to watch is Cars! I have been playing around with BabySmash and decided to modify it a little so that it randomly create characters from the cars movie (if he pressed the non alphanumerical keys). Unfortunately I am not going to release the modified code (The pictures might be copyright protected) but I will show what I did to make it work… here is a screen capture of the application running:

    Before you begin, please read the following blog entry:

    Learning WPF with BabySmash - Factories, Interfaces, Delegates and Lambdas, oh my!

    Currently, BabySmash creates UserControls for each “cool” shapes using the FigureGenerator. I created a UserControl for each “character”. Here is the UserControl

    <UserControl x:Class="BabySmash.McQueen"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="300" Width="300">
        <Grid>
            <Image x:Name="Face" Source="Images\McQueen.png" Stretch="Uniform"/>
        </Grid>
    </UserControl>

    All this UserControl does is render the picture of the character

    public partial class McQueen : IHasFace
    {
        public McQueen(Brush x)
            : this()
        {
            //this.Body.Fill = x;
        }
        
        public McQueen()
        {
            InitializeComponent();
        }
    
        #region IHasFace Members
    
        public Visibility FaceVisible
        {
            get
            {
                return Face.Visibility;
            }
            set
            {
                Face.Visibility = value;
            }
        }
    
        #endregion
    }

     

    Each UserControl also derives from IHasFace and must have a constuctor that can take a Brush as a parameter!

    Now that we have all our characters, all that is left to do is modify the FigureGenerator

    private static readonly List<KeyValuePair<string, BrushControlFunc>> hashTableOfFigureGenerators = new List<KeyValuePair<string, BrushControlFunc>>
    {
       new KeyValuePair<string, BrushControlFunc>("Mater", x => new Mater(x) ),
       new KeyValuePair<string, BrushControlFunc>("McQueen", x => new McQueen(x) ),
       new KeyValuePair<string, BrushControlFunc>("Tractor", x => new Tractor(x) ),
       new KeyValuePair<string, BrushControlFunc>("Hudson", x => new Hudson(x) ),
       new KeyValuePair<string, BrushControlFunc>("Red", x => new Red(x) ),
       new KeyValuePair<string, BrushControlFunc>("Sally", x => new Sally(x) ),
       new KeyValuePair<string, BrushControlFunc>("Mack", x => new Mack(x) ),
       new KeyValuePair<string, BrushControlFunc>("Luigi", x => new Luigi(x) ),
       new KeyValuePair<string, BrushControlFunc>("Chick", x => new Chick(x) ),
    };
    And that is it!!! Now you have a hacked SmashPack©
    Posted by rudi | 5 comment(s)
    Filed under: , ,

    WPF Links - 21 July 2008

    Sorry for not blogging anything for the last few weeks but things are very busy at this moment... preparing for Tech-ed 2008 South Africa, 2 projects at work's deadlines approaching fast, etc... I have so many half written blog post but I should hopefully be back too normal soon then I will finish and post them! For now, I thought I will just post a link list of WPF related posts I found useful the last 2 weeks!

    WPF

    • Dr WPF has posted the next letter in his A to Z series covering the ItemsControl

    ItemsControl- 'G' is for Generator

    • Josh Smith has written a MUST READ article about data binding in WPF

    My first article in MSDN Magazine

    WPF Validation Simplified

    • Check out Robby Ingebretsen's new website

    http://nerdplusart.com/

    Composite Application Guidance for WPF

    Official Website: http://msdn.microsoft.com/en-us/library/cc707819.aspx

    Codeplex: http://www.codeplex.com/CompositeWPF

    Composite Application Guidance is Live

    Composite Application Guidance - What is it?

    Composite Application Guidance for WPF

    Frameworks! Frameworks! Frameworks!

    Prism Becomes Composite Application Guidance for WPF

    Composite Application Guidance for WPF (Prism) Tour - Part 1

    BabySmash

    Official Website: http://www.hanselman.com/babysmash/

    Codeplex: http://www.codeplex.com/babysmash

    Learning WPF with BabySmash - Making a Transparent Window with Substance

    Learning WPF with BabySmash and Back to Basics - Making Assumptions and When to Turn to Books

    Learning WPF with BabySmash - Customer Feedback and a WPF Font ComboBox

    Learning WPF with BabySmash - MVC or MVP and the Benefits of a Designer

    Learning WPF with BabySmash - Factories, Interfaces, Delegates and Lambdas, oh my!

    Learning WPF with BabySmash - Pushing things up a level with another set of eyes

    Learning WPF with BabySmash - Speech Synthesis

    Learning WPF with BabySmash - Configuration with DataBinding

    Introducing BabySmash - A WPF Experiment

    Also listen to this podcast

    Blend

    Everyone wants to make a carousel

    • Expression Blend team also released the June preview

    Expression Blend 2.5 June Preview Released

    Tech-Ed 2008 South Africa

    The agenda is updated, here are the 2.5 sessions I will be presenting:

    • Building Data Driven Applications using Windows Presentation Foundation 
      04 Aug 2008, 12:30 - 13:30 
      Session Room 7
      Level: 300
      Most rich applications present data, often lots of it. To avoid writing lots of code to support the presentation of that data, you should take full advantage of the data binding capabilities of your presentation platform. This session discusses and demonstrates the data binding capabilities of Windows Presentation Foundation (WPF). It explains what data contexts are and how they work with the element hierarchy. It shows you what Bindings are, how to declare them, and what optional capabilities they support. It demonstrates binding to data sets as well as custom objects and collections, and discusses the considerations for implementing those types. The session shows you how to use data templates to define reusable chunks of UI that can be rendered automatically for each item in a data collection. It also discusses the way you can interact with your bound data programmatically to control the presentation of that data and to make changes to it in code.
    • Five Cool Things to Know and Use for Smart Client Development with Microsoft Visual Studio 2008 and the Microsoft .NET Framework 3.5
      05 Aug 2008, 13:30 - 14:30 
      Session Room 15
      Level: 300
      While the world has gone overboard with building Web applications and many developers are focusing purely on the server-side, there are still huge opportunities for creating compelling rich client-based applications that play well in the software-plus-services world. With over 50 minutes of demo time, in this session we explore five new enhancements in Visual Studio 2008 and .NET Framework v3.5 for building smart Windows applications. Demonstrations include Windows Presentation Foundation interoperability, ADO.NET Sync Services, Client Application Services, the Managed AddIn Framework, and customizing Office Applications (Visual Studio Tools for the Microsoft Office System v3.0).
    • Choosing the Right Microsoft User Experience Technology
      Chalk n Talk 01
      Level: 200
      Presenters: Rudi Grobler, Tamir Khason and Eilon Lipton
      Just like our kitchens have a gamut of kitchen knives, each designed and engineered for a specific purpose, similarly, Microsoft offers you a range of UI technologies. These UI technologies are designed to serve a specific user experience scenario. In this Chalk 'n Talk session we’ll try to take a look at what the common user experience scenarios are and find appropriate technology to serve it because every user interface of a software presents you an opportunity to deliver a specific user experience to the end-user.

    If you are at Tech-Ed and read my blog, please come and say hi!

    "Serialize" a DependencyObject

    In my previous post, I mentioned that my biggest gripe with deriving from DependencyObject is that it is not serializable! I stand corrected (Well, almost).

    This is the code I tried initially

    BinaryFormatter serializer = new BinaryFormatter();
    serializer.Serialize(stream, Assesments);

    And here is my exception

    Type 'MyHealth.Model.AssesmentCollection' in Assembly 'MyHealth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

    To solve this problem, I tried the XamlWritter & XamlReader, here is the code

    XamlWriter.Save(Assesments, stream);

    THIS WORKED!!!

    And now the code is plain and simple...

    Download the newest version of myHealth at CodePlex

    If you found this article useful, please kick it on DotNetKicks.com

    Posted by rudi | 7 comment(s)

    myHealth

    I recently had a friend of mine (who is a professional bodybuilder), ask me to write him a simple application with which he can track his training progress?

    Here is some of the things I learned while writing myHealth

    INotifyPropertyChanged vs DependencyObject

    The PropertyGrid I used unfortunately only work with dependency properties (DependencyObject) so I had to choose them! My personal preference would have been the lighter weight INotifyPropertyChanged. Here are the pro's and con's of both

    DependencyObject

    - .NET 3.0 or better

    - Can't be serialized (THIS SUCKS)

    - Extra overhead (Dispatcher)

    + DependencyProperty Features: Coercion, Property changes notification, Spars storage, Validation, optimized for data binding, etc

    INotifyPropertyChanged

    + .NET 2.0 or better

    + Serializable

    + Lightweight

    When select between DependencyObject vs INotifyPropertyChanged, you should also put it into context of where it would be used... Are you creating a Model, Business Object, Domain Object, etc... Some of the cons don't then apply!

    Although I was forced to use DO's, the fact that I had to manually store my data was a huge pain in the ...

    Check out the full discussion on the WPF Disciples news group

    PropertyGrid

    I used Denis Vuyka's excellent PropertyGrid! The only drawback of using this PropertyGrid was that it only worked with dependency properties! To use the PropertyGrid, add the following namespace

    xmlns:dv="clr-namespace:DenisVuyka.Controls.PropertyGrid;assembly=DenisVuyka.Controls.PropertyGrid"

    and use it as follows

    <dv:PropertyGrid SelectedObject="{Binding Path=SelectedItem, ElementName=assesmentsListBox}" ExpandCategories="False" />

    The SelectedObject can be any DependencyObject derived class, here I bind it to the current selected Assesment.

    The category header is determined by the following attribute on the DP CLR Property wrappers

    [Category("Assesment")]

    IsolatedStorage

    myHealth uses IsolatedStorage (Domain) as the storage medium for the assesment history

    IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForDomain();
    IsolatedStorageFileStream stream = newIsolatedStorageFileStream("assesments.xml", FileMode.Open, file);

    Drag & Drop

    Drag & Drop in WPF is extremely easy... I added the following to my window

    AllowDrop="True" 
    Drop="Window_Drop" 
    

    And here is my Drop event handler

    private void Window_Drop(object sender, DragEventArgs e)
    {
        string[] fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];
    
        foreach (string fileName in fileNames)
        {
            ...
        }
    }

    Now you can drag & drop pictures into myHealth!!!

    TODO: Check the file extension of file being dropped... make sure that it is a .JPG file!!!

    Structural Skinning

    myHealth also supports structural skinning. I am currently creating a extra skin using Blendables Timeline layout panel which will lay out the assessments on a timeline!

    DrawingBrush

    myHealth uses a DrawingBrush as the default background for the progress pictures ListBox... This is similar to what popular programs like Blend use.

    Zoom, Zoom, Zoom...

    The Zoom is a simple UIElement binding between the Slider.Value and the ScaleTransform.X and ScaleTransform.Y of my images in my ListBox!

    Code Analytics

    Source Analysis (StyleCop) is a new product recently released by Microsoft. Although only recently released, this product has been used internally by Microsoft for years! The program helps enforce uniform and easily maintainable code! Since myHealth will be released on CodePlex, I decided to give it a try...

    Disabled the following rules:

    • C# -> Analyze design files

    These files are created by Visual Studio...

    • C# -> Ordering Rules

    SA1201

    • C# -> Readability Rules -> Method Parameter Placement

    SA1115, SA1116, SA1117

    Dr WPF's dependency property snippets current violate these rules...

    • C# -> Documentation Rules -> Element Documentation

    SA1600

    • C# -> Documentation Rules -> File Headers

    All

    Source

    The source is released on CodePlex

    kick it on DotNetKicks.com
    Posted by rudi | 11 comment(s)
    Filed under: , ,
    More Posts Next page »