Force file watcher to close when file is either saved or canceled

This commit is contained in:
KillzXGaming 2020-05-25 18:08:57 -04:00
parent d5b57b2ad6
commit 1e78c7950f

View file

@ -265,7 +265,7 @@ namespace Toolbox.Library.Forms
FileWatcher = new FileSystemWatcher();
FileWatcher.Path = Path.GetTempPath();
FileWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.LastAccess | NotifyFilters.LastWrite;
FileWatcher.EnableRaisingEvents = true;
FileWatcher.EnableRaisingEvents = false;
FileWatcher.Changed += new FileSystemEventHandler(OnFileWatcherChanged);
FileWatcher.Filter = "";
}
@ -1099,11 +1099,9 @@ namespace Toolbox.Library.Forms
SaveAndApplyImage(new Bitmap(FileName), DecodeTextureBack);
}
}
else
{
FileWatcher.Filter = "";
FileWatcher.EnableRaisingEvents = false;
}
FileWatcher.Filter = "";
FileWatcher.EnableRaisingEvents = false;
}
public void SaveAndApplyImage(Bitmap image, bool DecodeBack)