Skip to content

Commit

Permalink
On log event
Browse files Browse the repository at this point in the history
  • Loading branch information
grandsilence committed Jul 20, 2018
1 parent eca4820 commit 301682c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Leaf.Core/Threading/ThreadSafeUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public abstract class ThreadSafeUI
/// </summary>
public CancellationToken CancelToken => CancellationSource.Token;

/// <summary>
/// Обработчик событий при вызове Log.
/// </summary>
public event DFormLog OnLog;

/// <summary>
/// Возвращает истину если работа была отменена пользователем.
/// </summary>
Expand Down Expand Up @@ -136,8 +141,11 @@ public void Log(string message, bool showTime = true)
sb.AppendLine(message);

// Выводим в форму отформатированное сообщение
FormLog(sb.ToString());
sb.Clear();
string result = sb.ToString();
FormLog(result);

// Транслируем остальным лог
OnLog?.Invoke(result);
}

/// <summary>
Expand Down

0 comments on commit 301682c

Please sign in to comment.