Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A Practical Use of the MVC Pattern

, 8 Jan 2007 CPOL
Another approach to the MVC pattern
// � 2006 IDesign Inc. All rights reserved 
//Questions? Comments? go to 
//http://www.idesign.net

using System;
using System.Diagnostics;

namespace WinFormsEx
{
   public class CancleEventArgs : EventArgs
   {
      protected bool m_Cancel; 
      public bool Cancel
      {
         get
         {
            return m_Cancel;
         }   
         set
         {
            m_Cancel = value;
         }   
      }

   }
   public class DoWorkEventArgs : CancleEventArgs
   {
      object m_Result;
      public object Result
      {
         get
         {
            return m_Result;
         }   
         set
         {
            m_Result = value;
         }   
      }
      public readonly object Argument; 
      public DoWorkEventArgs(object argument)
      {
         Argument = argument;
      }
   }
   public class ProgressChangedEventArgs : EventArgs
   {
      public readonly int ProgressPercentage; 
      public ProgressChangedEventArgs(int percentage)
      {
         ProgressPercentage = percentage;
      }
   }

   public class AsyncCompletedEventArgs : EventArgs
   {
      public readonly Exception Error;
      public readonly bool Cancelled;

      public AsyncCompletedEventArgs(Exception error,bool cancel)
      {
         Error = error;
         Cancelled = cancel;
      }
   }

   public class RunWorkerCompletedEventArgs : AsyncCompletedEventArgs
   {
      public readonly object Result;
      public RunWorkerCompletedEventArgs(object result,Exception error,bool cancel) : base(error,cancel)
      {
         Result = result;
      }
   }
    
   public delegate void DoWorkEventHandler(object sender,DoWorkEventArgs e);
   public delegate void ProgressChangedEventHandler(object sender,ProgressChangedEventArgs e);
   public delegate void RunWorkerCompletedEventHandler(object sender,RunWorkerCompletedEventArgs 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)

Share

About the Author

Zoltan Balazs
Software Developer
Romania Romania
I've did some programming for Macintosh a few years back and working with Microsoft technologies since then.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150129.1 | Last Updated 8 Jan 2007
Article Copyright 2007 by Zoltan Balazs
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid