Exemplo n.º 1
0
        private void OnProcessed(ProcessEventArgs e)
        {
            Delegate eh = null;

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

            //if (Processed != null)
            //{
            //    Processed(this, e);
            //}
        }
Exemplo n.º 2
0
        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);
        }