# HG changeset patch # User cavaliet # Date 1258546015 -3600 # Node ID 0699cab5cbb377c2093267098856897d3b118234 # Parent 6405d0b7d085b0422d0e5a5d4323fb6536fbee6c first step of search mode : add choice panel and integrate the annotation mode. 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) diff -r 6405d0b7d085 -r 0699cab5cbb3 src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj --- a/src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj Tue Nov 17 13:40:58 2009 +0100 +++ b/src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj Wed Nov 18 13:06:55 2009 +0100 @@ -89,6 +89,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -127,6 +131,9 @@ True Settings.settings + + UserControlAnnotationOrSearch.xaml + UserControlListCutting.xaml diff -r 6405d0b7d085 -r 0699cab5cbb3 src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml Wed Nov 18 13:06:55 2009 +0100 @@ -0,0 +1,13 @@ + + + + + + + diff -r 6405d0b7d085 -r 0699cab5cbb3 src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.SessionInput/UserControlAnnotationOrSearch.xaml.cs Wed Nov 18 13:06:55 2009 +0100 @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace FingersDance.Control.SessionInput +{ + + /// + /// Interaction logic for UserControlAnnotationOrSearch.xaml + /// + public partial class UserControlAnnotationOrSearch : UserControl + { + public event EventHandler ModeChosen; + + public UserControlAnnotationOrSearch() + { + InitializeComponent(); + } + + private void annotBtn_Click(object sender, RoutedEventArgs e) + { + ModeChosen(this, new AnnotationOrSearchEventArg("Annotation")); + } + + private void annotBtn_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) + { + ModeChosen(this, new AnnotationOrSearchEventArg("Annotation")); + } + + private void searchBtn_Click(object sender, RoutedEventArgs e) + { + ModeChosen(this, new AnnotationOrSearchEventArg("Search")); + } + + private void searchBtn_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) + { + ModeChosen(this, new AnnotationOrSearchEventArg("Search")); + } + } + + + /// + /// AnnotationOrSearchEventArg + /// + public class AnnotationOrSearchEventArg : EventArgs + { + public String ChosenMode + { + get; + set; + } + + public AnnotationOrSearchEventArg(String chosenMode) + { + + ChosenMode = chosenMode; + + } + + } +} diff -r 6405d0b7d085 -r 0699cab5cbb3 src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs --- a/src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs Tue Nov 17 13:40:58 2009 +0100 +++ b/src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs Wed Nov 18 13:06:55 2009 +0100 @@ -25,25 +25,29 @@ public event EventHandler EH_ListProject_ContactDown; public string SelectedItem = ""; - public UserControlListProject(List projectNames) + public UserControlListProject(List projectNames, String AnnotationOrSearchMode) { InitializeComponent(); - OpenProjects(projectNames); + OpenProjects(projectNames, AnnotationOrSearchMode); } - private void OpenProjects(List projectNames) + private void OpenProjects(List projectNames, String AnnotationOrSearchMode) { - CustomListBoxItem Contener = new CustomListBoxItem(); - Contener.Name = "New Project"; - UserControlCustomLabel l = new UserControlCustomLabel("New Project"); - Contener.Content = l; - stackPanel.Children.Add(Contener); - Contener.ContactTapGesture += Item_ContactTapGesture; + // We add the "new project" item only if we are in "Annotation" mode. Search mode only needs existing projects + if (AnnotationOrSearchMode == "Annotation") + { + CustomListBoxItem Contener = new CustomListBoxItem(); + Contener.Name = "New Project"; + UserControlCustomLabel l = new UserControlCustomLabel("New Project"); + Contener.Content = l; + stackPanel.Children.Add(Contener); + Contener.ContactTapGesture += Item_ContactTapGesture; + } foreach (String projectName in projectNames) { - Contener = new CustomListBoxItem(); + CustomListBoxItem Contener = new CustomListBoxItem(); Contener.Name = projectName; - l = new UserControlCustomLabel(projectName); + UserControlCustomLabel l = new UserControlCustomLabel(projectName); Contener.Content = l; stackPanel.Children.Add(Contener); Contener.ContactTapGesture += Item_ContactTapGesture;