equal
deleted
inserted
replaced
118 { |
118 { |
119 try |
119 try |
120 { |
120 { |
121 // We get all the ldt/project files from the current directory... |
121 // We get all the ldt/project files from the current directory... |
122 List<String> existingProjects = new List<String>(); |
122 List<String> existingProjects = new List<String>(); |
123 foreach (String filename in Directory.GetFiles("./")) |
123 String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); |
|
124 String ext = ".ldt"; |
|
125 foreach (String filename in Directory.GetFiles(path)) |
124 { |
126 { |
125 if (filename.Substring(filename.Length-4).ToLower()==".ldt") |
127 if (filename.Substring(filename.Length-4).ToLower()==ext) |
126 existingProjects.Add(filename.Substring(2, filename.Length - 6)); |
128 existingProjects.Add(filename.Substring(path.Length + 1, filename.Length - ext.Length - path.Length - 1)); |
127 } |
129 } |
128 // ... and display them the the select box UserControlListProject |
130 // ... and display them the the select box UserControlListProject |
129 UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode); |
131 UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode); |
130 listProject.Name = "ListProject"; |
132 listProject.Name = "ListProject"; |
131 LayoutRoot.Children.Add(listProject); |
133 LayoutRoot.Children.Add(listProject); |
153 } |
155 } |
154 else |
156 else |
155 { |
157 { |
156 // ((UserControlListProject)sender).SelectedItem is the name of the selected project |
158 // ((UserControlListProject)sender).SelectedItem is the name of the selected project |
157 // Now we load the xml/ldt file to load all its datas (cuttings, annotations...) |
159 // Now we load the xml/ldt file to load all its datas (cuttings, annotations...) |
158 XDocument loadedLdt = XDocument.Load(((UserControlListProject)sender).SelectedItem + ".ldt"); |
160 String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/" + ((UserControlListProject)sender).SelectedItem + ".ldt"; |
|
161 XDocument loadedLdt = XDocument.Load(path); |
159 Project loadedProject = new Project(videoName, _mainViewModel.Project.VideoPath); // we use this video in the case an other panel was in search mode before annotation mode |
162 Project loadedProject = new Project(videoName, _mainViewModel.Project.VideoPath); // we use this video in the case an other panel was in search mode before annotation mode |
160 loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value; |
163 loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value; |
161 loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value; |
164 loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value; |
162 loadedProject.Cuttings = new List<Cutting>(); |
165 loadedProject.Cuttings = new List<Cutting>(); |
163 XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content"); |
166 XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content"); |