我正在根据功能事件编写自动安装程序,例如:
- 易于编码的自动安装程序,(但在所有程序上都付出了巨大的努力)。
现在我遇到了一个问题,程序运行时如何执行 sendkeys 等process.waitforexit()
?
try
{
foreach (string checkedItem in checkedListBox1.CheckedItems)
{
if (checkedItem.Contains("."))
{
string str = checkedItem;
if (str.Contains("."))
{
/* haal de rest achter de . eraf om een map ervan te maken. */
int index = str.IndexOf('.');
string folder = str.Substring(0, index);
string pad = Application.StartupPath;
try
{
/* Start de programma. */
bool started = false;
var process = new Process();
process.StartInfo.FileName = pad + "/data/" + folder + "/" + checkedItem;
started = process.Start();
/* Haal de informatie op van de programma's die opgestart worden. */
var processID = process.Id;
var processNAAM = process.ProcessName;
textBox1.Text += "Gevonden - ID: " + processID + " NAAM: " + processNAAM + Environment.NewLine;
textBox1.Text += DateTime.Now.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo) + " - " + "Installatie Keuze wordt opgestart." + Environment.NewLine;
/* Wacht totdat het programma klaar is! */
process.WaitForExit();
textBox1.Text += DateTime.Now.ToString("HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo) + " - " + "Installatie Geslaagd!" + Environment.NewLine + Environment.NewLine;
}
如果有人能够在这里帮助我,将不胜感激:D