示例#1
0
        /// <summary>
        /// Reports a custom status object
        /// </summary>
        /// <param name="statusObject">The object.</param>
        /// <remarks>
        /// This method allows using arbitrary objects to report status.
        /// The type of the object has to be well known by the reporter and
        /// by the monitor implementation
        /// </remarks>
        public void ReportObject(object statusObject)
        {
            if (ReportGlobalDataToParent && parentMonitor != null)
            {
                parentMonitor.ReportObject(statusObject);
            }

            if (context != null)
            {
                context.Post((o) => {
                    var(mon, statusObj) = (ValueTuple <ProgressMonitor, object>)o;
                    mon.OnObjectReported(statusObj);
                }, (this, statusObject));
            }
            else
            {
                OnObjectReported(statusObject);
            }

            if (followerMonitors != null)
            {
                foreach (var sm in followerMonitors)
                {
                    sm.ReportObject(statusObject);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Reports a custom status object
        /// </summary>
        /// <param name="statusObject">The object.</param>
        /// <remarks>
        /// This method allows using arbitrary objects to report status.
        /// The type of the object has to be well known by the reporter and
        /// by the monitor implementation
        /// </remarks>
        public void ReportObject(object statusObject)
        {
            if (ReportGlobalDataToParent && parentMonitor != null)
            {
                parentMonitor.ReportObject(statusObject);
            }

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

            if (followerMonitors != null)
            {
                foreach (var sm in followerMonitors)
                {
                    sm.ReportObject(statusObject);
                }
            }
        }