public static void Log(string _m, EMessageType _t = EMessageType.MESSAGE, [CallerLineNumber] int _l = 0, [CallerMemberName] string _c = null, [CallerFilePath] string _s = null) { SMessageInfo message = new SMessageInfo() { Script = _s, Method = _c, Line = _l, Message = _m, Type = _t }; if (m_pauseError.IsChecked.Value) { if (_t == EMessageType.ERROR) { m_main.m_GameMode.Pause(); } } if (!m_messageCollection.ContainsKey(message)) { m_messageCollection.Add(message, new List <DateTime>() { DateTime.Now }); } else { m_messageCollection[message].Add(DateTime.Now); } SetStatus(message); IterateOutputMessages(); }
static UIElement CreateMessage(DateTime _d, SMessageInfo _m, int?_i) { //Content of the message StackPanel stack = new StackPanel() { Orientation = Orientation.Horizontal, Spacing = 10, Margin = new Thickness(10, 0, 0, 0) }; if (_m.Type == EMessageType.WARNING) { stack.Children.Add(new FontIcon() { Glyph = "\uE7BA" }); } else { stack.Children.Add(new SymbolIcon() { Symbol = _m.Type == EMessageType.MESSAGE ? Symbol.Message : Symbol.ReportHacked }); } stack.Children.Add(new TextBlock() { Text = "[" + _d.TimeOfDay.ToString("hh\\:mm\\:ss").ToString() + "]" }); stack.Children.Add(new TextBlock() { Text = _m.Message }); //The flyout when clicked on the message StackPanel stackFlyout = new StackPanel() { Orientation = Orientation.Vertical }; stackFlyout.Children.Add(new TextBlock() { Text = _m.GetInfo() + "\n" }); stackFlyout.Children.Add(new MarkdownTextBlock() { Text = _m.Message, Padding = new Thickness(2) }); stackFlyout.Children.Add(new HyperlinkButton() { Content = Path.GetRelativePath(Directory.GetCurrentDirectory(), _m.Script) + ":" + _m.Line, Foreground = new SolidColorBrush(Windows.UI.Colors.CadetBlue) }); Flyout flyout = new Flyout() { OverlayInputPassThroughElement = stack, Content = stackFlyout }; //Create main grid that gets returned Grid grid = new Grid() { HorizontalAlignment = HorizontalAlignment.Stretch }; grid.Children.Add(stack); //If there is a count the number gets shown on the right if (_i != null) { grid.Children.Add(new TextBlock() { Margin = new Thickness(0, 0, 10, 0), MinWidth = 25, HorizontalAlignment = HorizontalAlignment.Right, Text = _i.ToString() }); } //Set flyout to button that stretches along the grid grid.Children.Add(new Button() { Flyout = flyout, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Background = new SolidColorBrush( _m.Type == EMessageType.MESSAGE ? m_stack.Children.Count() % 2 == 0 ? Windows.UI.Colors.Transparent : Windows.UI.Color.FromArgb(50, 50, 50, 50) : _m.Type == EMessageType.ERROR ? Windows.UI.Color.FromArgb(88, 255, 0, 0) : Windows.UI.Color.FromArgb(88, 255, 255, 0)) }); return(grid); }
static void SetStatus(SMessageInfo _m) { m_status.Text = _m.Message; }