Beispiel #1
0
        void WriteHeader(StreamWriter _writer, MessageLevelEnum _level, string _tag)
        {
            string header = "[ " + _level.ToString();

            if (!String.IsNullOrEmpty(_tag))
            {
                header += ", " + _tag;
            }
            if (_WriteEllapsedTime)
            {
                TimeSpan ts = DateTime.Now - _StartTime;
                header += ", " + ts.ToString(@"hh\:mm\:ss\.ff");
            }
            _writer.WriteLine(header + " ]");
        }
        protected override void InternalWrite(MessageLevelEnum _level, string _tag, string _message)
        {
            string title = _level.ToString();

            if (!String.IsNullOrEmpty(_tag))
            {
                title += ", " + _tag;
            }
            MessageBoxIcon icon = MessageBoxIcon.Warning;

            if (_level == MessageLevelEnum.Error || _level == MessageLevelEnum.FatalError)
            {
                icon = MessageBoxIcon.Error;
            }
            else if (_level == MessageLevelEnum.Information)
            {
                icon = MessageBoxIcon.Information;
            }
            MessageBox.Show(_message, title, MessageBoxButtons.OK, icon);
        }