view plaincopy to clipboardPRint?
#region 日志記錄、支持其他線程訪問
public delegate void LogAppendDelegate(Color color, string text);
/// <summary>
/// 追加顯示文本
/// </summary>
/// <param name="color">文本顏色</param>
/// <param name="text">顯示文本</param>
public void LogAppend(Color color, string text)
{
richTextBoxRemote.AppendText("
");
richTextBoxRemote.SelectionColor = color;
richTextBoxRemote.AppendText(text);
}
/// <summary>
/// 顯示錯誤日志
/// </summary>
/// <param name="text"></param>
public void LogError(string text)
{
LogAppendDelegate la = new LogAppendDelegate(LogAppend);
richTextBoxRemote.Invoke(la, Color.Red, DateTime.Now.ToString("HH:mm:ss ") + text);
}
/// <summary>
/// 顯示警告信息
/// </summary>
/// <param name="text"></param>
public void LogWarning(string text)
{
LogAppendDelegate la = new LogAppendDelegate(LogAppend);
richTextBoxRemote.Invoke(la, Color.Violet, DateTime.Now.ToString("HH:mm:ss ") + text);
}
/// <summary>
/// 顯示信息
/// </summary>
/// <param name="text"></param>
public void LogMessage(string text)
{
LogAppendDelegate la = new LogAppendDelegate(LogAppend);
richTextBoxRemote.Invoke(la, Color.Black, DateTime.Now.ToString("HH:mm:ss ") + text);
}
#endregion