Bonjour à tous.

Je viens solliciter votre aide Je développe actuellement une application (en C#, et WPF) qui est en fait un "installeur" pour un bouquet d'applications. L'idée étant que lorsque plusieurs applications sont sélectionnées, les installations peuvent prendre un certain temps. Pour cela j'avais dans l'idée de fermer (ou désactiver) ma MainWindow, pour laisser place à une autre form contenant 2 progressbars : l'installation en cours, et l'avancement total.

Et je n'arrive pas du tout à y parvenir ...

Ceci est ce qui se produit lorsque l'on appuie sur le bouton "installer". Ca fonctionne, l'application s'installe correctement.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
        BackgroundWorker backgroundWorker1 = new BackgroundWorker();
 
        private void btn_install_Click(object sender, RoutedEventArgs e)
        {
            backgroundWorker1.DoWork += backgroundWorker1_DoWork;
            backgroundWorker1.ProgressChanged += backgroundWorker1_ProgressChanged;
            backgroundWorker1.WorkerReportsProgress = true;
            backgroundWorker1.WorkerSupportsCancellation = false;
 
            backgroundWorker1.RunWorkerAsync();
            backgroundWorker1.RunWorkerCompleted += backgroundworker1_Completed;
        }
 
        private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            foreach (string p in lv_selection.Items)
            {
                Process scriptProc = new Process();
 
                scriptProc.StartInfo.FileName = @"C:\Windows\System32\wscript.exe";
                scriptProc.StartInfo.WorkingDirectory = repository + p + "\\";
                scriptProc.StartInfo.Arguments = repository + p + "\\" + "install_silent.vbs";
                scriptProc.StartInfo.Verb = "runas";
                scriptProc.Start();
                scriptProc.WaitForExit();
                scriptProc.Close();
            }
        }
 
        private void backgroundWorker1_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
        {
            //progressForm.progress1.Value = e.ProgressPercentage;
        }
 
        private void backgroundworker1_Completed(object sender, RunWorkerCompletedEventArgs e)
        {
            MainWindow main = new MainWindow();
            if (!(e.Error == null))
            {
                Console.WriteLine("Error");
                main.IsEnabled = true;
            }
            else
            {
                Console.WriteLine("Terminé");
                main.IsEnabled = true;
            }
 
        }
Ma seconde form j'arrive bien à l'afficher, mais pas à travailler sur les progressbars ...

Une aide, explication, ou démonstration serai la bienvenue

Merci beaucoup par avance.