Esempio n. 1
0
 public static void SetTextBlockDisplayLevel(TextBlock textBlock, MessageLevelsEnum level)
 {
     if (textBlock.Dispatcher.CheckAccess())
     {
         textBlock.Foreground = GetBrushForMessageLevel(level);
     }
     else
     {
         textBlock.Dispatcher.BeginInvoke(delegate { SetTextBlockDisplayLevel(textBlock, level); });
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
 }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
 public static void SetTextBlockDisplayLevel(TextBlock textBlock, MessageLevelsEnum level)
 {
     if (textBlock.Dispatcher.CheckAccess()) {
         textBlock.Foreground = GetBrushForMessageLevel(level);
     }
     else {
         textBlock.Dispatcher.BeginInvoke(delegate { SetTextBlockDisplayLevel(textBlock, level); });
     }
 }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
        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);
            }
        }
Esempio n. 12
0
 public void LogActivityMessage(MessageLevelsEnum level, string message)
 {
     UIHelper.AppendToActivityLog(m_activityLogScrollViewer, m_activityTextBlock, level, message);
 }