本文整理汇总了C#中SolutionFolder.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# SolutionFolder.AddItem方法的具体用法?C# SolutionFolder.AddItem怎么用?C# SolutionFolder.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolutionFolder
的用法示例。
在下文中一共展示了SolutionFolder.AddItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckProjectContainsItself
public void CheckProjectContainsItself()
{
var folder = new SolutionFolder ();
var project = new DotNetAssemblyProject { Name = "foo" };
folder.AddItem (project);
Assert.IsNotNull (folder.GetProjectContainingFile (project.FileName), "#1");
}
示例2: AddSolutionItem
public SolutionItem AddSolutionItem (SolutionFolder folder, string entryFileName)
{
AddEntryEventArgs args = new AddEntryEventArgs (folder, entryFileName);
if (AddingEntryToCombine != null)
AddingEntryToCombine (this, args);
if (args.Cancel)
return null;
using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) {
return folder.AddItem (monitor, args.FileName, true);
}
}
示例3: AddFilesToSolutionFolder
public bool AddFilesToSolutionFolder (SolutionFolder folder, string[] files)
{
QuestionMessage msg = new QuestionMessage ();
AlertButton keepButton = new AlertButton (GettextCatalog.GetString ("Keep file path"));
msg.Buttons.Add (keepButton);
msg.Buttons.Add (AlertButton.Copy);
msg.Buttons.Add (AlertButton.Move);
msg.Buttons.Add (AlertButton.Cancel);
msg.AllowApplyToAll = true;
bool someAdded = false;
foreach (string file in files) {
FilePath fp = file;
FilePath dest = folder.BaseDirectory.Combine (fp.FileName);
if (folder.IsRoot) {
// Don't allow adding files to the root folder. VS doesn't allow it
// If there is no existing folder, create one
var itemsFolder = (SolutionFolder) folder.Items.Where (item => item.Name == "Solution Items").FirstOrDefault ();
if (itemsFolder == null) {
itemsFolder = new SolutionFolder ();
itemsFolder.Name = "Solution Items";
folder.AddItem (itemsFolder);
}
folder = itemsFolder;
}
if (!fp.IsChildPathOf (folder.BaseDirectory)) {
msg.Text = GettextCatalog.GetString ("The file {0} is outside the folder directory. What do you want to do?", fp.FileName);
AlertButton res = MessageService.AskQuestion (msg);
if (res == AlertButton.Cancel)
return someAdded;
if (res == AlertButton.Copy) {
FileService.CopyFile (file, dest);
fp = dest;
} else if (res == AlertButton.Move) {
FileService.MoveFile (file, dest);
fp = dest;
}
}
folder.Files.Add (fp);
someAdded = true;
}
return someAdded;
}
示例4: CreateProject
void CreateProject(Solution solution, SolutionFolder srcFolder, bool newSolution = true)
{
string projectName = Parameters["UserDefinedProjectName"];
DnxProject project = CreateProject (solution, projectName);
srcFolder.AddItem (project);
project.AddConfigurations ();
if (newSolution) {
solution.GenerateDefaultDnxProjectConfigurations (project);
solution.StartupItem = project;
} else {
solution.EnsureConfigurationHasBuildEnabled (project);
}
project.CreateProjectDirectory ();
if (Parameters.GetBoolean ("CreateWebRoot")) {
project.CreateWebRootDirectory ();
}
RemoveProjectDirectoryCreatedByNewProjectDialog (solution.BaseDirectory, projectName);
CreateFilesFromTemplate (project);
solution.Save (new NullProgressMonitor ());
OpenProjectFile (project);
DnxServices.ProjectService.LoadAspNetProjectSystem (solution);
}
示例5: SolutionBoundUnbound
public void SolutionBoundUnbound()
{
Solution sol = new Solution ();
var e = new SomeItem ();
Assert.AreEqual (0, e.BoundEvents);
Assert.AreEqual (0, e.UnboundEvents);
sol.RootFolder.AddItem (e);
Assert.AreEqual (1, e.BoundEvents);
Assert.AreEqual (0, e.UnboundEvents);
Assert.AreEqual (1, e.InternalItem.BoundEvents);
Assert.AreEqual (0, e.InternalItem.UnboundEvents);
e.Reset ();
sol.RootFolder.Items.Remove (e);
Assert.AreEqual (0, e.BoundEvents);
Assert.AreEqual (1, e.UnboundEvents);
Assert.AreEqual (0, e.InternalItem.BoundEvents);
Assert.AreEqual (1, e.InternalItem.UnboundEvents);
e.Reset ();
sol.RootFolder.AddItem (e);
Assert.AreEqual (1, e.BoundEvents);
Assert.AreEqual (0, e.UnboundEvents);
Assert.AreEqual (1, e.InternalItem.BoundEvents);
Assert.AreEqual (0, e.InternalItem.UnboundEvents);
e.Reset ();
sol.RootFolder.Items.Remove (e);
Assert.AreEqual (0, e.BoundEvents);
Assert.AreEqual (1, e.UnboundEvents);
Assert.AreEqual (0, e.InternalItem.BoundEvents);
Assert.AreEqual (1, e.InternalItem.UnboundEvents);
e.Reset ();
var f = new SolutionFolder ();
f.AddItem (e);
Assert.AreEqual (0, e.BoundEvents);
Assert.AreEqual (0, e.UnboundEvents);
Assert.AreEqual (0, e.InternalItem.BoundEvents);
Assert.AreEqual (0, e.InternalItem.UnboundEvents);
sol.RootFolder.AddItem (f);
Assert.AreEqual (1, e.BoundEvents);
Assert.AreEqual (0, e.UnboundEvents);
Assert.AreEqual (1, e.InternalItem.BoundEvents);
Assert.AreEqual (0, e.InternalItem.UnboundEvents);
e.Reset ();
sol.RootFolder.Items.Remove (f);
Assert.AreEqual (0, e.BoundEvents);
Assert.AreEqual (1, e.UnboundEvents);
Assert.AreEqual (0, e.InternalItem.BoundEvents);
Assert.AreEqual (1, e.InternalItem.UnboundEvents);
f.Dispose ();
sol.Dispose ();
}