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; } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { InstallManager im = new InstallManager(); if (tbInstallParams.Text == "") { param = im.Parameters(name, path); } else { param = tbInstallParams.Text; } data.Add(new Data(name, path, param)); installGrid.ItemsSource = data; }
// 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(); } }