/// <summary>
        ///
        /// This method logs a message based on the Exception object read in.
        /// If compiling in debug mode, this method will just display a message.
        ///
        /// </summary>
        /// <param name="ex" type="Exception">The exception object to be logged.</param>
        public static string Log(Exception ex)
        {
            string strMsg = ExtractExceptionInfo(ex);

            #if !DEBUG
            EventLog.WriteEntry(Application.ProductName, strMsg, EventLogEntryType.Error);
            #else
            frmError frm = new frmError("IN RELEASE MODE THIS WOULD BE LOGGED TO THE EVENT VIEWER" + Environment.NewLine + Environment.NewLine + strMsg);
            frm.ShowInTaskbar = true;
            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.ShowDialog();
            #endif

            return(strMsg);
        }
        /// <summary>
        ///
        /// This method is the event handler for any unhandled exceptions in the application.
        /// If it catches any of these errors, it will display the error, log it, and then exit.
        /// It is hooked in Main.
        ///
        /// </summary>
        /// <param name="sender" type="object">not used.</param>
        /// <param name="t" type="ThreadExceptionEventArgs">the exception thrown.</param>
        public static void HandleApplicationException(object sender, ThreadExceptionEventArgs t)
        {
            try
            {
                frmError frm = new frmError(MyExceptionManager.Log(t.Exception));

                if (frm.ShowDialog() == DialogResult.Cancel)
                {
                    Environment.Exit(0);
                }
            }
            catch
            {
                try
                {
                    MyMessageBox.Show(null, "Fatal Error", MyDisplayMessage.FatalError);
                }
                finally
                {
                    Environment.Exit(0);
                }
            }
        }