diff --git a/FastGithub.UI/UdpLogListBox.xaml.cs b/FastGithub.UI/UdpLogListBox.xaml.cs index 7aef0ac..554e44f 100644 --- a/FastGithub.UI/UdpLogListBox.xaml.cs +++ b/FastGithub.UI/UdpLogListBox.xaml.cs @@ -9,6 +9,7 @@ namespace FastGithub.UI /// public partial class UdpLogListBox : UserControl { + private readonly int maxLogCount = 100; public ObservableCollection LogList { get; } = new ObservableCollection(); public UdpLogListBox() @@ -28,7 +29,11 @@ namespace FastGithub.UI var log = await UdpLogger.GetUdpLogAsync(); if (log != null) { - this.LogList.Add(log); + this.LogList.Insert(0, log); + if (this.LogList.Count > this.maxLogCount) + { + this.LogList.RemoveAt(this.maxLogCount); + } } } catch (Exception)