Exemple #1
0
        static public int RemoveAttachment(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                return(0);
            }

            if (Parent.AttachmentView.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select attachment from the Attachments list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            Form1.ListItemAttachment currentAnnot = Parent.AttachmentView.SelectedItems[0] as Form1.ListItemAttachment;
            if (currentAnnot.SubItems[currentAnnot.SubItems.Count - 1].Text == "Embedded File Item")
            {
                IPXC_NameTree attachments = Parent.m_CurDoc.GetNameTree("EmbeddedFiles");
                attachments.Remove(currentAnnot.SubItems[0].Text);
                return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations);
            }
            IPXC_Pages pages = Parent.m_CurDoc.Pages;
            IPXC_Page  page  = pages[(uint)(currentAnnot.m_nPageNumber)];

            page.RemoveAnnots((uint)currentAnnot.m_nIndexOnPage, 1);

            Marshal.ReleaseComObject(page);
            Marshal.ReleaseComObject(pages);


            return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations);
        }
Exemple #2
0
        static public int RemoveNamedDest(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                return(0);
            }
            if (Parent.SelectedNameDest_Item == null)
            {
                return(0);
            }

            IPXC_NameTree nameTree = Parent.m_CurDoc.GetNameTree("Dests");

            nameTree.Remove(Parent.SelectedNameDest_Item.Text);
            Marshal.ReleaseComObject(nameTree);
            return((int)Form1.eFormUpdateFlags.efuf_NamedDests);
        }