mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
WPF: Try to fix high single core cpu usage
This commit is contained in:
parent
0b8cf27ce9
commit
91edf11bf8
|
@ -33,6 +33,9 @@ namespace BililiveRecorder.WPF.Controls
|
|||
{ }
|
||||
}
|
||||
|
||||
private static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1);
|
||||
private DateTimeOffset lastSizeChanged = DateTimeOffset.MinValue;
|
||||
|
||||
private void ListView_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
|
@ -40,6 +43,13 @@ namespace BililiveRecorder.WPF.Controls
|
|||
if (sender is not ListView listView) return;
|
||||
if (listView.View is not GridView view) return;
|
||||
|
||||
var now = DateTimeOffset.Now;
|
||||
|
||||
if (now - this.lastSizeChanged < OneSecond)
|
||||
return;
|
||||
|
||||
this.lastSizeChanged = now;
|
||||
|
||||
var w = listView.ActualWidth - SystemParameters.VerticalScrollBarWidth - 105 - 60 - 105;
|
||||
|
||||
view.Columns[0].Width = 105;
|
||||
|
|
Loading…
Reference in New Issue
Block a user