Exemplo n.º 1
0
        static void Main(string[] args1)
        {
            System.Diagnostics.Debug.Assert(true);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string[] args = { "/v", "D:\\certificado_digital\\Doc3.docx" };

            if (args.Length > 0)
            {
                string[] paths = args[1].Split('|');
                switch (args[0])
                {
                case "/v":
                    if ((paths.Length <= 1) && System.IO.Path.HasExtension(paths[0]))
                    {
                        frmManageDigitalSignature frmManage = new frmManageDigitalSignature(paths, false);
                        notifyInconInstance(frmManage.components);
                        Application.Run(frmManage);
                    }
                    else
                    {
                        frmIncludeSubFolders frmInclude = new frmIncludeSubFolders(paths, args[0]);
                        notifyInconInstance(frmInclude.components);
                        Application.Run(frmInclude);
                    }
                    break;

                case "/r":
                    if ((paths.Length <= 1) && System.IO.Path.HasExtension(paths[0]))
                    {
                        frmSelectDigitalSignatureToRemove frmSelect = new frmSelectDigitalSignatureToRemove(paths, false);
                        notifyInconInstance(frmSelect.components);
                        Application.Run(frmSelect);
                    }
                    else
                    {
                        frmIncludeSubFolders frmInclude = new frmIncludeSubFolders(paths, args[0]);
                        notifyInconInstance(frmInclude.components);
                        Application.Run(frmInclude);
                    }
                    break;

                case "/a":
                    frmAddDigitalSignature frmAdd = new frmAddDigitalSignature(paths, true);
                    notifyInconInstance(frmAdd.components);
                    Application.Run(frmAdd);
                    break;

                default:
                    Application.Exit();
                    break;
                }
            }
        }
        private void btnSign_Click(object sender, EventArgs e)
        {
            List <FileHistory> documentsToAddSignatures = new List <FileHistory>();

            foreach (FileHistory document in selectedDocuments)
            {
                documentsToAddSignatures.Add(document);
            }

            frmAddDigitalSignature FormAddDigitalSignature = new frmAddDigitalSignature(documentsToAddSignatures, false);

            FormAddDigitalSignature.Owner = (frmManageDigitalSignature)this;
            FormAddDigitalSignature.ShowDialog();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            System.Diagnostics.Debug.Assert(true);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

#if DEBUG
            args    = new string[2];
            args[0] = "/v";
            //args[1] = "D:\\certificado_digital\\new_pdf.pdf";
            //args[1] = "D:\\certificado_digital\\new_word.docx";
            //args[1] = "D:\\certificado_digital\\new_word.docx|D:\\certificado_digital\\new_pdf.pdf";
            //args[1] = "D:\\certificado_digital\\Doc7.docx|D:\\certificado_digital\\Doc7_signed_signed.pdf";
            //args[1] = "D:\\certificado_digital\\new_pdf.pdf|D:\\certificado_digital\\Doc7_signed_signed.pdf";
            //args[1] = "D:\\certificado_digital\\doc_not_signed.docx";
            //args[1] = "D:\\certificado_digital\\doc_not_signed.pdf";
            //args[1] = "D:\\certificado_digital\\doc_not_signed.docx|D:\\certificado_digital\\doc_not_signed.pdf";
            //args[1] = "D:\\certificado_digital\\doc_not_signed.pdf|D:\\certificado_digital\\doc_not_signed.docx";
            //args[1] = "D:\\certificado_digital\\new\\doc.pdf";
            //args[1] = "D:\\certificado_digital";
            args[1] = "D:\\certificado_digital\\new\\doc.docx";
            //args[1] = "D:\\certificado_digital\\new\\doc.pdf|D:\\certificado_digital\\new\\doc.docx";

            /*args[1] =
             *  "D:\\certificado_digital\\Documentos_Assinados\\new_excel.xlsx|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\old_excel.xlsx|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\new_powerpoint.pptx|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\old_powerpoint.pptx|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\new_word.docx|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\old_word.docx|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\new_pdf.pdf|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\old_pdf.pdf|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\new_xps.xps|" +
             *  "D:\\certificado_digital\\Documentos_Assinados\\old_xps.xps";
             */
#endif

            if (args.Length > 0)
            {
                string[] paths = args[1].Split('|');
                switch (args[0])
                {
                case "/v":
                    if ((paths.Length <= 1) && System.IO.Path.HasExtension(paths[0]))
                    {
                        frmManageDigitalSignature frmManage = new frmManageDigitalSignature(paths, false);
                        notifyInconInstance(frmManage.components);
                        Application.Run(frmManage);
                    }
                    else
                    {
                        frmIncludeSubFolders frmInclude = new frmIncludeSubFolders(paths, args[0]);
                        notifyInconInstance(frmInclude.components);
                        Application.Run(frmInclude);
                    }
                    break;

                case "/r":
                    if ((paths.Length <= 1) && System.IO.Path.HasExtension(paths[0]))
                    {
                        frmSelectDigitalSignatureToRemove frmSelect = new frmSelectDigitalSignatureToRemove(paths, false);
                        notifyInconInstance(frmSelect.components);
                        Application.Run(frmSelect);
                    }
                    else
                    {
                        frmIncludeSubFolders frmInclude = new frmIncludeSubFolders(paths, args[0]);
                        notifyInconInstance(frmInclude.components);
                        Application.Run(frmInclude);
                    }
                    break;

                case "/a":
                    frmAddDigitalSignature frmAdd = new frmAddDigitalSignature(paths, true);
                    notifyInconInstance(frmAdd.components);
                    Application.Run(frmAdd);
                    break;

                default:
                    Application.Exit();
                    break;
                }
            }
        }