src/FingersDance/MainSurfaceWindow.xaml.cs
changeset 162 0b9f989bcb37
parent 160 e940ca798fe3
child 168 d70ee2002f75
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Fri Oct 16 16:26:21 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Fri Oct 16 21:06:25 2009 +0200
@@ -40,8 +40,7 @@
         private UserControlUserPanel Panel3 = null;
         private UserControlUserPanel Panel4 = null;
         ActionGenerator _Factory = (new ActionFactory()).GetGenerator();
-        private MainViewModel _mainviewmodel = new MainViewModel();      
-
+        private MainViewModel _mainviewmodel = new MainViewModel();
         #endregion
 
 
@@ -49,7 +48,6 @@
         public SurfaceWindow1()
         {
             InitializeComponent();
-
             //Permet d'initialiser l'inertie du Pivot une fois relaché.
             InitPivotInertia();
             //Permet d'initialiser les quand Grid à la position initiale du pivot
@@ -94,6 +92,7 @@
 
         #endregion
 
+        #region Application Default Functions
         /// <summary>
         /// Occurs when the window is about to close. 
         /// </summary>
@@ -183,10 +182,14 @@
             // Dismiss the loading screen.
             ApplicationLauncher.SignalApplicationLoadComplete();
         }
+        #endregion
 
+
+        
+
+        #region Pivot Actions
         private void scaterview_ContactChanged(object sender, ContactEventArgs e)
-        {  }
-
+        { }
         private void ScatterViewItemPivot_ContactChanged(object sender, ContactEventArgs e)
         {
             //Permet la MAJ des 4 Grids à la position du pivot
@@ -387,9 +390,12 @@
                     }
                     break;
             }
-                        
+
         }
 
+        #endregion
+
+
         //Button Submit du control SessionInput
         private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
         {
@@ -415,6 +421,8 @@
                             UserControlPivot.ApplyColor(1, color);
                             Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
                             Panel1.Name = "UserPanel1";
+                            Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
+                            Panel1.idcolor = color;
                             //3-Rajout sur la Grid Root
                             root.Children.Add(Panel1);
                             break;
@@ -422,6 +430,8 @@
                             UserControlPivot.ApplyColor(2, color);
                             Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
                             Panel2.Name = "UserPanel2";
+                            Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
+                            Panel2.idcolor = color;
                             //3-Rajout sur la Grid Root
                             root.Children.Add(Panel2);
                             break;
@@ -429,6 +439,8 @@
                             UserControlPivot.ApplyColor(3, color);
                             Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
                             Panel3.Name = "UserPanel3";
+                            Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
+                            Panel3.idcolor = color;
                             //3-Rajout sur la Grid Root
                             root.Children.Add(Panel3);
                             break;
@@ -436,6 +448,8 @@
                             UserControlPivot.ApplyColor(4, color);
                             Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
                             Panel4.Name = "UserPanel4";
+                            Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
+                            Panel4.idcolor = color;
                             //3-Rajout sur la Grid Root
                             root.Children.Add(Panel4);
                             break;
@@ -478,5 +492,25 @@
             root.Children.Remove(((UserControlClose)sender));
         }
 
+
+        //On success annotation Display annotations in the different Panels
+        private void Panel_OnSuccessAnnotation(object sender, EventArgs e)
+        {
+            UserControlUserPanel PanelAnnotation = (UserControlUserPanel)sender;
+            int idUser = PanelAnnotation.id;
+            //Get Color Of User
+            Brush brushAnnot = new SolidColorBrush((new ColorFactory()).Colors[PanelAnnotation.idcolor]);
+            //set Color to All Panels
+            if(Panel1!=null)
+                Panel1.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot);
+            if (Panel2 != null)
+                Panel2.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot);
+            if (Panel3 != null)
+                Panel3.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot);
+            if (Panel4 != null)
+                Panel4.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot);
+
+
+        }
     }
 }
\ No newline at end of file