Example #1
0
 private Project CreateProject(IProjectFactory factory, object creationArgs)
 {
     Project project = null;
     if (factory.IsSingleInstance)
     {
         foreach (Project project2 in this._openProjects)
         {
             if (project2.ProjectFactory == factory)
             {
                 project = project2;
                 break;
             }
         }
     }
     if (project == null)
     {
         try
         {
             project = factory.CreateProject(creationArgs);
         }
         catch (Exception exception)
         {
             IMxUIService service = (IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService));
             if (service != null)
             {
                 service.ReportError(exception.Message, "Unable to create a new " + factory.Name + " workspace.", false);
             }
         }
         if (project == null)
         {
             return project;
         }
         this._openProjects.Add(project);
         if ((this._myComputerProject == null) && (factory.GetType() == this._myComputerFactoryType))
         {
             this._myComputerProject = project;
         }
         try
         {
             ProjectEventArgs e = new ProjectEventArgs(project);
             this.OnProjectAdded(e);
         }
         catch (Exception)
         {
         }
     }
     return project;
 }