Пример #1
0
        private void BeginNextTask(string queueId, ICommand command, IDictionary<string, ThreadTask> tasks)
        {
            var workerTask = new ThreadTask(queueId, () =>
            {
                var progressMonitor = new ObservableProgressMonitor();
                eventAggregator.Send(this, new TaskStarted(queueId, progressMonitor));
                command.Execute(progressMonitor);
            });

            tasks.Add(queueId, workerTask);

            workerTask.Terminated += delegate
            {
                TaskTerminated(workerTask, queueId);
            };

            workerTask.Start();
        }
Пример #2
0
 private static ThreadTask CreateSTAThread(Action start)
 {
     var task = new ThreadTask("AutoCAD Command Runner", start)
                    {
                        ApartmentState = ApartmentState.STA
                    };
     return task;
 }