Esempio n. 1
0
        //============================================================================*
        // ShowSAAMIPDF()
        //============================================================================*

        public static bool ShowSAAMIPDF(cDataFiles DataFiles, cCaliber Caliber)
        {
            string strDocPath = "https://saami.org/wp-content/uploads/2019/01/";

            string strFileName = "";

            switch (Caliber.FirearmType)
            {
            case cFirearm.eFireArmType.Handgun:
                strFileName = "SAAMI-Z299.3-Centerfire-Pistol-Revolver-Approved-12-14-2015.pdf";
                break;

            case cFirearm.eFireArmType.Rifle:
                strFileName = "SAAMI-Z299.4-Centerfire-Rifle-Approved-12-14-2015.pdf";
                break;

            case cFirearm.eFireArmType.Shotgun:
                strFileName = "SAAMI-Z299.2-Shotshell-Approved-2015-08-31.pdf";
                break;
            }

            string strRemotePath = String.Format("{0}", Path.Combine(strDocPath, strFileName));

            string strLocalPath     = DataFiles.GetSAAMIPath();
            string strLocalFilePath = Path.Combine(strLocalPath, strFileName);

            if (cMainForm.DownloadSAAMIDoc(DataFiles, strRemotePath, strLocalFilePath))
            {
//				Process ReaderProcess = new Process();
//				ProcessStartInfo ReaderStartInfo = new ProcessStartInfo();

//				ReaderStartInfo.Arguments = String.Format(@"""{0}""", strLocalFilePath);

//				if (Caliber.SAAMIPDFPage > 0)
//					ReaderStartInfo.Arguments += String.Format(@" ""#page={0}""", Caliber.SAAMIPDFPage);

                try
                {
                    Process.Start(strLocalFilePath);

//					ReaderStartInfo.FileName = @"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe";

                    //					ReaderProcess.StartInfo = ReaderStartInfo;

                    //					ReaderProcess.Start();
                }
                catch (Exception e)
                {
                    string strMessage = String.Format("Unable to view the PDF file!\n\n{0}", e.Message);

                    MessageBox.Show(strMessage, "View PDF Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return(false);
                }
            }

            return(true);
        }