FileSearchWindows/FileSearch/ExceptionsForm.cs

34 lines
1.0 KiB
C#
Raw Permalink Normal View History

2024-10-05 10:06:04 +03:00
using FileSearch.Logic.Model.Engine;
using FileSearch.Logic.UI.Entries;
namespace FileSearch
{
public partial class ExceptionsForm : Form
{
private IList<SearchException> _exceptions;
private SearchExceptionEntry[] _exceptionEntries;
public ExceptionsForm()
{
InitializeComponent();
}
public void SetContent(IList<SearchException> exceptions)
{
if (exceptions == null) throw new ArgumentNullException("exceptions");
_exceptions = exceptions;
_exceptionEntries = new SearchExceptionEntry[exceptions.Count];
lstItems.VirtualListSize = exceptions.Count;
}
private void lstItems_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
{
var entry = _exceptionEntries[e.ItemIndex];
if (entry == null)
_exceptionEntries[e.ItemIndex] = entry = new SearchExceptionEntry(_exceptions[e.ItemIndex]);
e.Item = entry;
}
}
}