private void butShowImages_Click(object sender,EventArgs e) { try { //We need a folder in order to place the images beside the html file in order for the relative image paths to work correctly. string htmlFolderPath=ODFileUtils.CreateRandomFolder(PrefC.GetTempFolderPath());//Throws exceptions. string filePathHtml=ODFileUtils.CreateRandomFile(htmlFolderPath,".html"); string html=webBrowser.DocumentText; List<MimeEntity> listMimeEntries=new List<MimeEntity>(); listMimeEntries.AddRange(_listAppParts); listMimeEntries.AddRange(_listImageParts); html=ParseAndSaveAttachement(htmlFolderPath,html,listMimeEntries); File.WriteAllText(filePathHtml,html); _isLoading=true; webBrowser.Navigate(filePathHtml); butShowImages.Visible=false; } catch(Exception ex) { MessageBox.Show(ex.ToString()); } }
private void butShowImages_Click(object sender, EventArgs e) { try { //We need a folder in order to place the images beside the html file in order for the relative image paths to work correctly. string htmlFolderPath = ODFileUtils.CreateRandomFolder(PrefC.GetTempFolderPath()); //Throws exceptions. string filePathHtml = ODFileUtils.CreateRandomFile(htmlFolderPath, ".html"); string html = webBrowser.DocumentText; for (int i = 0; i < _listImageParts.Count; i++) { string contentId = EmailMessages.GetMimeImageContentId(_listImageParts[i]); string fileName = EmailMessages.GetMimeImageFileName(_listImageParts[i]); html = html.Replace("cid:" + contentId, fileName); EmailMessages.SaveMimeImageToFile(_listImageParts[i], htmlFolderPath); } File.WriteAllText(filePathHtml, html); _isLoading = true; webBrowser.Navigate(filePathHtml); butShowImages.Visible = false; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }