Пример #1
0
        public IDisposable BeginTask(string name, int totalWork)
        {
            var t = new ProgressTask(this, name, totalWork);

            if (openStepWork != -1)
            {
                t.StepWork = openStepWork;

                openStepWork = -1;
            }
            if (currentTask == null)
            {
                rootTask = t;
            }
            else
            {
                currentTask.AddChild(t);
            }

            currentTask = t;

            //	if (name != null) {
            if (context != null)
            {
                context.Post((o) => {
                    var(mon, task) = (ValueTuple <ProgressMonitor, ProgressTask>)o;
                    mon.OnBeginTask(task.Name, task.TotalWork, task.StepWork);
                }, (this, t));
            }
            else
            {
                OnBeginTask(name, totalWork, t.StepWork);
            }
            //	}

            ReportProgressChanged();

            if (followerMonitors != null)
            {
                foreach (var m in followerMonitors)
                {
                    m.BeginTask(name, totalWork);
                }
            }
            return(t);
        }
Пример #2
0
        public IDisposable BeginTask(string name, int totalWork)
        {
            var t = new ProgressTask(this, name, totalWork);

            if (openStepWork != -1)
            {
                t.StepWork = openStepWork;

                openStepWork = -1;
            }
            if (currentTask == null)
            {
                rootTask = t;
            }
            else
            {
                currentTask.AddChild(t);
            }

            currentTask = t;

            //	if (name != null) {
            if (context != null)
            {
                context.Post((o) => OnBeginTask(name, totalWork, t.StepWork), null);
            }
            else
            {
                OnBeginTask(name, totalWork, t.StepWork);
            }
            //	}

            ReportProgressChanged();

            if (slaveMonitors != null)
            {
                foreach (var m in slaveMonitors)
                {
                    m.BeginTask(name, totalWork);
                }
            }
            return(t);
        }