--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Thu Nov 19 15:35:46 2009 +0100
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Thu Nov 19 18:37:26 2009 +0100
@@ -23,6 +23,7 @@
public event EventHandler UC_Screen_NewCutting;
private MainViewModel _mainViewModel;
public String AnnotationOrSearchMode;
+ public Project SearchedProject;
public Cutting Cutting;
private String videoName;
@@ -49,7 +50,7 @@
ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(ListVideo_EH_ItemVideo_ContactDown);
}
else
- OpenProject();
+ GetAnnotationOrSearchMode();
}
catch (Exception)
{
@@ -76,6 +77,8 @@
// 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;
+ // We initialize it in _mainViewModel for it to remembered in every place of the application
+ _mainViewModel.Project.VideoPath = videoPath;
// 2-Supression du UC List Video
LayoutRoot.Children.Remove((UserControlListVideo)sender);
// 3 - Choose between Annotation Or Search Mode
@@ -103,16 +106,17 @@
LayoutRoot.Children.Remove((UserControlAnnotationOrSearch)sender);
// We show the project list and send the chosen mode
AnnotationOrSearchMode = e.ChosenMode;
- OpenProjectList();
+ if (AnnotationOrSearchMode == "Annotation" && _mainViewModel.Project.Cuttings.Count!=0)
+ OpenProject();
+ else
+ OpenProjectList();
+
}
private void OpenProjectList()
{
try
{
- // 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<String> existingProjects = new List<String>();
foreach (String filename in Directory.GetFiles("./"))
@@ -151,7 +155,7 @@
// ((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");
- Project loadedProject = new Project(videoName, videoPath);
+ 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;
loadedProject.Cuttings = new List<Cutting>();
@@ -174,8 +178,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);
+ // We define the loaded project as the current session's project in annotation mode or the searched project in search mode
+ if (AnnotationOrSearchMode == "Annotation")
+ _mainViewModel.Project = new ProjectViewModel(loadedProject);
+ else
+ SearchedProject = loadedProject;
OpenProject();
}
}
@@ -243,7 +250,7 @@
LayoutRoot.Children.Remove((UserControlListCutting)sender);
if (((UserControlListCutting)sender).SelectedItem.Equals("New Cutting"))
{
- // "New Uutting" was was selected -> we display the form
+ // "New Cutting" was was selected -> we display the form
UserControlNewCuttingForm newCutting = new UserControlNewCuttingForm(User);
newCutting.Name = "newCutting";
LayoutRoot.Children.Add(newCutting);