diff -r 6405d0b7d085 -r 0699cab5cbb3 src/FingersDance.Control.Screen/UserControlScreen.xaml.cs --- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Tue Nov 17 13:40:58 2009 +0100 +++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Wed Nov 18 13:06:55 2009 +0100 @@ -22,6 +22,7 @@ public int id = 0; public event EventHandler UC_Screen_NewCutting; private MainViewModel _mainViewModel; + private String AnnotationOrSearchMode; public Cutting Cutting; private String videoName; @@ -65,20 +66,21 @@ { try { LayoutRoot.Children.Add(uie); } catch(Exception){} - } + } } private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) { try { - //1 renseigner la video choisie au screen et créer un nouveau projet à partir de ce chemin vidéo + // 1- renseigner la video choisie au screen et créer un nouveau projet à partir de ce chemin vidéo videoName = ((UserControlListVideo)sender).VideoName; videoPath = ((UserControlListVideo)sender).path; - _mainViewModel.CreateProject(videoName, videoPath); - //2-Supression du UC List Video + // 2-Supression du UC List Video LayoutRoot.Children.Remove((UserControlListVideo)sender); - OpenProjectList(); + // 3 - Choose between Annotation Or Search Mode + GetAnnotationOrSearchMode(); + //OpenProjectList(); } catch (Exception ex) { @@ -88,22 +90,41 @@ } } + private void GetAnnotationOrSearchMode() + { + UserControlAnnotationOrSearch AnnotOrSearch = new UserControlAnnotationOrSearch(); + AnnotOrSearch.ModeChosen += new EventHandler(AnnotOrSearch_ModeChosen); + this.AddToGrid(AnnotOrSearch); + } + + void AnnotOrSearch_ModeChosen(object sender, AnnotationOrSearchEventArg e) + { + // We remove the UserControlAnnotationOrSearch + LayoutRoot.Children.Remove((UserControlAnnotationOrSearch)sender); + // We show the project list and send the chosen mode + AnnotationOrSearchMode = e.ChosenMode; + OpenProjectList(); + } + private void OpenProjectList() { try { - // We get all the ldt/project files from the current directory... - List existingProjects = new List(); - foreach (String filename in Directory.GetFiles("./")) - { - if (filename.Substring(filename.Length-4).ToLower()==".ldt") - existingProjects.Add(filename.Substring(2, filename.Length - 6)); - } - // ... and display them the the select box UserControlListProject - UserControlListProject listProject = new UserControlListProject(existingProjects); - listProject.Name = "ListProject"; - LayoutRoot.Children.Add(listProject); - listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown); + // First We create the project if we are in annotation mode + if(AnnotationOrSearchMode=="Annotation") + _mainViewModel.CreateProject(videoName, videoPath); + // We get all the ldt/project files from the current directory... + List existingProjects = new List(); + foreach (String filename in Directory.GetFiles("./")) + { + if (filename.Substring(filename.Length-4).ToLower()==".ldt") + existingProjects.Add(filename.Substring(2, filename.Length - 6)); + } + // ... and display them the the select box UserControlListProject + UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode); + listProject.Name = "ListProject"; + LayoutRoot.Children.Add(listProject); + listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown); } catch (Exception) { @@ -154,8 +175,11 @@ loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la)); } // We define the loaded project as the current session's project. - _mainViewModel.Project = new ProjectViewModel(loadedProject); - OpenProject(); + if (AnnotationOrSearchMode == "Annotation") + { + _mainViewModel.Project = new ProjectViewModel(loadedProject); + OpenProject(); + } } } catch (Exception)