Ejemplo n.º 1
0
 static void DownloadDebugSymbols(object sender, EventArgs e)
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
         if (!ad.IsFileGroupDownloaded("PDB"))
         {
             try
             {
                 using (ManualResetEvent updateCompleted = new ManualResetEvent(false))
                 {
                     using (Unit.frmProgress)
                     {
                         TApplication.Instance.CreateForm(out Unit.frmProgress);
                         Unit.frmProgress.ControlBox          = false;
                         ad.DownloadFileGroupProgressChanged += (sender2, e2) =>
                         {
                             if (Unit.frmProgress.pbBar.InvokeRequired)
                             {
                                 Unit.frmProgress.pbBar.Invoke(new Action <int>(v => Unit.frmProgress.pbBar.Value = v), e2.ProgressPercentage);
                             }
                             else
                             {
                                 Unit.frmProgress.pbBar.Value = e2.ProgressPercentage;
                             }
                         };
                         ad.DownloadFileGroupCompleted += (sender2, e2) =>
                         {
                             updateCompleted.Set();
                             if (Unit.frmProgress.InvokeRequired)
                             {
                                 Unit.frmProgress.Invoke(new Action(Unit.frmProgress.Close));
                             }
                             else
                             {
                                 Unit.frmProgress.Close();
                             }
                         };
                         ad.DownloadFileGroupAsync("PDB");
                         Unit.frmProgress.ShowDialog();
                     }
                     updateCompleted.WaitOne();
                 }
             }
             catch (DeploymentDownloadException /*dde*/)
             {
                 /*string msg = _("Die aktuellste Version kann nicht installiert werden.") + Environment.NewLine +
                  *  _("Bitte überprüfen Sie Ihre Netzwerkverbindung oder versuchen Sie es später noch einmal.") + Environment.NewLine +
                  *  _("Fehler: ") + dde.Message;
                  * string title = _("Fehler");
                  * MessageBox.Show(msg, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
                  * return;*/
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void LoadGroupAsync(string groupName)
        {
            //Start download
            _appDeployment.DownloadFileGroupAsync(groupName, groupName);

            //Show Prgress Form
            _progressForm = new DownloadProgressForm();

            _progressForm.ShowDialog();
        }
Ejemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;
            button1.Text         = "Annuler";
            button1.Enabled      = true;

            label1.Text = string.Format("Téléchargement de {0} ...", groupName);

            completed = false;
            cancelled = false;

            ad = ApplicationDeployment.CurrentDeployment;
            ad.DownloadFileGroupProgressChanged += new DeploymentProgressChangedEventHandler(ad_DownloadFileGroupProgressChanged);
            ad.DownloadFileGroupCompleted       += new DownloadFileGroupCompletedEventHandler(ad_DownloadFileGroupCompleted);

            ad.DownloadFileGroupAsync(groupName);
        }
Ejemplo n.º 4
0
        //</SNIPPET7>

        //<SNIPPET8>
        private void DownloadFileGroupAsync(string fileGroup)
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;

                try
                {
                    if (!deployment.IsFileGroupDownloaded(fileGroup))
                    {
                        deployment.DownloadFileGroupProgressChanged += new DeploymentProgressChangedEventHandler(deployment_DownloadFileGroupProgressChanged);
                        deployment.DownloadFileGroupCompleted       += new DownloadFileGroupCompletedEventHandler(deployment_DownloadFileGroupCompleted);

                        deployment.DownloadFileGroupAsync(fileGroup);
                    }
                }
                catch (InvalidOperationException ioe)
                {
                    MessageBox.Show("This application is not a ClickOnce application. Error: " + ioe.Message);
                    return;
                }
            }
        }