Ejemplo n.º 1
0
        public void StartProcess()
        {
            var args = new ProcessEventArgs();

            try
            {
                Console.WriteLine("Process Started!");

                // some code here..

                args.IsSuccessful   = true;
                args.CompletionTime = DateTime.Now;
                OnProcessCompleted(args);
            }
            catch (Exception ex)
            {
                args.IsSuccessful   = false;
                args.CompletionTime = DateTime.Now;
                OnProcessCompleted(args);
            }
        }
Ejemplo n.º 2
0
 protected virtual void OnProcessCompleted(ProcessEventArgs e)
 {
     ProcessCompleted?.Invoke(this, e);
 }
Ejemplo n.º 3
0
 // event handler
 public static void bl_ProcessCompleted(object sender, ProcessEventArgs e)
 {
     Console.WriteLine("Process " + (e.IsSuccessful ? "Completed Successfully" : "failed"));
     Console.WriteLine("Completion Time: " + e.CompletionTime.ToLongDateString() + " " + e.CompletionTime.ToLongTimeString());
 }