Exemple #1
0
        /// <summary>
        /// method to close the server by commanding the handlers to close first
        /// </summary>
        public void CloseServer()
        {           // invoke close all directories CommandRecieved Event
            CommandRecievedEventArgs args = new CommandRecievedEventArgs((int)CommandEnum.CloseCommand, null, "*");

            CommandRecieved.Invoke(this, args);
            // wait for all handlers to close
            while ((CommandRecieved != null) && (CommandRecieved.GetInvocationList().Length > 0))
            {
                System.Threading.Thread.Sleep(1000);
            }
            // update logger
            m_logging.Log("Server is Closed", MessageTypeEnum.INFO);
        }
Exemple #2
0
 /// <summary>
 /// closing all directory handlers
 /// </summary>
 private void CloseAllDirHandlers()
 {
     try
     {
         foreach (EventHandler <CommandRecievedEventArgs> handler in CommandRecieved.GetInvocationList())
         {
             handler(this, new CommandRecievedEventArgs((int)CommandEnum.CloseAllCommand, null, null));
             CommandRecieved -= handler;
         }
     } catch (Exception)
     {
     }
 }