Click here to Skip to main content
15,881,588 members
Articles / Desktop Programming / Windows Forms

A Practical Use of the MVC Pattern

Rate me:
Please Sign up or sign in to vote.
4.55/5 (41 votes)
8 Jan 2007CPOL5 min read 178.8K   2.7K   145  
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)


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

Comments and Discussions