void itemAddFile_Click(object sender, System.Windows.RoutedEventArgs e) { InputBox dialog = new InputBox(); if ((bool)dialog.ShowDialog()) { Source file = new Source(this) { Name = dialog.Content, Path = "/" + dialog.Content + ".snl" }; System.IO.File.Create(Path + file.Path).Close(); Items.Add(file); Save(); ProjectManager.GetManager().ProjectUpdated(); } }
private FileItem ParseProject(XElement elem, Project project) { if (elem.Name == "Folder") { Folder folder = new Folder(project) { Name = elem.Attribute("Name").Value, Path = elem.Attribute("Path").Value, UUID = Guid.Parse(elem.Attribute("UUID").Value) }; foreach (var u in elem.Elements()) { folder.Items.Add(ParseProject(u, project)); } return folder; } else if (elem.Name == "File") { Source source = new Source(project) { Name = elem.Attribute("Name").Value, Path = elem.Attribute("Path").Value, UUID = Guid.Parse(elem.Attribute("UUID").Value) }; return source; } else { throw new Exception("Illegal Node"); } }
public void Close(Source file) { lstOpenedFiles.Remove(file); _UpdateOpenedFiles(); }
public void Open(Source file) { lstOpenedFiles.Add(file); _UpdateOpenedFiles(); }