本文整理汇总了C#中System.Windows.Forms.Document.CreateNode方法的典型用法代码示例。如果您正苦于以下问题:C# Document.CreateNode方法的具体用法?C# Document.CreateNode怎么用?C# Document.CreateNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.CreateNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnOK_Click
private void btnOK_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtSaveDir.Text) &&
!string.IsNullOrEmpty(this.txtProjectName.Text))
{
string selectDir = this.txtSaveDir.Text.Trim();
string projectName = this.txtProjectName.Text.Trim();
string path = System.IO.Path.Combine(selectDir, this.txtProjectName.Text.Trim());
System.IO.Directory.CreateDirectory(path);
DBGlobalService.ProjectFile = System.IO.Path.Combine(path, projectName+".xml");
//doc.SetSchemaLocation(GlobalService.ConfigXsd);
if (!System.IO.File.Exists(DBGlobalService.ProjectFile))
{
var stream = System.IO.File.Create(DBGlobalService.ProjectFile);
stream.Close();
}
var doc = new Document();
DBGlobalService.CurrentProjectDoc = doc;
//doc.Load(GlobalService.ProjectFile);
var prj = doc.CreateNode<ProjectType>();
doc.Root = prj;
DBGlobalService.CurrentProject = prj;
DBGlobalService.CurrentProject.Name = projectName ;
doc.Save(DBGlobalService.ProjectFile);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
}
示例2: LoadDB
private void LoadDB()
{
string selectDir = GlobalService.CurrentPrj_Dir;
string projectName = GlobalService.CurrentPrj_Name;
string path = System.IO.Path.Combine(selectDir, "");
DBGlobalService.ProjectFile = System.IO.Path.Combine(path, projectName + ".xml");
var doc = new Document();
ProjectType prj = null;
if (!System.IO.File.Exists(DBGlobalService.ProjectFile))
{
var stream = System.IO.File.Create(DBGlobalService.ProjectFile);
stream.Close();
prj = doc.CreateNode<ProjectType>();
}
else
{
doc.Load(DBGlobalService.ProjectFile);
prj = new ProjectType(doc);
}
DBGlobalService.CurrentProjectDoc = doc;
DBGlobalService.CurrentProject = prj;
DBGlobalService.CurrentProject.Name = projectName;
doc.Save(DBGlobalService.ProjectFile);
this.CreateDBTree();
}