bool CheckWebProjectStartInfo() { if (WebProject.HasWebProjectProperties() && WebProject.GetWebProjectProperties().IsConfigured()) { return(true); } return(false); }
bool CheckWebProjectStartInfo() { if (WebProject.HasWebProjectProperties() && WebProject.GetWebProjectProperties().IsConfigured()) { return(true); } MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}"); return(false); }
void CreateWebProject(MSBuildBasedProject project) { webProject = new WebProject(project); properties = webProject.GetWebProjectProperties(); }
public override void Start(bool withDebugging) { try { WebProjectProperties properties = WebProject.GetWebProjectProperties(); if (CheckWebProjectStartInfo()) { AttachToWebWorkerProcessOrStartIISExpress(properties, withDebugging); } // start default application(e.g. browser) or the one specified switch (CompilableProject.StartAction) { case StartAction.Project: if (FileUtility.IsUrl(properties.IISUrl)) { Process.Start(properties.IISUrl); } else { MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}"); DisposeProcessMonitor(); } break; case StartAction.Program: ProcessStartInfo processInfo = DotNetStartBehavior.CreateStartInfo(StartProgram, Project.Directory, StartWorkingDirectory, StartArguments); if (withDebugging) { DebuggerService.CurrentDebugger.Start(processInfo); } else { Process.Start(processInfo); } break; case StartAction.StartURL: if (FileUtility.IsUrl(StartUrl)) { Process.Start(StartUrl); } else { string url = string.Concat(properties.IISUrl, StartUrl); if (FileUtility.IsUrl(url)) { Process.Start(url); } else { MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}"); DisposeProcessMonitor(); return; } } break; default: throw new Exception("Invalid value for StartAction"); } } catch (Exception ex) { MessageService.ShowError(ex.Message); LoggingService.Error(ex.ToString()); DisposeProcessMonitor(); } }
public override void Start(bool withDebugging) { if (!CheckWebProjectStartInfo()) { return; } try { WebProjectProperties properties = WebProject.GetWebProjectProperties(); string processName = WebProjectService.GetWorkerProcessName(properties); // try find the worker process directly or using the process monitor callback Process[] processes = System.Diagnostics.Process.GetProcesses(); int index = processes.FindIndex(p => p.ProcessName.Equals(processName, StringComparison.OrdinalIgnoreCase)); if (index > -1) { if (withDebugging) { DebuggerService.CurrentDebugger.Attach(processes[index]); } } else { if (properties.UseIISExpress) { // start IIS express and attach to it if (WebProjectService.IsIISExpressInstalled) { ProcessStartInfo processInfo = IISExpressProcessStartInfo.Create(WebProject); DebuggerService.CurrentDebugger.Start(processInfo); } else { DisposeProcessMonitor(); MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}"); return; } } else { DisposeProcessMonitor(); this.monitor = new ProcessMonitor(processName); this.monitor.ProcessCreated += delegate { WorkbenchSingleton.SafeThreadCall((Action)(() => OnProcessCreated(properties, withDebugging))); }; this.monitor.Start(); } } // start default application(e.g. browser) or the one specified switch (CompilableProject.StartAction) { case StartAction.Project: if (FileUtility.IsUrl(properties.IISUrl)) { Process.Start(properties.IISUrl); } else { MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}"); DisposeProcessMonitor(); } break; case StartAction.Program: Process.Start(StartProgram); break; case StartAction.StartURL: if (FileUtility.IsUrl(StartUrl)) { Process.Start(StartUrl); } else { string url = string.Concat(properties.IISUrl, StartUrl); if (FileUtility.IsUrl(url)) { Process.Start(url); } else { MessageService.ShowError("${res:ICSharpCode.WebProjectOptionsPanel.NoProjectUrlOrProgramAction}"); DisposeProcessMonitor(); return; } } break; default: throw new Exception("Invalid value for StartAction"); } } catch (Exception ex) { MessageService.ShowError(ex.Message); LoggingService.Error(ex.ToString()); DisposeProcessMonitor(); } }