Beispiel #1
0
        private void treeFolder_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode stn = e.Node;

            ViewingMessage = null;
            if (stn.Level == 0)
            {
                PFFMessage        sf = (PFFMessage)stn.Tag;
                PFFItem.ItemTypes t  = sf.GetItemType();
                ViewingMessage = sf;
                if (t == PFFItem.ItemTypes.Appointment || t == PFFItem.ItemTypes.Meeting)
                {
                    PFFCalendarItem c = new PFFCalendarItem(sf);
                    string          r = c.GetBody(PFFMessage.BodyType.HTML);
                    browser.DocumentText = r;
                }
                else
                {
                    string r = sf.GetBody(PFFMessage.BodyType.HTML);
                    browser.DocumentText = r;
                }
                sf.GetRecipients();
            }
            else
            {
                browser.DocumentText = "Cannot preview attachments";
            }
        }
Beispiel #2
0
        private void cmdExport_Click(object sender, EventArgs e)
        {
            string outputDir = txtOutputLocation.Text;

            if (Directory.Exists(outputDir))
            {
                int tabIndex = tabControls.SelectedIndex;
                if (tabIndex == 0)
                {
                    // in the folder browsing view -- export the full folder
                    TreeNode  n       = treeStructure.SelectedNode;
                    PFFFolder f       = (PFFFolder)n.Tag;
                    string    NewPath = Path.Combine(outputDir, "");
                    Directory.CreateDirectory(NewPath);
                    f.Export(NewPath);
                }
                else if (tabIndex == 1)
                {
                    // in the item browsing view -- export the single item
                    TreeNode n = treeFolder.SelectedNode;
                    if (n.Level == 0)
                    {
                        // this is a standard message
                        PFFMessage m = (PFFMessage)n.Tag;
                        switch (m.GetItemType())
                        {
                        case PFFItem.ItemTypes.Email:
                            SmtpClient Client = new SmtpClient("empty");
                            Client.DeliveryMethod          = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                            Client.PickupDirectoryLocation = outputDir;
                            Client.Send(m.GetAsMailMessage());
                            break;
                        }
                    }
                    else
                    {
                        // this is an attachment
                        PFFAttachment a = (PFFAttachment)n.Tag;
                        a.SaveContents(Path.Combine(outputDir, a.GetName()));
                    }
                }
            }
            else
            {
                MessageBox.Show("Output directory not set or doesn't exist", "Output Directory Error");
            }
        }