src/FingersDance/MainSurfaceWindow.xaml.cs
changeset 211 50e6fe2c2ea2
parent 195 48b3139bb182
child 214 beebae32b1ed
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Nov 19 09:29:15 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Nov 19 12:15:12 2009 +0100
@@ -407,31 +407,34 @@
                 Grid root = (Grid)(((UserControlScreen)sender).Parent);
                 // We remove the UserControlScreen's instance
                 root.Children.Remove(((UserControlScreen)sender));
-                
-                if (((UserControlScreen)sender).Cutting != null)
+
+                if ((((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation") || (((UserControlScreen)sender).AnnotationOrSearchMode == "Search"))
                 {
                     //2-Creation du User Panel
                     Cutting newCutting = ((UserControlScreen)sender).Cutting;
 
                     // We test if each Panel does not already own the sent cuttingVM
-                    if (Panel1 != null)
-                        if (Panel1.Cutting.Title==newCutting.Title)
-                            return;
-                    if (Panel2 != null)
-                        if (Panel2.Cutting.Title == newCutting.Title)
-                            return;
-                    if (Panel3 != null)
-                        if (Panel3.Cutting.Title == newCutting.Title)
-                            return;
-                    if (Panel4 != null)
-                        if (Panel4.Cutting.Title == newCutting.Title)
-                            return;
+                    if (((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation")
+                    {
+                        if (Panel1 != null)
+                            if (Panel1.Cutting.Title==newCutting.Title)
+                                return;
+                        if (Panel2 != null)
+                            if (Panel2.Cutting.Title == newCutting.Title)
+                                return;
+                        if (Panel3 != null)
+                            if (Panel3.Cutting.Title == newCutting.Title)
+                                return;
+                        if (Panel4 != 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))
-                    {
-                        _mainviewmodel.Project.Cuttings.Add(newCutting);
-                        _mainviewmodel.Project.CuttingsDict.Add(newCutting.Title, newCutting);
+                        // 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))
+                        {
+                            _mainviewmodel.Project.Cuttings.Add(newCutting);
+                            _mainviewmodel.Project.CuttingsDict.Add(newCutting.Title, newCutting);
+                        }
                     }
 
                     // And now we build the new UserPanel
@@ -441,7 +444,7 @@
                     {
                         case 1:
                             UserControlPivot.ApplyColor(1, color);
-                            Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
+                            Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
                             Panel1.Name = "UserPanel1";
                             Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -451,7 +454,7 @@
                             break;
                         case 2:
                             UserControlPivot.ApplyColor(2, color);
-                            Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
+                            Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
                             Panel2.Name = "UserPanel2";
                             Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -461,7 +464,7 @@
                             break;
                         case 3:
                             UserControlPivot.ApplyColor(3, color);
-                            Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
+                            Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
                             Panel3.Name = "UserPanel3";
                             Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -471,7 +474,7 @@
                             break;
                         case 4:
                             UserControlPivot.ApplyColor(4, color);
-                            Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
+                            Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode);
                             Panel4.Name = "UserPanel4";
                             Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -521,7 +524,7 @@
         }
 
 
-        //On success annotation Display annotations in the different Panels
+        //On success annotation we save the update datas
         private void Panel_OnSuccessAnnotation(object sender, EventArgs e)
         {
             // We save datas