Skip to content

Commit

Permalink
日志倒置
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Nov 19, 2021
1 parent 0ebc295 commit 10f5f0b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FastGithub.UI/UdpLogListBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace FastGithub.UI
/// </summary>
public partial class UdpLogListBox : UserControl
{
private readonly int maxLogCount = 100;
public ObservableCollection<UdpLog> LogList { get; } = new ObservableCollection<UdpLog>();

public UdpLogListBox()
Expand All @@ -28,7 +29,11 @@ private async void InitUdpLoggerAsync()
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)
Expand Down

0 comments on commit 10f5f0b

Please sign in to comment.