src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
changeset 223 90d2be5c3d39
parent 215 d13dbcf861d7
child 225 b60e13ed75c8
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Mon Nov 23 17:14:24 2009 +0100
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Mon Nov 23 18:36:27 2009 +0100
@@ -120,10 +120,12 @@
             {
                     // We get all the ldt/project files from the current directory...
                     List<String> existingProjects = new List<String>();
-                    foreach (String filename in Directory.GetFiles("./"))
+                    String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+                    String ext = ".ldt";
+                    foreach (String filename in Directory.GetFiles(path))
                     {
-                        if (filename.Substring(filename.Length-4).ToLower()==".ldt")
-                            existingProjects.Add(filename.Substring(2, filename.Length - 6));
+                        if (filename.Substring(filename.Length-4).ToLower()==ext)
+                            existingProjects.Add(filename.Substring(path.Length + 1, filename.Length - ext.Length - path.Length - 1));
                     }
                     // ... and display them the the select box UserControlListProject
                     UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode);
@@ -155,7 +157,8 @@
                 {
                     // ((UserControlListProject)sender).SelectedItem is the name of the selected project
                     // Now we load the xml/ldt file to load all its datas (cuttings, annotations...)
-                    XDocument loadedLdt = XDocument.Load(((UserControlListProject)sender).SelectedItem + ".ldt");
+                    String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/" + ((UserControlListProject)sender).SelectedItem + ".ldt";
+                    XDocument loadedLdt = XDocument.Load(path);
                     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
                     loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value;
                     loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value;