当前位置: 首页>>代码示例>>C#>>正文


C# SolutionFolder.AddItem方法代码示例

本文整理汇总了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");
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:8,代码来源:SolutionFolderTests.cs

示例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);
			}
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:11,代码来源:ProjectOperations.cs

示例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;
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:46,代码来源:ProjectOperations.cs

示例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);
        }
开发者ID:lordfinal,项目名称:monodevelop-dnx-addin,代码行数:31,代码来源:DnxProjectTemplateWizard.cs

示例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 ();
        }
开发者ID:brantwedel,项目名称:monodevelop,代码行数:59,代码来源:SolutionTests.cs


注:本文中的SolutionFolder.AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。