Click here to Skip to main content
15,893,381 members
Articles / Desktop Programming / WPF

Building a Docking Window Management Solution in WPF

Rate me:
Please Sign up or sign in to vote.
4.28/5 (25 votes)
1 Jan 2011CPOL8 min read 189.7K   15.7K   83  
A docking window solution using WPF as part of Synergy toolkit
using System;

namespace MixModes.Synergy.Utilities
{
    /// <summary>
    /// Validation class
    /// </summary>
    public static class Validate
    {
        /// <summary>
        /// Validates that a parameter is not null
        /// </summary>
        /// <param name="param">Parameter to verify</param>
        /// <param name="paramName">Name of the parameter</param>
        /// <exception cref="ArgumentNullException">Parameter is null</exception>
        public static void NotNull(object param, string paramName)
        {
            if (param == null)
            {
                throw new ArgumentNullException(paramName);
            }
        }

        /// <summary>
        /// Validates that a string parameter is not null or empty
        /// </summary>
        /// <param name="param">String parameter to verify</param>
        /// <param name="paramName">Name of the string parameter</param>
        /// <exception cref="ArgumentOutOfRangeException">String parameter is null or empty</exception>
        public static void StringNotNullOrEmpty(string param, string paramName)
        {
            NotNull(param, paramName);
            if (string.IsNullOrEmpty(param))
            {
                throw new ArgumentOutOfRangeException(paramName);
            }
        }

        /// <summary>
        /// Asserts the specified condition
        /// </summary>
        /// <typeparam name="E">Type of exception to throw if assertion fails</typeparam>
        /// <param name="condition">Assertion condition</param>
        /// <exception cref="E">Condition evaluates to false</exception>
        public static void Assert<E>(bool condition) where E : Exception, new()
        {
            if (!condition)
            {
                throw new E();
            }
        }
    }
}

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 (Senior) MixModes Inc. | Research In Motion
Canada Canada
Ashish worked for Microsoft for a number of years in Microsoft Visual Studio (Architect edition) and Windows Live division as a developer. Before that he was a developer consultant mainly involved in distributed service development / architecture. His main interests are distributed software architecture, patterns and practices and mobile device development.

Currently Ashish serves as a Technical Lead at RIM leading next generation BlackBerry media experience and also runs his own company MixModes Inc. specializing in .NET / WPF / Silverlight technologies. You can visit MixModes at http://mixmodes.com or follow it on Twitter @MixModes

In his free time he is an avid painter, hockey player and enjoys travelling. His blog is at: http://ashishkaila.serveblog.net

Comments and Discussions