/// <summary> /// Writes the passed message to the Console Window the application is running in and adds the passed message it to the Process Log File for the application. /// </summary> /// <param name="Message"> /// The message (text string) that is to be written to the Console Window and Process Log File. /// </param> /// <param name="MessageBreakLength"> /// The number of characters that shoudl be included on a line in the Console Window and the Process Log File. Messages longer than the specified value will be /// broken up to be written on multiple lines. /// </param> /// <param name="LogFileManager"> /// The Log File Manager Object that contains the pointer to the Process Log File for the application. /// </param> public void SendMessage(string Message, int MessageBreakLength, PDX.BTS.DataMaintenance.MaintTools.LogFileManager LogFileManager) { System.Collections.Specialized.StringCollection messages = null; try { // If the message is too long to fit in the process status list box, break it onto multiple lines. if (Message.Length > MessageBreakLength) { // Break the passed message on to multiple lines since it is too long to fit on a single line in the Process Status List Box. messages = CreateMessagesCollection(Message, MessageBreakLength); } else { // Create a Message Collection and add the current message to it. messages = new System.Collections.Specialized.StringCollection(); messages.Add(Message); } // Write the items in the Messages Collection to the Console Window and the Process Log File. foreach (string currentMessage in messages) { // Write the Message to the Console Window. Console.WriteLine(currentMessage); // If necessary, write the Message to the Process Log File. if (LogFileManager != null) { LogFileManager.WriteLine(currentMessage); } } // Exit the method. return; } catch { // Exit this method. return; } finally { // If the Messages String Collection was instantiated, close it. if (messages != null) { messages = null; } } }