How do I create an installation menu with check box?

Asked

Viewed 43 times

-3

I am creating an installation menu with Checkbox, in this menu will have software for installation in each Checkbox, after selecting the Checkbox, will have a button that will run all the checkbox selected. Each Checkbox will perform the installation of a software, but all selected run at once, how do I get it to do one installation at a time? My code:

if (CheckBox2.Checked)
    Process.Start(@"\Index\Menu de Instalacao\Softwares\Utilitarios\PROGRAMA1.EXE");

if (CheckBox3.Checked)
    Process.Start(@"\Index\Menu de Instalacao\Softwares\");
  • Reformulated the question and in more detail. Thank you

1 answer

0


The following method takes the path from an executable, calls the executable and waits until it closes.

public void AguardarAteEncerrar(string caminhoExecutavel)
{
    var processo = new Process
    {
        StartInfo = new ProcessStartInfo 
        {
            FileName = caminhoExecutavel
        }
    };

    processo.Start();
    processo.WaitForExit();
}

You’d wear it like this:

if (CheckBox2.Checked)
    AguardarAteEncerrar(@"\Index\Menu de Instalacao\Softwares\Utilitarios\PROGRAMA1.EXE");

Keep in mind that this will hold the thread, so avoid using it on the same thread in the GUI. I suggest you use a Backgroundworker in this case.

  • 1

    It was all I needed, very grateful Gabriel. It worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.