mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 13:41:05 +00:00
Update MainForm.cs
This commit is contained in:
parent
d8558a4398
commit
1e82f18bc9
|
@ -12,7 +12,6 @@ namespace WelsonJS.Launcher
|
||||||
{
|
{
|
||||||
private string workingDirectory;
|
private string workingDirectory;
|
||||||
private string appName;
|
private string appName;
|
||||||
private bool waiting = false;
|
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
|
@ -66,7 +65,6 @@ namespace WelsonJS.Launcher
|
||||||
{
|
{
|
||||||
appName = Path.GetFileNameWithoutExtension(filePath);
|
appName = Path.GetFileNameWithoutExtension(filePath);
|
||||||
workingDirectory = Path.Combine(Path.GetTempPath(), appName);
|
workingDirectory = Path.Combine(Path.GetTempPath(), appName);
|
||||||
waiting = true;
|
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
@ -86,21 +84,19 @@ namespace WelsonJS.Launcher
|
||||||
|
|
||||||
// Run the appliction
|
// Run the appliction
|
||||||
RunCommandPrompt();
|
RunCommandPrompt();
|
||||||
|
|
||||||
waiting = false;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ShowMessageBox(ex.Message);
|
ShowMessageBox(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable UI
|
||||||
|
label1.Invoke((MethodInvoker)delegate {
|
||||||
|
EnableUI();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
DisableUI();
|
DisableUI();
|
||||||
while (waiting)
|
|
||||||
{
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
EnableUI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunCommandPrompt()
|
private void RunCommandPrompt()
|
||||||
|
@ -113,7 +109,7 @@ namespace WelsonJS.Launcher
|
||||||
{
|
{
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = true,
|
||||||
RedirectStandardOutput = false,
|
RedirectStandardOutput = true,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
Arguments = "/k",
|
Arguments = "/k",
|
||||||
}
|
}
|
||||||
|
@ -122,17 +118,22 @@ namespace WelsonJS.Launcher
|
||||||
|
|
||||||
process.StandardInput.WriteLine("pushd " + workingDirectory);
|
process.StandardInput.WriteLine("pushd " + workingDirectory);
|
||||||
process.StandardInput.WriteLine();
|
process.StandardInput.WriteLine();
|
||||||
|
process.StandardInput.Flush();
|
||||||
|
process.StandardOutput.ReadLine();
|
||||||
if (!isConsoleApplication)
|
if (!isConsoleApplication)
|
||||||
{
|
{
|
||||||
process.StandardInput.WriteLine("bootstrap.bat");
|
process.StandardInput.WriteLine("bootstrap.bat");
|
||||||
process.StandardInput.WriteLine();
|
process.StandardInput.WriteLine();
|
||||||
|
process.StandardInput.Flush();
|
||||||
|
process.StandardOutput.ReadLine();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
process.StandardInput.WriteLine("start cmd /c cscript app.js " + textBox1.Text);
|
process.StandardInput.WriteLine("start cmd /c cscript app.js " + textBox1.Text);
|
||||||
process.StandardInput.WriteLine();
|
process.StandardInput.WriteLine();
|
||||||
}
|
|
||||||
process.StandardInput.Flush();
|
process.StandardInput.Flush();
|
||||||
|
process.StandardOutput.ReadLine();
|
||||||
|
}
|
||||||
process.StandardInput.Close();
|
process.StandardInput.Close();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user