NClass.Core.Project.Add C# (CSharp) Method

Add() public method

/// has been already added to the project. /// /// is null. ///
public Add ( IProjectItem item ) : void
item IProjectItem
return void
		public void Add(IProjectItem item)
		{
			if (item == null)
				throw new ArgumentNullException("item");
			if (items.Contains(item))
				throw new ArgumentException("The project already contains this item.");

			item.Project = this;
			item.Modified += new EventHandler(item_Modified);
			items.Add(item);

			OnItemAdded(new ProjectItemEventArgs(item));
			OnModified(EventArgs.Empty);
		}

Usage Example

コード例 #1
0
ファイル: Project.cs プロジェクト: xiaoxiongnpu/NClass
        private static Project LoadWithPreviousFormat(XmlElement root)
        {
            Project project = new Project();

            project.loading = true;

            Assembly     assembly    = Assembly.Load("NClass.DiagramEditor");
            IProjectItem projectItem = (IProjectItem)assembly.CreateInstance(
                "NClass.DiagramEditor.ClassDiagram.Diagram", false,
                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                null, null, null, null);

            try
            {
                projectItem.Deserialize(root);
            }
            catch (Exception ex)
            {
                throw new InvalidDataException(Strings.ErrorCorruptSaveFile, ex);
            }
            project.Add(projectItem);
            project.loading    = false;
            project.isReadOnly = true;
            return(project);
        }
All Usage Examples Of NClass.Core.Project::Add