示例#1
0
        static void Main(string[] args)
        {
            // Make sure that the required DLL files exist
            if (!DLLExist())
            {
                string msg = "A required dll was not found. Please make sure that \n";
                msg += "StrStorage.dll, dynapdf.dll, and pdfium.dll are in the same folder\n";
                msg += "as this program and try again.\n";

                MessageBox.Show(msg, "A Required DLL Was Not Found");

                return; // Don't Launch the application
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            // Check args to open associated files
            if (args != null && args.Length > 0)
            {
                //When /attrib arg is given setup file associations then quit
                if (args[0] == "/attrib")
                {
                    FileAssociations.EnsureAssociationsSet();
                    return;
                }

                //A filename arg is set, open it

                string fileName = args[0];
                Form1  MainFrom = new Form1();

                //Check file exists
                if (File.Exists(fileName))
                {
                    MainFrom.LoadFileIntoViewer(fileName);
                }

                Application.Run(MainFrom);
            }
            //without args
            else
            {
                Application.Run(new Form1());
            }
        }
示例#2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     FileAssociations.EnsureAssociationsSet();
     MessageBox.Show("File association complete", "Associate");
 }