Beispiel #1
0
 protected virtual void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     while (MainList.Count > 0)
     {
         IWork work = MainList.First.Value;
         if (!work.Initialize())
         {
             work.OnFailed();
             RunOnFailed();
             return;
         }
         if (!work.Execute())
         {
             work.OnFailed();
             RunOnFailed();
             return;
         }
         work.OnCompleted();
         MainList.RemoveFirst();
     }
     if (MainList.Count == 0)
     {
         RunOnCompleted();
     }
 }
Beispiel #2
0
        private void ExecuteScenarioThreadFunction()
        {
            try
            {
                _work.Init();
                Initialized = true;
                OnThreadInitialized();

                _prewait.Wait(ref _stopQueued);

                if (!_stopQueued)
                {
                    _work.Execute(ref _stopQueued);
                }
            }
            catch (Exception ex)
            {
                OnThreadError(ex);
            }
            finally
            {
                try
                {
                    _work.Cleanup();
                }
                catch (Exception ex)
                {
                    OnThreadError(ex);
                }

                OnThreadFinished();
            }
        }
Beispiel #3
0
        public void Process(Document input, Stage output)
        {
            IEnumerable <string> folders = Disk.Directories(input.Context.Source.Directory, pattern);

            foreach (string folder in folders)
            {
                Context context = Context.CreateFromSource(input.Context.Root, folder);

                IWork work = Make.InterpretDocument(input.Text, context);
                work.Execute();
            }
        }
        public static void Generate(string sourcedir, string targetdir, string mask, string loglevel)
        {
            Log.Level = Log.ParseLevel(loglevel, LogLevel.Info);

            Log.Info("Fhir publisher tool 0.9.5 BETA");

            Root    root    = new Root(sourcedir, targetdir);
            Context context = root.Context();

            Document document = FileFilter.GetDocument(context, mask);
            IWork    work     = Make.InterpretDocument(document.Text, document.Context);

            work.Execute();

            Log.Info("Rendering complete. Output to directory {0}", targetdir);
        }
Beispiel #5
0
        public async Task Execute()
        {
            if (SetStatus(WorkStatus.Created, WorkStatus.Running))
            {
                try
                {
                    Trace.Close();
                    Trace.WriteLine("任务id:" + ID.ToString("n"), "WorkQueue");
                    System.Threading.SynchronizationContext.SetSynchronizationContext(null);
                    await _Work.Execute().ConfigureAwait(false);

                    _Status = (int)WorkStatus.Completion;
                }
                catch (Exception ex)
                {
                    Error   = ex;
                    _Status = (int)WorkStatus.Faulted;
                }
                finally
                {
                    Trace.Flush();
                }
            }
        }
Beispiel #6
0
        public void Process(Document input, Stage output)
        {
            IWork work = Make.InterpretDocument(input.Text, input.Context);

            work.Execute();
        }