示例#1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                foreach (object o in m_items.Values)
                {
                    IDisposable disposable = o as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

                m_items.Clear();
                m_items   = null;
                g_context = null;
            }
        }
        public override bool DoWork(Func2 <bool> shutdownCallback)
        {
            using (WorkItemContext context = WorkItemContext.Current)
            {
                IWorkItem workItem;

                try
                {
                    workItem = DependencyResolver.Resolve <IWorkItem>(m_workItemName);
                }
                catch (NullReferenceException)
                {
                    /* Container has been reloaded */
                    return(false);
                }

                return(workItem.DoWork(shutdownCallback) && !shutdownCallback());
            }
        }