【发布时间】:2015-07-04 08:45:05
【问题描述】:
我编写了一个小函数,用于使用 API 扫描带有 Virus Total 的文件。它工作得很好,但扫描结果不是按字母顺序排序的。
这是我的代码:
public void init(FileReport _scanResult) {
try {
if (_scanResult.ResponseCode == ReportResponseCode.Present) {
foreach (ScanEngine scan in _scanResult.Scans) {
if (scan.Detected == true) {
howMany++;
_scanResultItems.Add(new ScanResultItems {
AvName = scan.Name,
AvResult = new Uri("/Images/inWatch.avNOT.png", UriKind.RelativeOrAbsolute),
AvStatus = "BEDROHUNG!"
});
Width = 390;
}
else {
_scanResultItems.Add(new ScanResultItems {
AvName = scan.Name,
AvResult = new Uri("/Images/inWatch.avOK.png", UriKind.RelativeOrAbsolute),
AvStatus = "OK"
});
}
}
lstScanResults.ItemsSource = _scanResultItems.OrderBy(item => item.AvName).ToList();
}
}
catch(Exception ex) {
GeneralSettings.LogException(ex);
}
感谢您的回答!
【问题讨论】:
-
感谢您的回答,但似乎没有一个对我有用。
标签: c# wpf listbox observablecollection