/* * ExceptionalForm.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Windows.Forms; namespace DTS.Common.Utilities { /// /// A Windows-style Form with it's own exception type. /// /// /// /// Sample usage: /// public class A : ExceptionalForm /// { /// public void ScrewItUp( ) /// { /// private bool error = true; /// if ( error ) throw new A.Exception( "Class A-specific screwup." ); /// } /// } /// /// ... /// /// try /// { /// A.ScrewItUp( ); /// B.ScrewItUp( ); /// C.ScrewItUp( ); /// } /// catch ( A.Exception ex ) /// { /// // Can pick A's exceptions out of a crowd, or not and just treat it /// // polymorphically as a System.Exception. /// } /// /// [global::System.Serializable] public class ExceptionalForm : Form { /// /// Initialize an instance of the ExceptionForm class. /// public ExceptionalForm() : base() { } /// /// A representation of the DerivedClass.Exception class. /// public class Exception : ApplicationException { /// /// create a /// public Exception() { } /// /// create a with /// a description /// /// Description of error public Exception(string msg) : base(msg) { } /// /// create a with /// a description and a reference to the exception causing the error /// /// Description of error /// exception causing the error public Exception(string msg, System.Exception innerEx) : base(msg, innerEx) { } protected Exception( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } } } }