Exemple #1
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);
            }
        }
Exemple #2
0
 /// <summary>
 /// Reports progress to the console and any calling assembly (if so configured).
 /// </summary>
 /// <param name="msg"></param>
 protected internal void ReportProgress(ProgressMessage msg)
 {
     PrintToConsole(msg);
 }
Exemple #3
0
        /// <summary>
        /// Prints a header then a kind of console progress bar.
        /// Does NOT write to <see cref="LogFile"/>.
        /// </summary>
        /// <param name="pMsg"></param>
        public void PrintToConsole(ProgressMessage pMsg)
        {
            try
            {
                if (!_isVisable)
                    return;
                var currentState = new Tuple<int, string>(pMsg.ProgressCounter, pMsg.Status);

                if (ProgressMessageState == null)
                {
                    Console.WriteLine(currentState.Item2);
                    ProgressMessageState = currentState;
                    return;
                }
                if (currentState.Item2 != ProgressMessageState.Item2)
                {
                    Console.WriteLine();
                    Console.WriteLine(currentState.Item2);
                    ProgressMessageState = currentState;
                    return;
                }
                if (currentState.Item1 > ProgressMessageState.Item1)
                {
                    Console.Write('.');
                    ProgressMessageState = currentState;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
        /// <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);
        }