public Attachment CommunicationAttachment2Attachment(CommunicationAttachment commAttach) { Attachment retVal = new Attachment(); if (commAttach.AttachmentId != null) { retVal.AttachmentId = commAttach.AttachmentId; } retVal.CreatorName = commAttach.CreatorName; retVal.DisplayName = commAttach.DisplayName; retVal.FileType = commAttach.FileType; retVal.FileUrl = commAttach.FileUrl; retVal.LastModified = commAttach.LastModified; return retVal; }
public CommunicationAttachment Attachment2CommunicationAttachment(Attachment attach) { CommunicationAttachment retVal = new CommunicationAttachment { AttachmentId = attach.AttachmentId, CreatorName = attach.CreatorName, DisplayName = attach.DisplayName, FileType = attach.FileType, FileUrl = attach.FileUrl, LastModified = attach.LastModified }; return retVal; }
private void AddAttachmentRequest() { CommunicationAttachment attachment = null; IEnumerable<System.Waf.Applications.Services.FileType> fileTypes = new System.Waf.Applications.Services.FileType[] { new System.Waf.Applications.Services.FileType("all files", ".*"), new System.Waf.Applications.Services.FileType("jpg image", ".jpg"), new System.Waf.Applications.Services.FileType("bmp image", ".bmp"), new System.Waf.Applications.Services.FileType("png image", ".png") }; FileDialogResult result = fileDialogService.ShowOpenFileDialog(this, fileTypes); if (result.IsValid) { try { /* ShowLoadingAnimation = true; Action addFolderItemAction = () => { ReadFileContent(item, item.FileSystemPath); ShowLoadingAnimation = false; }; addFolderItemAction.BeginInvoke(null, null);*/ FileInfo fInfo = new FileInfo(result.FileName); if (fInfo != null) { attachment = new CommunicationAttachment() { FileUrl = fInfo.Name, Url = result.FileName, State = CommunicationItemState.Appended }; } } catch { ShowLoadingAnimation = false; throw; } if (attachment != null) { OnUIThread(() => { Attachments.Add(attachment); AttacmentsCollection.Refresh(); State = CommunicationItemState.Modified; }); } } }