src/FingersDance/MainSurfaceWindow.xaml.cs
changeset 190 619ca3ae13c7
parent 188 e642ad0c366b
child 191 8a25a85f2656
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Fri Nov 06 17:50:40 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Mon Nov 09 12:11:42 2009 +0100
@@ -307,7 +307,7 @@
                         //2-Rajout du screen dans la grid correspondante
                         Grid1.Children.Add(Screen);
 
-                        Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+                        Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); 
                     }
                     else //Affichage du message de confirmation
                     {
@@ -405,25 +405,29 @@
                 Grid root = (Grid)(((UserControlScreen)sender).Parent);
                 root.Children.Remove(((UserControlScreen)sender));
                 
-                if (((UserControlScreen)sender).CuttingVM != null)
+                if (((UserControlScreen)sender).Cutting != null)
                 {
                     //2-Creation du User Panel
-                    CuttingViewModel newCuttingVM = ((UserControlScreen)sender).CuttingVM;
+                    Cutting newCutting = ((UserControlScreen)sender).Cutting;
 
                     // We test if each Panel does not already own the sent cuttingVM
                     if (Panel1 != null)
-                        if (Panel1.CuttingVM.Title==newCuttingVM.Title)
+                        if (Panel1.Cutting.Title==newCutting.Title)
                             return;
                     if (Panel2 != null)
-                        if (Panel2.CuttingVM.Title == newCuttingVM.Title)
+                        if (Panel2.Cutting.Title == newCutting.Title)
                             return;
                     if (Panel3 != null)
-                        if (Panel3.CuttingVM.Title == newCuttingVM.Title)
+                        if (Panel3.Cutting.Title == newCutting.Title)
                             return;
                     if (Panel4 != null)
-                        if (Panel4.CuttingVM.Title == newCuttingVM.Title)
+                        if (Panel4.Cutting.Title == newCutting.Title)
                             return;
 
+                    // We add the new cutting to the _mainviewmodel's datas
+                    _mainviewmodel.Project.Cuttings.Add(newCutting);
+                    _mainviewmodel.Project.CuttingsDict.Add("User " + ((UserControlScreen)sender).id, newCutting);
+
                     // And now we build the new UserPanel
                     Random c = new Random();
                     uint color = (uint)c.Next(12) + 1; // for the number to be >0
@@ -431,7 +435,7 @@
                     {
                         case 1:
                             UserControlPivot.ApplyColor(1, color);
-                            Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
+                            Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
                             Panel1.Name = "UserPanel1";
                             Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -441,7 +445,7 @@
                             break;
                         case 2:
                             UserControlPivot.ApplyColor(2, color);
-                            Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
+                            Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
                             Panel2.Name = "UserPanel2";
                             Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -451,7 +455,7 @@
                             break;
                         case 3:
                             UserControlPivot.ApplyColor(3, color);
-                            Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
+                            Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
                             Panel3.Name = "UserPanel3";
                             Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
@@ -461,7 +465,7 @@
                             break;
                         case 4:
                             UserControlPivot.ApplyColor(4, color);
-                            Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
+                            Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath);
                             Panel4.Name = "UserPanel4";
                             Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
                             Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);