Esempio n. 1
0
        public string CloseHandler(DirectoryHandlerClosedEventArgs args, out EventLogEntryType result)
        {
            DirectoryHandlerClosed?.Invoke(this, args);
            result = EventLogEntryType.Information;

            return(args.DirectoryPath);
        }
        /// <summary>
        ///     Called when a directory handler is closed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="DirectoryHandlerClosedEventArgs" /> instance containing the event data.</param>
        public void OnDirectoryHandlerClosed(object sender, DirectoryHandlerClosedEventArgs args)
        {
            if (args != null && !args.DirectoryPath.Equals(_path))
            {
                return;
            }

            _dirWatcher.Created -= OnNewFileCreated;

            DirectoryHandlerClosed?.Invoke(this,
                                           new DirectoryHandlerClosedEventArgs(_path, "in OnDirectoryHandlerClosed"));

            _loggingService.Log("Stopped handling directory " + _path, EventLogEntryType.Information);
            if (args != null)
            {
                args.Closed = true;
            }

            ImageServer imageServer = (ImageServer)sender;

            imageServer.DirectoryHandlerClosed -= OnDirectoryHandlerClosed;
            imageServer.CommandRecieved        -= OnCommandRecieved;
        }
Esempio n. 3
0
 public void Close()
 {
     DirectoryHandlerClosed?.Invoke(this, null);
 }