src/FingersDance/MainSurfaceWindow.xaml.cs
changeset 214 beebae32b1ed
parent 211 50e6fe2c2ea2
child 217 6cfd723a1378
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Nov 19 15:35:46 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Nov 19 18:37:26 2009 +0100
@@ -292,10 +292,6 @@
 
         private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e)
         {
-            //  Si aucune video n'a été sélectionnée et qu'une grid contient un élément (listvideo), on ne fait rien
-            if (_mainviewmodel.Project.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2))
-                return;
-
             //  Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel
             switch ((int)sender)
             {
@@ -417,17 +413,21 @@
                     if (((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation")
                     {
                         if (Panel1 != null)
-                            if (Panel1.Cutting.Title==newCutting.Title)
-                                return;
+                            if (Panel1.Cutting != null)
+                                if (Panel1.Cutting.Title==newCutting.Title)
+                                    return;
                         if (Panel2 != null)
-                            if (Panel2.Cutting.Title == newCutting.Title)
-                                return;
+                            if (Panel2.Cutting != null)
+                                if (Panel2.Cutting.Title == newCutting.Title)
+                                    return;
                         if (Panel3 != null)
-                            if (Panel3.Cutting.Title == newCutting.Title)
-                                return;
+                            if (Panel3.Cutting != null)
+                                if (Panel3.Cutting.Title == newCutting.Title)
+                                    return;
                         if (Panel4 != null)
-                            if (Panel4.Cutting.Title == newCutting.Title)
-                                return;
+                            if (Panel4.Cutting != null)
+                                if (Panel4.Cutting.Title == newCutting.Title)
+                                    return;
 
                         // We add the new cutting to the _mainviewmodel's datas IF THE CUTTING IS NEW (if not it means that it is from a loaded project)
                         if (!_mainviewmodel.Project.CuttingsDict.ContainsKey(newCutting.Title))
@@ -444,7 +444,7 @@
                     {
                         case 1:
                             UserControlPivot.ApplyColor(1, color);
-                            Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
+                            Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
                             Panel1.Name = "UserPanel1";
                             Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -454,7 +454,7 @@
                             break;
                         case 2:
                             UserControlPivot.ApplyColor(2, color);
-                            Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
+                            Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
                             Panel2.Name = "UserPanel2";
                             Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -464,7 +464,7 @@
                             break;
                         case 3:
                             UserControlPivot.ApplyColor(3, color);
-                            Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
+                            Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
                             Panel3.Name = "UserPanel3";
                             Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -474,7 +474,7 @@
                             break;
                         case 4:
                             UserControlPivot.ApplyColor(4, color);
-                            Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
+                            Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
                             Panel4.Name = "UserPanel4";
                             Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);