void OpenEvent(object sender, EventArgs e) { if (!btn_new.Sensitive) { return; } btn_new.Sensitive = false; if (notebook.Page == 0) { if (!CreateProject()) { return; } Solution parentSolution = null; if (parentFolder == null) { WorkspaceItem item = (WorkspaceItem)newItem; parentSolution = item as Solution; if (parentSolution != null) { if (parentSolution.RootFolder.Items.Count > 0) { currentEntry = parentSolution.RootFolder.Items [0] as SolutionItem; } parentFolder = parentSolution.RootFolder; } } else { SolutionItem item = (SolutionItem)newItem; parentSolution = parentFolder.ParentSolution; currentEntry = item; } if (btn_new.Label == Gtk.Stock.GoForward) { // There are features to show. Go to the next page if (currentEntry != null) { try { featureList.Fill(parentFolder, currentEntry, SolutionItemFeatures.GetFeatures(parentFolder, currentEntry)); } catch (Exception ex) { LoggingService.LogError(ex.ToString()); } } notebook.Page++; btn_new.Sensitive = true; btn_new.Label = Gtk.Stock.Ok; return; } } else { // Already in fetatures page if (!featureList.Validate()) { return; } } // New combines (not added to parent combines) already have the project as child. if (!newSolution) { // Make sure the new item is saved before adding. In this way the // version control add-in will be able to put it under version control. if (currentEntry is SolutionEntityItem) { // Inherit the file format from the solution SolutionEntityItem eitem = (SolutionEntityItem)currentEntry; eitem.FileFormat = parentFolder.ParentSolution.FileFormat; IdeApp.ProjectOperations.Save(eitem); } parentFolder.AddItem(currentEntry, true); } if (notebook.Page == 1) { featureList.ApplyFeatures(); } if (parentFolder != null) { IdeApp.ProjectOperations.Save(parentFolder.ParentSolution); } else { IdeApp.ProjectOperations.Save(newItem); } if (openSolution) { var op = selectedItem.OpenCreatedSolution(); op.Completed += delegate { if (op.Success) { var sol = IdeApp.Workspace.GetAllSolutions().FirstOrDefault(); if (sol != null) { InstallProjectTemplatePackages(sol); } } }; } else { // The item is not a solution being opened, so it is going to be added to // an existing item. In this case, it must not be disposed by the dialog. disposeNewItem = false; if (parentFolder != null) { InstallProjectTemplatePackages(parentFolder.ParentSolution); } } Respond(ResponseType.Ok); }
void OpenEvent(object sender, EventArgs e) { if (!btn_new.Sensitive) { return; } if (notebook.Page == 0) { if (!CreateProject()) { return; } Solution parentSolution = null; if (parentFolder == null) { WorkspaceItem item = (WorkspaceItem)newItem; parentSolution = item as Solution; if (parentSolution != null) { if (parentSolution.RootFolder.Items.Count > 0) { currentEntry = parentSolution.RootFolder.Items [0] as SolutionItem; } parentFolder = parentSolution.RootFolder; } } else { SolutionItem item = (SolutionItem)newItem; parentSolution = parentFolder.ParentSolution; currentEntry = item; } if (btn_new.Label == Gtk.Stock.GoForward) { // There are features to show. Go to the next page if (currentEntry != null) { try { featureList.Fill(parentFolder, currentEntry, SolutionItemFeatures.GetFeatures(parentFolder, currentEntry)); } catch (Exception ex) { LoggingService.LogError(ex.ToString()); } } notebook.Page++; btn_new.Label = Gtk.Stock.Ok; return; } } else { // Already in fetatures page if (!featureList.Validate()) { return; } } // New combines (not added to parent combines) already have the project as child. if (!newSolution) { // Make sure the new item is saved before adding. In this way the // version control add-in will be able to put it under version control. if (currentEntry is SolutionEntityItem) { // Inherit the file format from the solution SolutionEntityItem eitem = (SolutionEntityItem)currentEntry; eitem.FileFormat = parentFolder.ParentSolution.FileFormat; IdeApp.ProjectOperations.Save(eitem); } parentFolder.AddItem(currentEntry, true); } if (notebook.Page == 1) { featureList.ApplyFeatures(); } if (parentFolder != null) { IdeApp.ProjectOperations.Save(parentFolder.ParentSolution); } else { IdeApp.ProjectOperations.Save(newItem); } if (openSolution) { selectedItem.OpenCreatedSolution(); } Respond(ResponseType.Ok); }
public FeatureSelectorDialog(SolutionFolder parentCombine, SolutionItem entry) { this.Build(); featureList.Fill(parentCombine, entry, SolutionItemFeatures.GetFeatures(parentCombine, entry)); }