src/FingersDance/MainSurfaceWindow.xaml.cs
changeset 104 1a428e733fea
parent 97 31b24064b28f
child 112 08bc8eac9e71
equal deleted inserted replaced
103:6eb5b39f8e97 104:1a428e733fea
    14 using Microsoft.Surface;
    14 using Microsoft.Surface;
    15 using Microsoft.Surface.Presentation;
    15 using Microsoft.Surface.Presentation;
    16 using Microsoft.Surface.Presentation.Controls;
    16 using Microsoft.Surface.Presentation.Controls;
    17 
    17 
    18 using FingersDance.Control.UserPanel;
    18 using FingersDance.Control.UserPanel;
    19 using FingersDance.Control.ListVideo;
       
    20 using FingersDance.Control.SessionInput;
       
    21 using FingersDance.Control.Screen;
    19 using FingersDance.Control.Screen;
    22 
    20 
    23 
    21 
    24 namespace FingersDance
    22 namespace FingersDance
    25 {
    23 {
   255                 Screen1.Name = "Screen1";
   253                 Screen1.Name = "Screen1";
   256                 Screen1.contexteGrid = Grid1.Name.ToString();
   254                 Screen1.contexteGrid = Grid1.Name.ToString();
   257                 //2-Rajout du screen dans la grid correspondante
   255                 //2-Rajout du screen dans la grid correspondante
   258                 Grid1.Children.Add(Screen1);
   256                 Grid1.Children.Add(Screen1);
   259 
   257 
   260                 //3-Creation de la ListVideo
   258                 Screen1.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
   261                 UserControlListVideo ListVideo1 = new UserControlListVideo();
       
   262                 ListVideo1.Name = "ListVideo1";
       
   263                 
       
   264                 //4-Ajout de la ListVideo au ControlScreen
       
   265                 Screen1.AddToGrid(ListVideo1);
       
   266 
       
   267                 //5-Creation des Events pour chaque item de la video
       
   268                 ListVideo1.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo1_EH_ItemVideo1_ContactDown);
       
   269                 ListVideo1.EH_ItemVideo2_ContactDown += new System.EventHandler(this.ListVideo1_EH_ItemVideo2_ContactDown);
       
   270 
       
   271             }            
   259             }            
   272         }
   260         }
   273 
   261 
   274         private void UserControlPivot_EH_SurfaceButtonPlayer2_ContactDown(object sender, EventArgs e)
   262         private void UserControlPivot_EH_SurfaceButtonPlayer2_ContactDown(object sender, EventArgs e)
   275         {
   263         {
   276             if (!isCreatedP2)
   264             if (!isCreatedP2)
   277             {
   265             {
   278                /* UserControlUserPanel UserPanel2 = new UserControlUserPanel();
   266                
   279                 UserPanel2.Name = "UserPanel2";
       
   280                 Grid2.Children.Add(UserPanel2);
       
   281                 isCreatedP2 = true;*/
       
   282 
       
   283                 //1-Creation du control Screen
       
   284                 UserControlScreen Screen2 = new UserControlScreen();
       
   285                 Screen2.Name = "Screen2";
       
   286                 Screen2.contexteGrid = Grid2.Name.ToString();
       
   287                 //2-Rajout du screen dans la grid correspondante
       
   288                 Grid2.Children.Add(Screen2);
       
   289 
       
   290                 //3-Creation de la ListVideo
       
   291                 UserControlListVideo ListVideo2 = new UserControlListVideo();
       
   292                 ListVideo2.Name = "ListVideo2";
       
   293 
       
   294                 //4-Ajout de la ListVideo au ControlScreen
       
   295                 Screen2.AddToGrid(ListVideo2);
       
   296 
       
   297                 //5-Creation des Events pour chaque item de la video
       
   298                 ListVideo2.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo1_EH_ItemVideo1_ContactDown);
       
   299                 ListVideo2.EH_ItemVideo2_ContactDown += new System.EventHandler(this.ListVideo1_EH_ItemVideo2_ContactDown);
       
   300 
       
   301             } 
   267             } 
   302         }
   268         }
   303 
   269 
   304         private void UserControlPivot_EH_SurfaceButtonPlayer3_ContactDown(object sender, EventArgs e)
   270         private void UserControlPivot_EH_SurfaceButtonPlayer3_ContactDown(object sender, EventArgs e)
   305         {
   271         {
   321                 Grid4.Children.Add(UserPanel4);
   287                 Grid4.Children.Add(UserPanel4);
   322                 isCreatedP4 = true;
   288                 isCreatedP4 = true;
   323             } 
   289             } 
   324         }
   290         }
   325 
   291 
   326         private void ListVideo1_EH_ItemVideo1_ContactDown(object sender, EventArgs e)
   292         
   327         {
       
   328 
       
   329             //Creation d'un ScatterView Item
       
   330             //ScatterViewItem scatterViewItemSessionInput = new ScatterViewItem();
       
   331             //scatterViewItemSessionInput.Name = "ScatterViewItemSessionInput";
       
   332             
       
   333             
       
   334             //1-Creation d'une nouvelle seance.                
       
   335             UserControlSessionInput SessionInput = new UserControlSessionInput();
       
   336             SessionInput.Name = "SessionInput";
       
   337 
       
   338             try{
       
   339                 //2-Recuperer la Grid (Layout root du UC screen)qui contient le UCListVideo et l'ajouter.
       
   340                 Grid actualGrid = (Grid)(((UserControlListVideo)sender).Parent);
       
   341                 actualGrid.Children.Add(SessionInput);
       
   342                 
       
   343                 //2.5 rensegner la video choisie au screen
       
   344                 ((UserControlScreen)actualGrid.Parent).Path = ((UserControlListVideo)sender).path;
       
   345                 //3-Creation des Events
       
   346                 SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
       
   347                 //4-Supression du UC List Video
       
   348                 actualGrid.Children.Remove((UserControlListVideo)sender);
       
   349 
       
   350                 //Init Scatter View Properties and Add it to the scatter view.
       
   351                 /*scatterViewItemSessionInput.Content = SessionInput;
       
   352                 scatterViewItemSessionInput.CanMove = true;
       
   353                 scatterViewItemSessionInput.CanScale = false;
       
   354                 scatterViewItemSessionInput.CanRotate = true;
       
   355                 scatterViewItemSessionInput.Center = new Point((double)actualGrid.ActualWidth,(double)actualGrid.ActualHeight);
       
   356                 scaterview.Items.Add(scatterViewItemSessionInput);*/
       
   357             }
       
   358             catch (Exception ex) { }
       
   359             isCreatedP1 = true;
       
   360         }
       
   361 
   293 
   362         private void ListVideo1_EH_ItemVideo2_ContactDown(object sender, EventArgs e)
   294         private void ListVideo1_EH_ItemVideo2_ContactDown(object sender, EventArgs e)
   363         {
   295         {
   364             //ToDo
   296             //ToDo
   365         }
   297         }
   367         //Button Submit du control SessionInput
   299         //Button Submit du control SessionInput
   368         private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
   300         private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
   369         {
   301         {
   370             try
   302             try
   371             {
   303             {
   372                 //1-Recuperation de actualGrid (LayoutRoot du UC Screen)
       
   373                 Grid actualGrid = (Grid)(((UserControlSessionInput)sender).Parent);
       
   374                 //2-Suppression UCSession Input
       
   375                 actualGrid.Children.Remove((UserControlSessionInput)sender);
       
   376                 //3-Suppression du UC Screen
   304                 //3-Suppression du UC Screen
   377                 Grid root = (Grid) ((UserControlScreen)actualGrid.Parent).Parent;
   305                 Grid root = (Grid)(((UserControlScreen)sender).Parent);
   378                 root.Children.Remove((UserControlScreen)actualGrid.Parent);
   306                 root.Children.Remove(((UserControlScreen)sender));
   379                 //4-Creation du User Panel
   307                 //4-Creation du User Panel
   380                 UserControlUserPanel UserPanel1 = new UserControlUserPanel();
   308                 UserControlUserPanel UserPanel1 = new UserControlUserPanel();
   381                 UserPanel1.Name = "UserPanel1";
   309                 UserPanel1.Name = "UserPanel1";
   382                 //5-Rajout sur la Grid Root
   310                 //5-Rajout sur la Grid Root
   383                 root.Children.Add(UserPanel1);
   311                 root.Children.Add(UserPanel1);