Пример #1
0
 private void btnInstallList_Click(object sender, RoutedEventArgs e)
 {
     if (downloadsGrid.SelectedItems.Count > 0)
     {
         progressBar1.IsIndeterminate = true;
         progressBar1.Visibility      = Visibility.Visible;
         try
         {
             var            selectedInstall = downloadsGrid.SelectedItems.Cast <WebDownloadClient>();
             var            installing      = (WebDownloadClient)downloadsGrid.SelectedItem;
             InstallManager im = new InstallManager();
             foreach (WebDownloadClient install in selectedInstall)
             {
                 string n1 = null;
                 string n2 = null;
                 string n3 = null;
                 n1 = install.DownloadPath;
                 n2 = im.Parameters(n1, n3);
                 im.Installation(n1, n2);
             }
         }
         catch (Exception ss)
         {
             string           message = ss.ToString();
             MessageBoxResult result  = Xceed.Wpf.Toolkit.MessageBox.Show(message, "SecretService");
         }
         progressBar1.IsIndeterminate = false;
         progressBar1.Visibility      = Visibility.Hidden;
     }
 }
Пример #2
0
        // DownloadCompleted event handler
        public void DownloadCompletedHandler(object sender, EventArgs e)
        {
            if (!this.HasError)
            {
                // If the file already exists, delete it
                if (File.Exists(this.DownloadPath))
                {
                    File.Delete(this.DownloadPath);
                }

                // Convert the temporary (.tmp) file to the actual (requested) file
                if (File.Exists(this.TempDownloadPath))
                {
                    File.Move(this.TempDownloadPath, this.DownloadPath);
                }

                this.Status = DownloadStatus.Completed;
                UpdateDownloadDisplay();

                if (this.OpenFileOnCompletion && File.Exists(this.DownloadPath))
                {
                    Application.Current.Dispatcher.Invoke((Action) delegate {
                        InstallManager im = new InstallManager();
                        string n1         = null;
                        string n2         = null;
                        string n3         = null;
                        n1 = DownloadPath;
                        if (execpath != null)
                        {
                            n3 = @execpath;
                        }

                        n2 = im.Parameters(n1, n3);
                        im.Installation(n1, n2);
                    });
                }
            }
            else
            {
                this.Status = DownloadStatus.Error;
                UpdateDownloadDisplay();
            }
        }
Пример #3
0
 private void btnInstall_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         progressBar1.IsIndeterminate = true;
         progressBar1.Visibility      = Visibility.Visible;
         InstallManager im = new InstallManager();
         for (int datas = 0; datas < data.Count; datas++)
         {
             string n1 = null;
             string n2 = null;
             n1 = data[datas].Name;
             n2 = data[datas].Param;
             im.Installation(n1, n2);
         }
         progressBar1.IsIndeterminate = false;
         progressBar1.Visibility      = Visibility.Hidden;
     }
     catch (Exception ss)
     {
         string           message = ss.ToString();
         MessageBoxResult result  = Xceed.Wpf.Toolkit.MessageBox.Show(message, "SecretService");
     }
 }