private void DelAttachmentRequest(object param) { CommunicationAttachment attachment = param as CommunicationAttachment; if (attachment != null && ConfirmRequest != null) { ConfirmRequest.Raise( new ConditionalConfirmation { Content = "Remove?".Localize(), Title = "Action confirmation".Localize(null, LocalizationScope.DefaultCategory) }, x => { if (x.Confirmed) { OnUIThread(() => { attachment.State = CommunicationItemState.Deleted; ModifiedParentViewModel(); AttacmentsCollection.Refresh(); State = CommunicationItemState.Modified; }); } }); } }
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; }); } } }