/// <summary> /// Start dropbox sync /// </summary> public void Start() { Debug.Assert(_ws.HasDropBoxToken); _client = new DropNetClient( AppSetting.DROPBOX_API_KEY, AppSetting.DROPBOX_API_SECRET, _ws.DropBoxToken, _ws.DropBoxSecret); // // is first time sync? // bool isfirstsync = (_ws.HasLastSyncHashCode == false); if (isfirstsync) { Log("First sync:{0}...", _ws.Name); _client.GetMetaDataAsync(_ws.DropBoxPath, OnFirstSyncMetaDataReceived, OnFirstSyncMetaDataError); return; } Log("Sync was done once before"); SyncFiles(); }
private void downloadVerseDatabase(DropNetClient client) { const string VerseDbFileName = "verses.sqlite3"; client.GetMetaDataAsync("/", metadata => { var versesDb = metadata.Contents .Where(x => !x.Is_Dir && x.Name == VerseDbFileName) .FirstOrDefault(); if (versesDb == null) { notifyError("Could not find '" + VerseDbFileName + "' in your Dropbox root folder."); return; } client.GetFileAsync(versesDb.Path, file => { var fileBytes = file.RawBytes; var fileStream = new MemoryStream(fileBytes); writeDatabaseToIsolatedStorage(fileStream); }, ex => notifyError(ex)); }, ex => notifyError(ex)); }
private static void Synchronize(DropNetClient client, SyncInfo info, Action<SyncCompleteInfo> report) { client.GetMetaDataAsync(info.Path, meta => OnFileMetaReady(client, info, meta, report), ex => report(new SyncCompleteInfo { Path = info.Path, Result = SyncResults.Failed, })); }
private void RefreshList() { progBusy.IsBusy = true; _cmdRefresh.IsEnabled = false; var client = new DropNetClient( DropBoxInfo.KEY, DropBoxInfo.SECRET, _token, _secret); client.GetMetaDataAsync(_path, OnListComplete, OnListFailed); }