Exemplo n.º 1
0
        // The actual method which is raising the event
        protected virtual void OnFileWrittenCompleted(FileWrittenCompletedEventArgs e)
        {
            // Temporary event handler to prevent from race condition if a subscriber
            // unsubscribe between the null check and the actual raising
            EventHandler<FileWrittenCompletedEventArgs> eventHandler = FileWritten;

            // Checking if there is subscribers for the event
            if (eventHandler != null)
            {
                // The actual raising of the event
                FileWritten(this, e);
            }
        }
Exemplo n.º 2
0
 // Method which has been invoked after the event has been handled
 private void OnFileWrittenCompleted(object sender, FileWrittenCompletedEventArgs e)
 {
     Console.WriteLine("The file {0}{1} has been written.", e.DestinationPath, e.Filename);
 }