public void StartTask(TaskListener listener = null)
        {
            if (DidRun)
            {
                return;
            }
            DidRun = true;

            this.Listener = listener;
            if (listener != null)
            {
                listener.HasOwnProgress = false;
            }

            EvaluateFinished();
            if (IsFinished)
            {
                return;
            }

            tasks.ForEach(t =>
            {
                if (!t.IsFinished)
                {
                    var subListener         = listener?.CreateSubListener() ?? new TaskListener();
                    subListener.OnFinished += EvaluateFinished;
                    t.StartTask(subListener);
                }
            });
        }
Example #2
0
        public void StartTask(TaskListener listener = null)
        {
            if (DidRun)
            {
                return;
            }
            DidRun = true;

            this.Listener = listener;
            if (action == null)
            {
                SetFinished();
            }
            else
            {
                action.Invoke(this);
            }
        }