Exemplo n.º 1
0
        protected virtual void OnDispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }
            disposed = true;

            if (parentMonitor != null && firstCachedLogChunk != null)
            {
                parentMonitor.DumpLog(firstCachedLogChunk);
                firstCachedLogChunk = null;
            }

            var t = parentRootTask;

            parentRootTask = null;
            while (currentTask != t && currentTask != null)
            {
                EndTask();
            }

            if (context != null)
            {
                context.Post((o) => ((ProgressMonitor)o).OnCompleted(), this);
            }
            else
            {
                OnCompleted();
            }

            if (followerMonitors != null)
            {
                foreach (var m in followerMonitors)
                {
                    m.Dispose();
                }
            }
            if (disposeCallbacks != null)
            {
                foreach (var c in disposeCallbacks.ToArray())
                {
                    c();
                }
                disposeCallbacks = null;
            }
        }
Exemplo n.º 2
0
        public virtual void Dispose()
        {
            if (disposed)
            {
                return;
            }
            disposed = true;

            if (parentMonitor != null && firstCachedLogChunk != null)
            {
                parentMonitor.DumpLog(firstCachedLogChunk);
                firstCachedLogChunk = null;
            }

            var t = parentRootTask;

            parentRootTask = null;
            while (currentTask != t && currentTask != null)
            {
                EndTask();
            }

            if (context != null)
            {
                context.Post((o) => OnCompleted(), null);
            }
            else
            {
                OnCompleted();
            }

            if (slaveMonitors != null)
            {
                foreach (var m in slaveMonitors)
                {
                    m.Dispose();
                }
            }
            if (disposeCallbacks != null)
            {
                foreach (var c in disposeCallbacks.ToArray())
                {
                    c();
                }
                disposeCallbacks = null;
            }
        }