public static void SetTextBlockDisplayLevel(TextBlock textBlock, MessageLevelsEnum level) { if (textBlock.Dispatcher.CheckAccess()) { textBlock.Foreground = GetBrushForMessageLevel(level); } else { textBlock.Dispatcher.BeginInvoke(delegate { SetTextBlockDisplayLevel(textBlock, level); }); } }
public static void SetColouredText(TextBlock textBlock, string text, MessageLevelsEnum level) { if (textBlock.Dispatcher.CheckAccess()) { textBlock.Foreground = GetBrushForMessageLevel(level); textBlock.Text = text; } else { textBlock.Dispatcher.BeginInvoke(new SetColouredTextBlockDelegate(SetColouredText), textBlock, text, level); } }
public void WriteStatusMessage(MessageLevelsEnum status, string message) { if (status == MessageLevelsEnum.Error) { UIHelper.SetColouredText(m_statusTextBlock, message, MessageLevelsEnum.Error); } else if (status == MessageLevelsEnum.Warn) { UIHelper.SetColouredText(m_statusTextBlock, message, MessageLevelsEnum.Warn); } else { UIHelper.SetColouredText(m_statusTextBlock, message, MessageLevelsEnum.Info); } }
public void WriteStatusMessage(MessageLevelsEnum status, string message) { if (status == MessageLevelsEnum.Error) { UIHelper.SetColouredText(m_statusTextBlock, message, MessageLevelsEnum.Error); } else if (status == MessageLevelsEnum.Warn) { UIHelper.SetColouredText(m_statusTextBlock, message, MessageLevelsEnum.Warn); } else { UIHelper.SetColouredText(m_statusTextBlock, message, MessageLevelsEnum.Info); } }
private static SolidColorBrush GetBrushForMessageLevel(MessageLevelsEnum level) { SolidColorBrush brush = null; if (m_normalTextBrush == null) { m_normalTextBrush = AssemblyState.NormalTextBrush; m_infoTextBrush = AssemblyState.InfoTextBrush; m_errorTextBrush = AssemblyState.ErrorTextBrush; m_warnTextBrush = AssemblyState.WarnTextBrush; m_selectedTextBrush = AssemblyState.SelectedTextBrush; } if (level == MessageLevelsEnum.Error) { brush = m_errorTextBrush; } else if (level == MessageLevelsEnum.Warn) { brush = m_warnTextBrush; } else if (level == MessageLevelsEnum.Monitor) { brush = m_infoTextBrush; } else if (level == MessageLevelsEnum.Selected) { brush = m_selectedTextBrush; } else { brush = m_normalTextBrush; } return(brush); }
public static void AppendToActivityLog(ScrollViewer scrollViewer, TextBlock textBlock, MessageLevelsEnum level, string text) { if (scrollViewer.Dispatcher.CheckAccess()) { Run activityRun = new Run(); activityRun.Text = text; activityRun.Foreground = GetBrushForMessageLevel(level); textBlock.Inlines.Add(activityRun); textBlock.Inlines.Add(new LineBreak()); //scrollViewer.ScrollToVerticalOffset(scrollViewer.ScrollableHeight + 20); scrollViewer.UpdateLayout(); scrollViewer.ScrollToVerticalOffset(Double.MaxValue); } else { scrollViewer.Dispatcher.BeginInvoke(new AppendToActivityLogDelegate(AppendToActivityLog), scrollViewer, textBlock, level, text); } }
public void LogActivityMessage(MessageLevelsEnum level, string message) { UIHelper.AppendToActivityLog(m_activityLogScrollViewer, m_activityTextBlock, level, message); }
private static SolidColorBrush GetBrushForMessageLevel(MessageLevelsEnum level) { SolidColorBrush brush = null; if (m_normalTextBrush == null) { m_normalTextBrush = AssemblyState.NormalTextBrush; m_infoTextBrush = AssemblyState.InfoTextBrush; m_errorTextBrush = AssemblyState.ErrorTextBrush; m_warnTextBrush = AssemblyState.WarnTextBrush; m_selectedTextBrush = AssemblyState.SelectedTextBrush; } if (level == MessageLevelsEnum.Error) { brush = m_errorTextBrush; } else if (level == MessageLevelsEnum.Warn) { brush = m_warnTextBrush; } else if (level == MessageLevelsEnum.Monitor) { brush = m_infoTextBrush; } else if (level == MessageLevelsEnum.Selected) { brush = m_selectedTextBrush; } else { brush = m_normalTextBrush; } return brush; }
public static void SetTextBlockDisplayLevel(TextBlock textBlock, MessageLevelsEnum level) { if (textBlock.Dispatcher.CheckAccess()) { textBlock.Foreground = GetBrushForMessageLevel(level); } else { textBlock.Dispatcher.BeginInvoke(delegate { SetTextBlockDisplayLevel(textBlock, level); }); } }
public static void SetColouredText(TextBlock textBlock, string text, MessageLevelsEnum level) { if (textBlock.Dispatcher.CheckAccess()) { textBlock.Foreground = GetBrushForMessageLevel(level); textBlock.Text = text; } else { textBlock.Dispatcher.BeginInvoke(new SetColouredTextBlockDelegate(SetColouredText), textBlock, text, level); } }
public static void AppendToActivityLog(ScrollViewer scrollViewer, TextBlock textBlock, MessageLevelsEnum level, string text) { if (scrollViewer.Dispatcher.CheckAccess()) { Run activityRun = new Run(); activityRun.Text = text; activityRun.Foreground = GetBrushForMessageLevel(level); textBlock.Inlines.Add(activityRun); textBlock.Inlines.Add(new LineBreak()); //scrollViewer.ScrollToVerticalOffset(scrollViewer.ScrollableHeight + 20); scrollViewer.UpdateLayout(); scrollViewer.ScrollToVerticalOffset(Double.MaxValue); } else { scrollViewer.Dispatcher.BeginInvoke(new AppendToActivityLogDelegate(AppendToActivityLog), scrollViewer, textBlock, level, text); } }
public void LogActivityMessage(MessageLevelsEnum level, string message) { UIHelper.AppendToActivityLog(m_activityLogScrollViewer, m_activityTextBlock, level, message); }