From be014b12b38b3eb815bb7c719c1cdf3581eeab5e Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 14 Mar 2013 19:32:42 +0000 Subject: [PATCH] Create an RTF file with a name that matches the 7Zip file and open it when the List to Clipboard menu option is pressed. This will only happen if the Zip file is created. --- PROMS/Sync/Sync/frmSync.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/PROMS/Sync/Sync/frmSync.cs b/PROMS/Sync/Sync/frmSync.cs index 3db06c37..7fb6a049 100644 --- a/PROMS/Sync/Sync/frmSync.cs +++ b/PROMS/Sync/Sync/frmSync.cs @@ -222,12 +222,20 @@ namespace Sync } BuildZipOfMailBox(tbMailBox.Text); } + private string _RTFFile = null; + public string RTFFile + { + get { return _RTFFile; } + set { _RTFFile = value; } + } private void BuildZipOfMailBox(string mailbox) { SevenZipCompressor.SetLibraryPath(Application.StartupPath + @"\7z.dll"); SevenZipCompressor cmpr = new SevenZipCompressor(); cmpr.PreserveDirectoryRoot = true; - string zipName = string.Format("{0} To SS {1}.7z", mailbox, DateTime.Now.ToString("yyyyMMdd HHmm")); + string fileDate = DateTime.Now.ToString("yyyyMMdd HHmm"); + RTFFile = string.Format("{0} To SS {1}.Rtf", mailbox, fileDate); + string zipName = string.Format("{0} To SS {1}.7z", mailbox, fileDate); cmpr.CompressDirectory(mailbox, zipName, "*.*", true); MessageBox.Show(string.Format("{0} created!", zipName), "Mailbox Zip Created", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -500,7 +508,13 @@ namespace Sync dao.SetData(DataFormats.Text,sb.ToString()); dao.SetData(DataFormats.Rtf, rtb.Rtf); Clipboard.SetDataObject(dao, true, 10, 500); - MessageBox.Show(sb.ToString(), "Copied to Clipboard", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (RTFFile != null) + { + rtb.SaveFile(RTFFile); + System.Diagnostics.Process.Start(RTFFile); + } + else + MessageBox.Show(sb.ToString(), "Copied to Clipboard", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) {