private void Watcher_FileCacheStateInformed(object sender, FileCacheStateInformedEventArg e) { try { var info = e.FileInfo; if (info.FileState == FileCachedState.Ready) { var destPath = Path.Combine(Path.GetDirectoryName(info.FilePath), SubfolderNameForUploadToGoogleDrive, Path.GetFileName(info.FilePath)); FileMove(info.FilePath, destPath); if (connected) { Task.Run(() => { Upload(destPath); }); } else { log.Error("Google Drive is not connected!"); } } else { log.Error(string.Format("File \"{0}\" is still busy after waiting \"{1}\" seconds, abort!", DateTime.Now.Subtract(info.cachedTime))); } } catch (Exception ex) { log.Error("Watcher_FileCacheStateInformed, ex = " + ex); } }
protected virtual void OnFileCacheStateInformed(FileCacheStateInformedEventArg e) { var handler = FileCacheStateInformed; if (handler != null) { handler(this, e); } }