public partial class Balloon : Form
{
public Balloon()
{
InitializeComponent();
TopMost = true;
Rectangle r = Screen.PrimaryScreen.WorkingArea;
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width - 1, Screen.PrimaryScreen.WorkingArea.Height - this.Height - 8);
InstallStart2();
}
private async void InstallStart2()
{
if (Dot35 == "Yes")
{
this.Titel.Text = "The Knowhow Installer is installing:";
this.Action.Text = "Microsoft .Net Framework 2 & 3";
if (File.Exists(root + Installfolder + "dotnetfx35.exe"))
{
Process process = Process.Start(root + Installfolder + "dotnetfx35.exe", "/q /norestart");
while (!process.HasExited) ;
bool installFinished1 = false;
int k = -1;
string[] dots = new string[] { "Microsoft .Net Framework 2 & 3.", "Microsoft .Net Framework 2 & 3..", "Microsoft .Net Framework 2 & 3..." };
while (!installFinished1)
{
Action.Text = dots[++k % 3];
await Task.Delay(TimeSpan.FromSeconds(1.0));
}
process.WaitForExit();
}
else
{
this.TopMost = false;
int num = (int)MessageBox.Show("dotnetfx35.exe not found", "Error");
}
}
await Task.Delay(TimeSpan.FromSeconds(2.0));
if (Dot45 == "Yes")
{
this.Titel.Text = "The Knowhow Installer is installing:";
this.Action.Text = "Microsoft .Net Framework 4.5";
if (File.Exists(root + Installfolder + "dotnetFx45.exe"))
{
Process process = Process.Start(root + Installfolder + "dotnetFX45.exe", "/q");
bool installFinished = false;
int k = -1;
string[] dots = new string[] { "Microsoft .Net Framework 4.5.", "Microsoft .Net Framework 4.5..", "Microsoft .Net Framework 4.5..." };
while (!installFinished)
{
Action.Text = dots[++k % 3];
await Task.Delay(TimeSpan.FromSeconds(1.0));
}
while (!process.HasExited) ;
}
else
{
this.TopMost = false;
int num = (int)MessageBox.Show("dotnetFx45.exe not found", "Error");
}
}
await Task.Delay(TimeSpan.FromSeconds(2.0));
this.Action.Text = "Done";
new SoundPlayer(root + otherfolder + "Done.wav").Play();
await Task.Delay(TimeSpan.FromSeconds(5.0));
Environment.CurrentDirectory = dir;
this.Close();
new InstallDone().Show();
}
}
Это часть кода, и она работает для первой установки, но я не могу найти, куда положить bool installFinished1 = true;
, чтобы перейти к следующему. Теперь он просто остается в Microsoft .Net Framework 4.5 ... (это переход от 1 до 3 точек в цикле)Ярлык Изменение в петле
Что происходит, когда вы используете код, который вы размещены здесь? –
Укажите тип вашего приложения (консоль, winforms, mvc и т. Д.) – Paul
Установка dotnet из приложения dotnet? Если вы используете установщик clickonce, вы можете добавить это как необходимое условие. –