Click here to Skip to main content
15,884,099 members
Articles / Desktop Programming / WPF

DataObjectBase

Rate me:
Please Sign up or sign in to vote.
4.66/5 (20 votes)
18 May 2010CPOL8 min read 37.7K   572   59  
DataObjectBase -> the new Object class for data objects!
using System.Windows;
using CatenaLogic.Data;
using CatenaLogic.Examples.UI.Windows;
using CatenaLogic.Windows;

namespace CatenaLogic.Examples
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Style helper
            CatenaLogic.Windows.StyleHelper.CreateStyleForwardersForDefaultStyles();

            // Call base
            base.OnStartup(e);

            // Initialize example window
            ExamplesWindow examplesWindow = new ExamplesWindow("Data object base examples");
            examplesWindow.Description = "This demo application shows some capabilities of the DataObjectBase class.";

            // Example 1
            examplesWindow.ExampleCollection.Add(new ExampleInfo("Example 01 - Simple object",
                "A simple object without any special hassles",
                "Data/Example 01 - Simple object/SimpleObject.cs"));

            // Example 2
            examplesWindow.ExampleCollection.Add(new ExampleInfo("Example 02 - Error validation",
                "Basic object validation with errors and warnings",
                "Data/Example 02 - Error validation/ErrorValidationObject.cs",
                delegate()
                {
                    var window = new ErrorValidationWindow();
                    window.ShowDialog();
                }));

            // Example 3
            examplesWindow.ExampleCollection.Add(new ExampleInfo("Example 03 - Serialization",
                "Basic object serialization in xml and binary mode",
                "Data/Example 03 - Serialization/SerializableObject.cs",
                delegate()
                {
                    var window = new SerializationWindow();
                    window.ShowDialog();
                }));

            // Example 4
            examplesWindow.ExampleCollection.Add(new ExampleInfo("Example 04 - Nested objects",
                "Shows the ability to nest classes which can be (de)serialized easily",
                "Data/Example 04 - Nested objects/NestedObjects.cs"));

            // Example 5
            examplesWindow.ExampleCollection.Add(new ExampleInfo("Example 05 - Backward compatibility",
                "Converting \"old\" style classes into the new DataObjectBase class",
                "Data/Example 05 - Backward compatibility/BackwardCompatibility.cs",
                delegate()
                {
                    var window = new BackwardCompatibilityWindow();
                    window.ShowDialog();
                }));

            // Example 6
            examplesWindow.ExampleCollection.Add(new ExampleInfo("Example 06 - Revert and apply",
                "Create states in your object that you can revert or apply",
                "Data/Example 06 - Revert and apply/RevertAndApplyObject.cs",
                delegate()
                {
                    var window = new RevertAndApplyWindow();
                    window.ShowDialog();
                }));

            // Show example window
            examplesWindow.ShowDialog();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions