internal static bool OpenExistingProject(ProjectId projectId, FwApp app, Form wndCopyFrom)
{
if (projectId == null)
throw new ArgumentNullException("projectId");
if (app != s_flexApp && app != s_teApp)
throw new ArgumentException("Invalid application", "app");
if (projectId.Equals(s_projectId))
{
// We're trying to open this same project. Just open a new window for the
// specified application
return CreateAndInitNewMainWindow(app, false, wndCopyFrom, false);
}
string sAppAbbrev = GetCommandLineAbbrevForAppName(app.ApplicationName);
if (TryFindExistingProcess(projectId, new FwAppArgs(sAppAbbrev, projectId.Handle,
projectId.ServerName, null, Guid.Empty)))
{
Logger.WriteEvent("Found existing FieldWorks.exe for project " + projectId.UiName + ". BEP:" + projectId.Type);
return true; // Found another process for this project, so we're done.
}
return OpenProjectWithNewProcess(projectId, sAppAbbrev) != null;
}