Ejemplo n.º 1
0
        // TODO: For a better customization/user experience add InArgument<string> DownloadLocation

        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            PropertyDescriptor dropboxSessionProperty = context.DataContext.GetProperties()[WithDropboxSession.DropboxSessionPropertyName];
            IDropboxSession    dropboxSession         = dropboxSessionProperty?.GetValue(context.DataContext) as IDropboxSession;

            if (dropboxSession == null)
            {
                throw new InvalidOperationException(Resources.DropboxSessionNotFoundException);
            }

            await dropboxSession.DownloadFolderAsZipAsync(FolderPath.Get(context), DownloadFolder.Get(context), ZipFileName.Get(context), cancellationToken);

            return((asyncCodeActivityContext) => { });
        }