private void ProcessWatchedFile(DBFile file, string filePath) { //Tracing.Log("iOSDropboxService - DownloadFile - File changed - {0}", filePath); DBError error = null; DBFileStatus status = file.NewerStatus; // If file.NewerStatus is null, the file hasn't changed. if (status == null) return; if (status.Cached) { //Tracing.Log("iOSDropboxService - DownloadFile - File changed - File is cached; updating {0}", filePath); file.Update(out error); if (error != null) throw new Exception(error.Description); byte[] bytes = null; try { var data = file.ReadData(out error); if (error != null) throw new Exception(error.Description); bytes = new byte[data.Length]; System.Runtime.InteropServices.Marshal.Copy(data.Bytes, bytes, 0, Convert.ToInt32(data.Length)); } finally { // Do we really need to close here? Or CloseAllFiles? if (file != null) file.Close(); } if (OnCloudFileDownloaded != null) OnCloudFileDownloaded(filePath, bytes); } else { // The file is still downloading //Tracing.Log("iOSDropboxService - DownloadFile - File changed - File is still downloading {0}", filePath); } }
public NoteController(DBFile file) { File = file; NavigationItem.Title = File.Info.Path.Name; NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.FastForward, this, new MonoTouch.ObjCRuntime.Selector ("didPressUpdate")); }