private void DoWorkDeleteFile(object sender, DoWorkEventArgs e) {
// Debug.WriteLine(this.config.getPersistant("folders"));
BackgroundWorker worker = sender as BackgroundWorker;
// Lower priority to ensure smooth working of main screensaver
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
int monitorId = Convert.ToInt32(((object[])(e.Argument))[0]);
string filename = Convert.ToString(((object[])(e.Argument))[1]);
int i = 0;
while (File.Exists(filename) && i < 100) {
i++;
try {
FileSystem.DeleteFile(filename, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing);
this.fileNodes.deleteFromDB(filename);
} catch (ArgumentNullException ane) {
this.monitors[i].showInfoOnMonitor("Nothing to delete");
} catch (Exception ex) {
if (this.monitors[i].imagePath() == filename) this.monitors[i].showInfoOnMonitor("Deleting\n"+Path.GetFileName(filename));
Thread.Sleep(1000);
}
}
}