changeset 182 | 25b49d4f1635 |
parent 168 | d70ee2002f75 |
child 186 | 83615722dbab |
179:97ef988c92c2 | 182:25b49d4f1635 |
---|---|
289 } |
289 } |
290 |
290 |
291 private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e) |
291 private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e) |
292 { |
292 { |
293 // Si aucune video n'a été sélectionnée et qu'une grid contient un élément (listvideo), on ne fait rien |
293 // Si aucune video n'a été sélectionnée et qu'une grid contient un élément (listvideo), on ne fait rien |
294 if (_mainviewmodel.Session.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2)) |
294 if (_mainviewmodel.Project.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2)) |
295 return; |
295 return; |
296 |
296 |
297 // Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel |
297 // Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel |
298 switch ((int)sender) |
298 switch ((int)sender) |
299 { |
299 { |
305 Screen.Name = "Screen1"; |
305 Screen.Name = "Screen1"; |
306 Screen.contexteGrid = Grid1.Name.ToString(); |
306 Screen.contexteGrid = Grid1.Name.ToString(); |
307 //2-Rajout du screen dans la grid correspondante |
307 //2-Rajout du screen dans la grid correspondante |
308 Grid1.Children.Add(Screen); |
308 Grid1.Children.Add(Screen); |
309 |
309 |
310 Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
310 Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
311 } |
311 } |
312 else //Affichage du message de confirmation |
312 else //Affichage du message de confirmation |
313 { |
313 { |
314 if (Panel1 != null && Grid1.Children.Count == 2) |
314 if (Panel1 != null && Grid1.Children.Count == 2) |
315 { |
315 { |
328 Screen.Name = "Screen2"; |
328 Screen.Name = "Screen2"; |
329 Screen.contexteGrid = Grid2.Name.ToString(); |
329 Screen.contexteGrid = Grid2.Name.ToString(); |
330 //2-Rajout du screen dans la grid correspondante |
330 //2-Rajout du screen dans la grid correspondante |
331 Grid2.Children.Add(Screen); |
331 Grid2.Children.Add(Screen); |
332 |
332 |
333 Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
333 Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
334 } |
334 } |
335 else //Affichage du message de confirmation |
335 else //Affichage du message de confirmation |
336 { |
336 { |
337 if (Panel2 != null && Grid2.Children.Count == 2) |
337 if (Panel2 != null && Grid2.Children.Count == 2) |
338 { |
338 { |
351 Screen.Name = "Screen3"; |
351 Screen.Name = "Screen3"; |
352 Screen.contexteGrid = Grid3.Name.ToString(); |
352 Screen.contexteGrid = Grid3.Name.ToString(); |
353 //2-Rajout du screen dans la grid correspondante |
353 //2-Rajout du screen dans la grid correspondante |
354 Grid3.Children.Add(Screen); |
354 Grid3.Children.Add(Screen); |
355 |
355 |
356 Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
356 Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
357 } |
357 } |
358 else //Affichage du message de confirmation |
358 else //Affichage du message de confirmation |
359 { |
359 { |
360 if (Panel3 != null && Grid3.Children.Count == 2) |
360 if (Panel3 != null && Grid3.Children.Count == 2) |
361 { |
361 { |
374 Screen.Name = "Screen4"; |
374 Screen.Name = "Screen4"; |
375 Screen.contexteGrid = Grid4.Name.ToString(); |
375 Screen.contexteGrid = Grid4.Name.ToString(); |
376 //2-Rajout du screen dans la grid correspondante |
376 //2-Rajout du screen dans la grid correspondante |
377 Grid4.Children.Add(Screen); |
377 Grid4.Children.Add(Screen); |
378 |
378 |
379 Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
379 Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
380 } |
380 } |
381 else //Affichage du message de confirmation |
381 else //Affichage du message de confirmation |
382 { |
382 { |
383 if (Panel4 != null && Grid4.Children.Count == 2) |
383 if (Panel4 != null && Grid4.Children.Count == 2) |
384 { |
384 { |
403 { |
403 { |
404 //1-Suppression du UC Screen |
404 //1-Suppression du UC Screen |
405 Grid root = (Grid)(((UserControlScreen)sender).Parent); |
405 Grid root = (Grid)(((UserControlScreen)sender).Parent); |
406 root.Children.Remove(((UserControlScreen)sender)); |
406 root.Children.Remove(((UserControlScreen)sender)); |
407 |
407 |
408 if (((UserControlScreen)sender).Project != null) |
408 if (((UserControlScreen)sender).Cutting != null) |
409 { |
409 { |
410 //2-Creation du User Panel |
410 //2-Creation du User Panel |
411 Project newProject = ((UserControlScreen)sender).Project.Project; |
411 CuttingViewModel newCuttingVM = ((UserControlScreen)sender).Cutting; |
412 |
412 |
413 if ((Panel1 != null && Panel1.Project.Equals(newProject)) || (Panel2 != null && Panel2.Project.Equals(newProject)) || (Panel3 != null && Panel3.Project.Equals(newProject)) || (Panel4 != null && Panel4.Project.Equals(newProject))) |
413 if ((Panel1 != null && Panel1.CuttingVM.Equals(newCuttingVM)) || (Panel2 != null && Panel2.CuttingVM.Equals(newCuttingVM)) || (Panel3 != null && Panel3.CuttingVM.Equals(newCuttingVM)) || (Panel4 != null && Panel4.CuttingVM.Equals(newCuttingVM))) |
414 return; |
414 return; |
415 |
415 |
416 Random c = new Random(); |
416 Random c = new Random(); |
417 uint color = (uint)c.Next(12) + 1; // for the number to be >0 |
417 uint color = (uint)c.Next(12) + 1; // for the number to be >0 |
418 switch (((UserControlScreen)sender).id) |
418 switch (((UserControlScreen)sender).id) |
419 { |
419 { |
420 case 1: |
420 case 1: |
421 UserControlPivot.ApplyColor(1, color); |
421 UserControlPivot.ApplyColor(1, color); |
422 Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
422 Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath); |
423 Panel1.Name = "UserPanel1"; |
423 Panel1.Name = "UserPanel1"; |
424 Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
424 Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
425 Panel1.idcolor = color; |
425 Panel1.idcolor = color; |
426 //3-Rajout sur la Grid Root |
426 //3-Rajout sur la Grid Root |
427 root.Children.Add(Panel1); |
427 root.Children.Add(Panel1); |
428 break; |
428 break; |
429 case 2: |
429 case 2: |
430 UserControlPivot.ApplyColor(2, color); |
430 UserControlPivot.ApplyColor(2, color); |
431 Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
431 Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath); |
432 Panel2.Name = "UserPanel2"; |
432 Panel2.Name = "UserPanel2"; |
433 Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
433 Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
434 Panel2.idcolor = color; |
434 Panel2.idcolor = color; |
435 //3-Rajout sur la Grid Root |
435 //3-Rajout sur la Grid Root |
436 root.Children.Add(Panel2); |
436 root.Children.Add(Panel2); |
437 break; |
437 break; |
438 case 3: |
438 case 3: |
439 UserControlPivot.ApplyColor(3, color); |
439 UserControlPivot.ApplyColor(3, color); |
440 Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
440 Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath); |
441 Panel3.Name = "UserPanel3"; |
441 Panel3.Name = "UserPanel3"; |
442 Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
442 Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
443 Panel3.idcolor = color; |
443 Panel3.idcolor = color; |
444 //3-Rajout sur la Grid Root |
444 //3-Rajout sur la Grid Root |
445 root.Children.Add(Panel3); |
445 root.Children.Add(Panel3); |
446 break; |
446 break; |
447 case 4: |
447 case 4: |
448 UserControlPivot.ApplyColor(4, color); |
448 UserControlPivot.ApplyColor(4, color); |
449 Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
449 Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath); |
450 Panel4.Name = "UserPanel4"; |
450 Panel4.Name = "UserPanel4"; |
451 Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
451 Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
452 Panel4.idcolor = color; |
452 Panel4.idcolor = color; |
453 //3-Rajout sur la Grid Root |
453 //3-Rajout sur la Grid Root |
454 root.Children.Add(Panel4); |
454 root.Children.Add(Panel4); |
489 break; |
489 break; |
490 } |
490 } |
491 } |
491 } |
492 root.Children.Remove(((UserControlClose)sender)); |
492 root.Children.Remove(((UserControlClose)sender)); |
493 if (Panel1 == null && Panel2 == null && Panel3 == null && Panel4 == null) |
493 if (Panel1 == null && Panel2 == null && Panel3 == null && Panel4 == null) |
494 _mainviewmodel.CloseSession(); |
494 _mainviewmodel.CloseProject(); |
495 } |
495 } |
496 |
496 |
497 |
497 |
498 //On success annotation Display annotations in the different Panels |
498 //On success annotation Display annotations in the different Panels |
499 private void Panel_OnSuccessAnnotation(object sender, EventArgs e) |
499 private void Panel_OnSuccessAnnotation(object sender, EventArgs e) |