Room Designer:
* New Project added. Mud HUB: * Moved ExecuteApp method from frmMain.cs to Program.cs
This commit is contained in:
parent
03340af1ff
commit
2a8c023aca
15 changed files with 728 additions and 60 deletions
|
@ -7,6 +7,7 @@ namespace MudDesigner
|
|||
{
|
||||
static class Program
|
||||
{
|
||||
static frmMain MudHUB;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
|
@ -15,7 +16,63 @@ namespace MudDesigner
|
|||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new frmMain());
|
||||
MudHUB = new frmMain();
|
||||
Application.Run(MudHUB);
|
||||
}
|
||||
|
||||
internal static void ExecuteApp(string appName)
|
||||
{
|
||||
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
||||
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
|
||||
|
||||
//If running in debug mode we need to hard-code the paths as during normal running of the apps
|
||||
//all of the apps are running within the Apps directory.
|
||||
#if DEBUG
|
||||
string[] apps = System.IO.Directory.GetFiles(@"C:\CodePlex\MudDesigner\", "*.exe", System.IO.SearchOption.AllDirectories);
|
||||
List<string> legalApps = new List<string>();
|
||||
|
||||
foreach (string app in apps)
|
||||
{
|
||||
if ((!app.EndsWith(".vshost.exe"))
|
||||
&& (!app.EndsWith(".vshost.exe.manifest"))
|
||||
&& System.IO.Directory.GetParent(app).Name == "Debug"
|
||||
&& System.IO.Directory.GetParent(app).Parent.Name == "bin")
|
||||
{
|
||||
legalApps.Add(app);
|
||||
}
|
||||
}
|
||||
string filename = "";
|
||||
foreach (string app in legalApps)
|
||||
{
|
||||
if (System.IO.Path.GetFileName(app).ToLower() == appName.ToLower())
|
||||
{
|
||||
filename = app;
|
||||
break;
|
||||
}
|
||||
}
|
||||
info.FileName = filename;
|
||||
#else
|
||||
info.FileName = appName;
|
||||
#endif
|
||||
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
||||
info.WorkingDirectory = Application.StartupPath;
|
||||
|
||||
process.StartInfo = info;
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
MudHUB.Hide();
|
||||
process.WaitForExit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("ERROR:\n" + ex.Message, "Editor HUB", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
process = null;
|
||||
MudHUB.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue