private void OnProcessing(ProcessCancelEventArgs e)
        {
            Delegate eh = null;

            if (events != null && events.TryGetValue("Processing", out eh))
            {
                EventHandler <ProcessCancelEventArgs> pceh = eh as EventHandler <ProcessCancelEventArgs>;
                if (pceh != null)
                {
                    pceh(this, e);
                }
            }

            //if (Processing != null)
            //{
            //    Processing(this, e);
            //}
        }
        public void Process(Document doc)
        {
            ProcessEventArgs       e  = new ProcessEventArgs(doc);
            ProcessCancelEventArgs ce = new ProcessCancelEventArgs(doc);

            OnProcessing(ce);
            if (ce.Cancel)
            {
                Console.WriteLine("Proces zostal anulowany.");
                if (LogTextProvider != null)
                {
                    Console.WriteLine(LogTextProvider(doc));
                }
                return;
            }
            foreach (ActionCheckPair process in processes)
            {
                if (process.QuickCheck != null && !process.QuickCheck(doc))
                {
                    Console.WriteLine("Przetwarzanie nie zakonczy sie pomyslnie.");
                    if (LogTextProvider != null)
                    {
                        Console.WriteLine(LogTextProvider(doc));
                    }
                    OnProcessed(e);
                    return;
                }
            }

            foreach (ActionCheckPair process in processes)
            {
                process.Action(doc);
                if (LogTextProvider != null)
                {
                    Console.WriteLine(LogTextProvider(doc));
                }
            }
            OnProcessed(e);
        }
Example #3
0
 void processor_Processing(object sender, ProcessCancelEventArgs e)
 {
     Console.WriteLine("Narzedzie 1. - zarejestrowano przetwarzanie, wykonanie nie zostalo anulowane");
 }