Ejemplo n.º 1
0
 public void MessageReceived(object sender, MessageEventArgs e)
 {
     if (e.Message != null && !string.IsNullOrEmpty(e.Message.Trim()))
     {
         ProcessMessageObj(e);
     }
 }
Ejemplo n.º 2
0
 public static void MessageReceived(object sender, MessageEventArgs e)
 {
     if (e.Message != null && !string.IsNullOrEmpty(e.Message.Trim()))
     {
         JLog.Default.Write(LogMode.Info, e.Message);
     }
 }
Ejemplo n.º 3
0
 public void ProcessMessageObj(MessageEventArgs e)
 {
     if (this.txtMessage.InvokeRequired)
     {
         Action<MessageEventArgs> d = new Action<MessageEventArgs>(ProcessMessageObj);
         this.txtMessage.Invoke(d, e);
     }
     else
     {
         if (e.Message != null && !string.IsNullOrEmpty(e.Message.Trim()))
         {
             this.txtMessage.AppendText(e.Message);
             this.txtMessage.AppendText(Environment.NewLine);
             if (e.Level.Equals(MessageLevel.Error))
             {
                 this.txtError.AppendText(e.Message);
                 this.txtError.AppendText(Environment.NewLine);
             }
         }
     }
 }
Ejemplo n.º 4
0
        public void Write(MessageLevel level, Exception ex, string messageFormat, params object[] args)
        {
            if (this.MessageReceived == null) return;

            string msg = args == null || args.Count() < 1 ? messageFormat : string.Format(messageFormat, args);
            MessageEventArgs msgArgs = new MessageEventArgs(level, msg + string.Format("\r\n异常信息:{0}", ex.GetAllMessage()));
            this.MessageReceived(null, msgArgs);
        }
Ejemplo n.º 5
0
        public void Write(MessageLevel level, Exception ex)
        {
            if (this.MessageReceived == null) return;

            MessageEventArgs msgArgs = new MessageEventArgs(level, ex.GetAllMessage());
            this.MessageReceived(null, msgArgs);
        }
Ejemplo n.º 6
0
        public void Write(MessageLevel level, string messageFormat, params object[] args)
        {
            if (this.MessageReceived == null) return;

            string message = args == null || args.Count() < 1 ? messageFormat : string.Format(messageFormat, args);
            MessageEventArgs msgArgs = new MessageEventArgs(level, message);
            this.MessageReceived(null, msgArgs);
        }
Ejemplo n.º 7
0
 private static void RegisterLogService(object sender, MessageEventArgs e)
 {
     LogMode logMode = (LogMode)Enum.Parse(typeof(LogMode), Enum.GetName(typeof(MessageLevel), e.Level), true);
     JLog.Default.Write(logMode, e.Message);
 }