Changeset 418


Ignore:
Timestamp:
09/27/08 09:52:08 (6 years ago)
Author:
lowjoel
Message:

-Added a Method Registered event
-Standardised the delegate nomenclature. For an event Event:

-delegate is named EventFunction?
-event is named Event
-event executor is named OnEvent?

Location:
branches/eraser6
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Eraser/LogForm.cs

    r365 r418  
    5454 
    5555            //Register our event handler to get live log messages 
    56             task.Log.OnLogged += new Logger.LogEvent(task_Logged); 
     56            task.Log.OnLogged += new Logger.LogEventFunction(task_Logged); 
    5757        } 
    5858 
    5959        private void LogForm_FormClosed(object sender, FormClosedEventArgs e) 
    6060        { 
    61             task.Log.OnLogged -= new Logger.LogEvent(task_Logged); 
     61            task.Log.OnLogged -= new Logger.LogEventFunction(task_Logged); 
    6262        } 
    6363 
     
    6969                try 
    7070                { 
    71                     Invoke(new Logger.LogEvent(task_Logged), new object[] { e }); 
     71                    Invoke(new Logger.LogEventFunction(task_Logged), new object[] { e }); 
    7272                } 
    7373                catch (ObjectDisposedException) 
  • branches/eraser6/Eraser/ToolBar.cs

    r349 r418  
    234234        /// Item click event handler 
    235235        /// </summary> 
    236         public ToolbarItemClickedHandler ToolbarItemClicked 
    237         { 
    238             get { return toolbarItemClicked; } 
    239             set { toolbarItemClicked = value; } 
    240         } 
    241  
    242         public delegate void ToolbarItemClickedHandler(object sender, EventArgs e); 
    243         private event ToolbarItemClickedHandler toolbarItemClicked; 
     236        public event ToolbarItemClickedEventFunction ToolbarItemClicked; 
     237        public delegate void ToolbarItemClickedEventFunction(object sender, EventArgs e); 
    244238        internal void OnToolbarItemClicked(object sender) 
    245239        { 
  • branches/eraser6/Manager/Logger.cs

    r348 r418  
    9595        /// </summary> 
    9696        /// <param name="e"></param> 
    97         public delegate void LogEvent(LogEntry e); 
     97        public delegate void LogEventFunction(LogEntry e); 
    9898 
    9999        /// <summary> 
    100100        /// All the registered event handlers for the log event of this task. 
    101101        /// </summary> 
    102         public event LogEvent OnLogged; 
     102        public event LogEventFunction OnLogged; 
    103103 
    104104        /// <summary> 
  • branches/eraser6/Manager/Method.cs

    r412 r418  
    9292        /// <param name="currentPass">The current pass number. The total number 
    9393        /// of passes can be found from the Passes property.</param> 
    94         public delegate void OnProgress(long lastWritten, int currentPass); 
     94        public delegate void ProgressFunction(long lastWritten, int currentPass); 
    9595 
    9696        /// <summary> 
     
    109109        /// <param name="callback">The progress callback function.</param> 
    110110        public abstract void Erase(Stream strm, long erasureLength, PRNG prng, 
    111             OnProgress callback); 
     111            ProgressFunction callback); 
    112112 
    113113        /// <summary> 
     
    253253        /// <param name="prng">The PRNG source for random data.</param> 
    254254        /// <param name="callback">The progress callback function.</param> 
    255         public virtual void EraseUnusedSpace(Stream strm, PRNG prng, OnProgress callback) 
     255        public virtual void EraseUnusedSpace(Stream strm, PRNG prng, ProgressFunction callback) 
    256256        { 
    257257            Erase(strm, long.MaxValue, prng, callback); 
     
    299299 
    300300        public override void Erase(Stream strm, long erasureLength, PRNG prng, 
    301             OnProgress callback) 
     301            ProgressFunction callback) 
    302302        { 
    303303            //Randomize the order of the passes 
     
    389389 
    390390            public override void Erase(Stream strm, long erasureLength, PRNG prng, 
    391                 OnProgress callback) 
     391                ProgressFunction callback) 
    392392            { 
    393393                throw new NotImplementedException("The DefaultMethod class should never be " + 
     
    494494                ManagerLibrary.Instance.ErasureMethodManager.methods.Add(method.GUID, info); 
    495495            } 
     496 
     497            //Broadcast the event 
     498            OnMethodRegistered(method.GUID); 
    496499        } 
    497500 
     
    517520        private Dictionary<Guid, MethodConstructorInfo> methods = 
    518521            new Dictionary<Guid, MethodConstructorInfo>(); 
     522 
     523        /// <summary> 
     524        /// The delegate prototype of the Method Registered event. 
     525        /// </summary> 
     526        /// <param name="method">The GUID of the method being registered.</param> 
     527        public delegate void MethodRegisteredFunction(Guid guid); 
     528 
     529        /// <summary> 
     530        /// Called whenever an erasure method is registered. 
     531        /// </summary> 
     532        public static event MethodRegisteredFunction MethodRegistered; 
     533 
     534        /// <summary> 
     535        /// Executes the MethodRegistered event handlers 
     536        /// </summary> 
     537        private static void OnMethodRegistered(Guid guid) 
     538        { 
     539            if (MethodRegistered != null) 
     540                MethodRegistered(guid); 
     541        } 
    519542        #endregion 
    520543 
  • branches/eraser6/Manager/Plugins.cs

    r414 r418  
    6060        /// </summary> 
    6161        /// <param name="instance">The instance of the plugin loaded.</param> 
    62         public delegate void OnPluginLoadEventHandler(PluginInstance instance); 
     62        public delegate void PluginLoadedFunction(PluginInstance instance); 
    6363 
    6464        /// <summary> 
    6565        /// The plugin loaded event. 
    6666        /// </summary> 
    67         public event OnPluginLoadEventHandler PluginLoad; 
     67        public event PluginLoadedFunction PluginLoaded; 
    6868 
    6969        /// <summary> 
     
    7171        /// </summary> 
    7272        /// <param name="instance"></param> 
    73         protected void OnPluginLoad(PluginInstance instance) 
    74         { 
    75             if (PluginLoad != null) 
    76                 PluginLoad(instance); 
     73        protected void OnPluginLoaded(PluginInstance instance) 
     74        { 
     75            if (PluginLoaded != null) 
     76                PluginLoaded(instance); 
    7777        } 
    7878 
     
    152152 
    153153                    //And broadcast the plugin load event 
    154                     OnPluginLoad(instance); 
     154                    OnPluginLoaded(instance); 
    155155                } 
    156156            } 
  • branches/eraser6/Manager/Settings.cs

    r412 r418  
    253253        /// The prototype of functions which will handle a SettingsChanged Event. 
    254254        /// </summary> 
    255         public delegate void OnSettingsChangedEvent(); 
     255        public delegate void SettingsChangedFunction(); 
    256256 
    257257        /// <summary> 
    258258        /// The event handler handling a change in settings. 
    259259        /// </summary> 
    260         public event OnSettingsChangedEvent SettingsChanged; 
     260        public event SettingsChangedFunction SettingsChanged; 
    261261 
    262262        private string uiLanguage; 
Note: See TracChangeset for help on using the changeset viewer.