diff --git a/Artemis/Artemis/App.xaml b/Artemis/Artemis/App.xaml index e13bd017f..1b093a2b3 100644 --- a/Artemis/Artemis/App.xaml +++ b/Artemis/Artemis/App.xaml @@ -21,6 +21,7 @@ Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> + diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj index abd596e18..bce65305f 100644 --- a/Artemis/Artemis/Artemis.csproj +++ b/Artemis/Artemis/Artemis.csproj @@ -303,6 +303,10 @@ Code + + LoggingControl.xaml + + @@ -313,6 +317,9 @@ + + MarkdownDialog.xaml + @@ -511,6 +518,8 @@ + + @@ -686,6 +695,14 @@ + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -746,6 +763,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Artemis/Artemis/Controls/Log/LoggingControl.xaml b/Artemis/Artemis/Controls/Log/LoggingControl.xaml new file mode 100644 index 000000000..b1ded7610 --- /dev/null +++ b/Artemis/Artemis/Controls/Log/LoggingControl.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Artemis/Artemis/Controls/Log/LoggingControl.xaml.cs b/Artemis/Artemis/Controls/Log/LoggingControl.xaml.cs new file mode 100644 index 000000000..cf771ba2d --- /dev/null +++ b/Artemis/Artemis/Controls/Log/LoggingControl.xaml.cs @@ -0,0 +1,37 @@ +using System.Collections.ObjectModel; +using System.Windows.Controls; +using Artemis.Utilities; +using NLog; + +namespace Artemis.Controls.Log +{ + /// + /// Interaction logic for LoggingControl.xaml + /// + public partial class LoggingControl : UserControl + { + public LoggingControl() + { + LogCollection = new ObservableCollection(); + + InitializeComponent(); + + // init memory queue + Logging.ClearLoggingEvent(); + Logging.MemoryEvent += EventReceived; + } + + public static ObservableCollection LogCollection { get; set; } + + private async void EventReceived(LogEventInfo message) + { + await Dispatcher.InvokeAsync(() => + { + if (LogCollection.Count >= 50) + LogCollection.RemoveAt(LogCollection.Count - 1); + + LogCollection.Add(message); + }); + } + } +} \ No newline at end of file diff --git a/Artemis/Artemis/Controls/Log/MemoryEventTarget.cs b/Artemis/Artemis/Controls/Log/MemoryEventTarget.cs new file mode 100644 index 000000000..acbe7690e --- /dev/null +++ b/Artemis/Artemis/Controls/Log/MemoryEventTarget.cs @@ -0,0 +1,20 @@ +using System; +using NLog; +using NLog.Targets; + +namespace Artemis.Controls.Log +{ + public class MemoryEventTarget : Target + { + public event Action EventReceived; + + /// + /// Notifies listeners about new event + /// + /// The logging event. + protected override void Write(LogEventInfo logEvent) + { + EventReceived?.Invoke(logEvent); + } + } +} \ No newline at end of file diff --git a/Artemis/Artemis/Dialogs/MarkdownDialog.xaml b/Artemis/Artemis/Dialogs/MarkdownDialog.xaml new file mode 100644 index 000000000..8a9587fe5 --- /dev/null +++ b/Artemis/Artemis/Dialogs/MarkdownDialog.xaml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + +