示例#1
0
        public void DisplayLog(string strResult, Color color = default(Color), bool isEnable = true)
        {
            if (!isEnable)
            {
                return;
            }

            string str = string.Format("{0}:<{1}>\r\n", DateTime.Now.ToString("MM/dd hh:mm:ss"), strResult);

            try
            {
                richTextBox.Invoke(new MethodInvoker(delegate()
                {
                    if (richTextBox.Text.Length >= MaxCharWithinOneLine)
                    {
                        richTextBox.Text.Remove(0, richTextBox.Text.IndexOf('\r') + 2);
                    }

                    richTextBox.AppendText(str);
                    richTextBox.ScrollToCaret();

                    Debug("", strResult);
                }));
            }
            catch (Exception ex)
            {
                SharpLog.Fatal("DisplayLog", ex.ToString());
            }
        }
示例#2
0
 public void Error(string methodName, string logData, string className = null, bool isEnable = true)
 {
     SharpLog.Error(methodName, logData, className, isEnable);
 }