Пример #1
0
        private string DownloadFirmware(string codfw)
        {
            bool documentotrovato = true;
            //Carica immagine scheda
            string pathFW = Properties.Settings.Default.Path_URL_Software;
            char   last   = pathFW[pathFW.Length - 1];

            if (last != '/')
            {
                pathFW = pathFW + '/';
            }
            pathFW = pathFW + codfw + "/";
            pathFW = pathFW + codfw + ".s37";
            string tmpfolder       = GFunc.TempFolder();
            string windowsTempPath = tmpfolder + codfw + ".s37";

            using (var client = new WebClient())
            {
                try { client.DownloadFile(pathFW, windowsTempPath); }
                catch (WebException ex) { documentotrovato = false; }
            }

            if (documentotrovato)
            {
                return(windowsTempPath);
            }
            else
            {
                return("");
            }
        }
Пример #2
0
        private bool CaricaPDFEn(string codkit)
        {
            bool documentotrovato = true;
            //Carica immagine scheda
            string pathpdf = Properties.Settings.Default.Path_URL_Documentazione;
            char   last    = pathpdf[pathpdf.Length - 1];

            if (last != '/')
            {
                pathpdf = pathpdf + '/';
            }
            pathpdf = pathpdf + codkit;
            pathpdf = pathpdf + "/en/";
            pathpdf = pathpdf + codkit + ".pdf";
            string tmpfolder       = GFunc.TempFolder();
            string windowsTempPath = tmpfolder + codkit + ".pdf";

            using (var client = new WebClient())
            {
                try { client.DownloadFile(pathpdf, windowsTempPath); }
                catch (WebException ex) { documentotrovato = false; }
            }

            if (documentotrovato)
            {
                Win_form_PDF form_pdf = new Win_form_PDF(windowsTempPath);
                form_pdf.Visible = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }