Пример #1
0
		public ProjectDocumentItem(ProjectDocument project)
			: base(project.FileName, null)
		{
			mProject = project;
			mFileName = project.FileName;
		}
Пример #2
0
		public ProjectDocument LoadProjectDocument(string fileName, Type projType, ProjectDocument parentDoc)
		{
			try
			{
				++mLoading;
				ProjectDocument doc = (ProjectDocument)Manager.OpenDocument(fileName, projType, new object[] { this } );
				ProjectItem parentItem = (parentDoc == null) ? (ProjectItem) this.RootItem : (ProjectItem) parentDoc.Root;
				if (doc == null)
					parentItem.Items.Add(new ProjectDocumentItem(fileName));
				else
					AddProjectDocument(doc, parentDoc, parentItem);
				return doc;
			}
			finally
			{
				--mLoading;
			}
		}
Пример #3
0
		private void AddProjectDocument(ProjectDocument doc, ProjectDocument parentDoc, ProjectItem parentItem)
		{
			doc.PropertyChange += new PropertyChangeEventHandler(ProjectDocument_PropertyChange);
			doc.Loading += new DocumentLoadingEventHandler(ProjectDocument_Loading);
			doc.Loaded += new DocumentLoadedEventHandler(ProjectDocument_Loaded);
			if (parentDoc == null)
				mRootDocument = doc;
			else
				parentDoc.Imports.Add(doc);
			parentItem.Items.Add(doc.Root);
		}
Пример #4
0
		public ProjectDocument NewProjectDocument(string fileName, Type projType, ProjectDocument parentDoc)
		{
			System.Diagnostics.Debug.Assert(parentDoc != null || mRootDocument == null, "A Project can have only one root document!");

			if (!Path.IsPathRooted(fileName))
				fileName = Path.Combine(Environment.CurrentDirectory, fileName);

			ProjectDocument doc = (ProjectDocument)Manager.CreateDocument(fileName, projType, null, new object[] { this });
			ProjectItem parentItem = (parentDoc == null) ? (ProjectItem) this.RootItem : (ProjectItem) parentDoc.Root;
			AddProjectDocument(doc, parentDoc, parentItem);
			return doc;
		}