private async Task ExecuteExportExpressions() { Log.StartTiming(); RefreshCommands(); try { if (!SyncLocally) { if (SyncWithDropboxEnabled && SyncWithLiveEnabled) { WindowService.ShowMessage(Msg.CannotSyncFromTwoSourcesAtTheSameTime); return; } var entity = new MainEntity(); entity.Expressions.AddRange(DataAccess.GetAllExpressions()); var cts = GetTokenSource(ImportExportGroupName); var ct = cts.Token; if (SyncWithDropboxEnabled) { if (!await UploadToDropbox(entity, ct)) { WindowService.ShowMessage(Msg.DropboxExportFailed); } } if (SyncWithLiveEnabled) { if (!await UploadToLive(entity, ct)) { WindowService.ShowMessage(Msg.LiveExportFailed); } } } else { using (var o = new SaveFileDialog()) { var res = o.ShowDialog(); if (res == DialogResult.OK) { var since = ExportSince && ExportSinceDate != DateTime.MinValue ? ExportSinceDate : (DateTime?)null; var entity = new MainEntity(); entity.Expressions.AddRange( DataAccess.GetAllExpressions(since)); Log.StartTiming("ExportToFile"); Persister.ExportToFile(o.FileName, entity); Log.StartTiming("ExportToFile"); } } } } catch (Exception ex) { WindowService.ShowError(ex); } finally { RefreshCommands(); } Log.StopTiming(); }