private void FileSystemWatcherOnCreated(object sender, FileSystemEventArgs e) { _fileSystemWatcher.EnableRaisingEvents = false; if (e.ChangeType == WatcherChangeTypes.Created) { string filePath = e.FullPath; //ensure file is completely saved to hard disk while (CanAccessFile(filePath) == false) { Thread.Sleep(100); } Thread.Sleep(1000);//for some reason we need to wait here for file lock to be released on image file Array imageArray = ReadCameraImageArray(filePath); if (_autoDeleteImageFile) { File.Delete(filePath); } ExposureReady?.Invoke(this, new ExposureReadyEventArgs(imageArray)); } }
private void _remoteApp_ExposureReady(object sender, ExposureReadyEventArgs e) { ExposureReady?.Invoke(this, e); }