コード例 #1
0
        public event EventHandler <CommandRecievedEventArgs> CommandRecieved; // The event that notifies about a new Command being recieved
        #endregion


        /*********************************************************************/

        public void onCloseServer(object sender, ...)
        {
            IDirectoryHandler h = sender;

            CommandRecieved -= h.OnCommandRecieved(sender, CommandRecieved);
            CommandRecieved -= h.OnCloseServer;
        }
コード例 #2
0
 /// <summary>
 /// stop handleing certain dorectory
 /// </summary>
 /// <param name="directoryPath">path to the directory</param>
 /// <returns>true if directory stopped being handled and false otherwise</returns>
 public bool StopHandelingDirectory(string directoryPath)
 {
     if (this.m_deirectoryPathsToHandlers.ContainsKey(directoryPath))
     {
         IDirectoryHandler        handlerToBeStopped       = this.m_deirectoryPathsToHandlers[directoryPath];
         CommandRecievedEventArgs commandRecievedEventArgs = new CommandRecievedEventArgs(CommandEnum.CloseCommand, null, "");
         handlerToBeStopped.OnCommandRecieved(this, commandRecievedEventArgs);
         this.m_deirectoryPathsToHandlers.Remove(directoryPath);
         return(true);
     }
     else
     {
         return(false);
     }
 }