Esempio n. 1
0
        /// <summary>
        /// Log Exception/Error. To display alert requires source NSWindow
        /// </summary>
        /// <param name="exception">Exception.</param>
        /// <param name="message">Message.</param>
        /// <param name="displayAlert">If set to <c>true</c> display alert.</param>
        /// <param name="source">Source.</param>
        public static void AQ_Exception(AQ_EXCEPTION_CODE exception, string message, bool displayAlert = true, NSWindow source = null)
        {
            // build entry
            string sExceptionEntry = string.Format ("{0} {1}{2}Exception: {3}{2}{4}"
                , DateTime.Now.ToShortDateString()
                , DateTime.Now.ToShortTimeString()
                , Environment.NewLine
                , exception
                , message);

            // add to log
            m_sLog += sExceptionEntry + Environment.NewLine;

            // display alert
            if (displayAlert) {
                // create and display alert
                NSAlert alert = new NSAlert ();
                alert.AlertStyle = NSAlertStyle.Warning;
                alert.MessageText = sExceptionEntry;
                alert.BeginSheet (source);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Log Exception/Error. To display alert requires source NSWindow
        /// </summary>
        /// <param name="exception">Exception.</param>
        /// <param name="message">Message.</param>
        /// <param name="displayAlert">If set to <c>true</c> display alert.</param>
        /// <param name="source">Source.</param>
        public static void AQ_Exception(AQ_EXCEPTION_CODE exception, string message, bool displayAlert = true, NSWindow source = null)
        {
            // build entry
            string sExceptionEntry = string.Format("{0} {1}{2}Exception: {3}{2}{4}"
                                                   , DateTime.Now.ToShortDateString()
                                                   , DateTime.Now.ToShortTimeString()
                                                   , Environment.NewLine
                                                   , exception
                                                   , message);

            // add to log
            m_sLog += sExceptionEntry + Environment.NewLine;

            // display alert
            if (displayAlert)
            {
                // create and display alert
                NSAlert alert = new NSAlert();
                alert.AlertStyle  = NSAlertStyle.Warning;
                alert.MessageText = sExceptionEntry;
                alert.BeginSheet(source);
            }
        }