public override void AnnotationShare(Guid shareTaskId, string provider, Obany.Render.Objects.Canvas canvas, string title, bool isPublic, string keywords, AnnotationShareComplete annotationShareComplete) { ThreadPool.QueueUserWorkItem(delegate(object s) { bool success = false; Uri providerUri = null; Obany.DocumentStorage.Model.IDocumentStorageProvider documentStorageProvider = Core.CoreConfiguration.DocumentStorageProviderFactory.CreateInstance(provider); if (documentStorageProvider != null) { ApiCredential apic = ApiCredentialsGet(provider); if (apic != null) { bool sessionOk = true; ISessionProvider sessionProvider = documentStorageProvider as ISessionProvider; string sessionId = null; if (sessionProvider != null) { Obany.Provider.Model.Results.SessionStartResult sessionStartResult = sessionProvider.SessionStart( Obany.Cryptography.SecureEncryption.DecryptData(apic.ApiCredentials1), Obany.Cryptography.SecureEncryption.DecryptData(apic.ApiCredentials2), Obany.Cryptography.SecureEncryption.DecryptData(apic.ApiCredentials3), Obany.Cryptography.SecureEncryption.DecryptData(apic.ApiCredentials4)); if (sessionStartResult.Status != OperationStatus.Success) { sessionOk = false; } else { sessionId = sessionStartResult.SessionId; } } if (sessionOk) { Obany.Render.Canvas.CanvasRenderer canvasRenderer = new Obany.Render.Canvas.CanvasRenderer(); string errorMessage; Obany.Render.Objects.RenderCanvas renderCanvas = canvasRenderer.Render(canvas, "application/pdf", GetFontFolderPath(), out errorMessage); if (renderCanvas != null) { List <Obany.DocumentStorage.Model.DocumentMetadata> documentMetaData = new List <Obany.DocumentStorage.Model.DocumentMetadata>(); if (!string.IsNullOrEmpty(keywords)) { documentMetaData.Add(new Obany.DocumentStorage.Model.DocumentMetadata("Keywords", keywords)); } Obany.DocumentStorage.Model.Results.DocumentUploadResult documentUploadResult = documentStorageProvider.DocumentUpload(title, "pdf", renderCanvas.Data, "application/pdf", isPublic, documentMetaData); if (documentUploadResult.Status == OperationStatus.Success) { providerUri = documentStorageProvider.GetDocumentUrl(documentUploadResult.DocumentId); success = true; } } if (sessionProvider != null) { sessionProvider.SessionEnd(sessionId); } } } } if (annotationShareComplete != null) { annotationShareComplete(success, shareTaskId, providerUri); } }); }