コード例 #1
0
        /// <summary>
        /// Exactly as the name implies, this function will 'broadcast' the
        /// <see cref="msg"/> to all the subscribers of the <see cref="CommLinkToPs"/>
        /// </summary>
        /// <param name="msg"></param>
        /// <remarks>
        /// The <see cref="msg"/> Status is inspected for the value of <see cref="COMPLETED_STATUS_STRING"/>
        /// and having this status this message handler will close the async thread task and
        /// dump all reporting data to files.
        /// </remarks>
        public void BroadcastProgress(ProgressMessage msg)
        {
            if (CommLinkToPs == null)
            {
                return;
            }
            if (msg == null)
            {
                return;
            }

            var subscribers = CommLinkToPs.GetInvocationList();
            var enumerable  = subscribers.GetEnumerator();

            while (enumerable.MoveNext())
            {
                var handler = enumerable.Current as MessageFromStoredProcManager;
                if (handler == null)
                {
                    continue;
                }
                handler.BeginInvoke(msg, Callback, msg.ProcName);
            }

            //use this Status as que to dispose the async task if its present and log reporting data
            if (msg.Status != COMPLETED_STATUS_STRING)
            {
                return;
            }

            if (GetSpResultSetXsdTask != null)
            {
                GetSpResultSetXsdTask.Dispose();
            }

            //dump the reporting data to file
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__KilledProx.txt"),
                                Sorting.KilledProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__TimedOutProx.txt"),
                                Sorting.TimedOutProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__BadSyntaxProx.txt"),
                                Sorting.BadSyntaxProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__BadSyntaxProx.txt"),
                                Sorting.BadSyntaxProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__UnknownErrorProx.txt"),
                                Sorting.UnknownErrorProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__EmptyDatasetProx.txt"),
                                Sorting.EmptyDatasetProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__MultiTableDsProx.txt"),
                                Sorting.MultiTableDsProx);
            File.AppendAllLines(Path.Combine(Settings.HbmStoredProcsDirectory, "__NoDatasetReturnedProx.txt"),
                                Sorting.NoDatasetReturnedProx);
        }
コード例 #2
0
        public void BroadcastProgress(ProgressMessage msg)
        {
            if (CommLinkToPs == null)
            {
                return;
            }
            if (msg == null)
            {
                return;
            }

            var subscribers = CommLinkToPs.GetInvocationList();
            var enumerable  = subscribers.GetEnumerator();

            while (enumerable.MoveNext())
            {
                var handler = enumerable.Current as InvokeDia2DumpProgress;
                if (handler == null)
                {
                    continue;
                }
                handler.BeginInvoke(msg, Callback, msg.ProcName);
            }
        }