1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
public void countJobs()
{
while (true)
{
for (int i = 0; i < this.listviewHotfolders.Items.Count; i++)
{
String[] files = Directory.GetFiles(this.listviewHotfolders.Items[i].SubItems[4].Text);
int count = 0;
foreach (String file in files)
{
if (Path.GetExtension(file) == ".pdf")
count++;
}
if (this.listviewHotfolders.InvokeRequired)
{
this.Invoke(UpdateCount, i, count.ToString());
}
else
{
UpdateCount(i, count.ToString());
}
}
Thread.Sleep(15000);
}
}
public UpdateCount(int index, string val)
{
this.listviewHotfolders.Items[index].SubItems[6].Text = val;
} |