private void UploadNextAttachment() { try { FileReference fileReference = Provider.ContentManager.FindFirstFileReference(Message.Content); if (fileReference == null) { Send(); } else { string identifier = Path.GetFileNameWithoutExtension(fileReference.Path); AzureStorageBlobAttachment attachment = new AzureStorageBlobAttachment(identifier, Message, fileReference); ZumoAttachmentUploader uploader = new ZumoAttachmentUploader(ZumoProvider, Logger, ZumoProvider.MobileServiceClient, attachment); uploader.Succeeded += OnUploaderSucceeded; uploader.Failed += OnUploaderFailed; uploader.Start(); } } catch (Exception e) { OnRequestFailed(string.Format("Cannot send message: {0}.", e.Message), RetryStrategy.Never); } }
public ZumoAttachmentUploader(ZumoProvider provider, Logger logger, MobileServiceClient mobileServiceClient, AzureStorageBlobAttachment attachment) { this.provider = provider; this.logger = logger; this.mobileServiceClient = mobileServiceClient; this.attachment = attachment; }
private void OnUploaderSucceeded(object o, EventArgs e) { AzureStorageBlobAttachment attachment = ((ZumoAttachmentUploader)o).Attachment; Message.Content = Provider.ContentManager.ReplaceReference(Message.Content, attachment.FileReference, attachment.BlobReference); MessageStore.Outbox.Update(Message); UploadNextAttachment(); }