415 |
411 |
416 // We test if each Panel does not already own the sent cuttingVM |
412 // We test if each Panel does not already own the sent cuttingVM |
417 if (((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation") |
413 if (((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation") |
418 { |
414 { |
419 if (Panel1 != null) |
415 if (Panel1 != null) |
420 if (Panel1.Cutting.Title==newCutting.Title) |
416 if (Panel1.Cutting != null) |
421 return; |
417 if (Panel1.Cutting.Title==newCutting.Title) |
|
418 return; |
422 if (Panel2 != null) |
419 if (Panel2 != null) |
423 if (Panel2.Cutting.Title == newCutting.Title) |
420 if (Panel2.Cutting != null) |
424 return; |
421 if (Panel2.Cutting.Title == newCutting.Title) |
|
422 return; |
425 if (Panel3 != null) |
423 if (Panel3 != null) |
426 if (Panel3.Cutting.Title == newCutting.Title) |
424 if (Panel3.Cutting != null) |
427 return; |
425 if (Panel3.Cutting.Title == newCutting.Title) |
|
426 return; |
428 if (Panel4 != null) |
427 if (Panel4 != null) |
429 if (Panel4.Cutting.Title == newCutting.Title) |
428 if (Panel4.Cutting != null) |
430 return; |
429 if (Panel4.Cutting.Title == newCutting.Title) |
|
430 return; |
431 |
431 |
432 // 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) |
432 // 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) |
433 if (!_mainviewmodel.Project.CuttingsDict.ContainsKey(newCutting.Title)) |
433 if (!_mainviewmodel.Project.CuttingsDict.ContainsKey(newCutting.Title)) |
434 { |
434 { |
435 _mainviewmodel.Project.Cuttings.Add(newCutting); |
435 _mainviewmodel.Project.Cuttings.Add(newCutting); |
442 uint color = (uint)c.Next(12) + 1; // for the number to be >0 |
442 uint color = (uint)c.Next(12) + 1; // for the number to be >0 |
443 switch (((UserControlScreen)sender).id) |
443 switch (((UserControlScreen)sender).id) |
444 { |
444 { |
445 case 1: |
445 case 1: |
446 UserControlPivot.ApplyColor(1, color); |
446 UserControlPivot.ApplyColor(1, color); |
447 Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); |
447 Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); |
448 Panel1.Name = "UserPanel1"; |
448 Panel1.Name = "UserPanel1"; |
449 Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
449 Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
450 Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
450 Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
451 Panel1.idcolor = color; |
451 Panel1.idcolor = color; |
452 //3-Rajout sur la Grid Root |
452 //3-Rajout sur la Grid Root |
453 root.Children.Add(Panel1); |
453 root.Children.Add(Panel1); |
454 break; |
454 break; |
455 case 2: |
455 case 2: |
456 UserControlPivot.ApplyColor(2, color); |
456 UserControlPivot.ApplyColor(2, color); |
457 Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); |
457 Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); |
458 Panel2.Name = "UserPanel2"; |
458 Panel2.Name = "UserPanel2"; |
459 Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
459 Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
460 Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
460 Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
461 Panel2.idcolor = color; |
461 Panel2.idcolor = color; |
462 //3-Rajout sur la Grid Root |
462 //3-Rajout sur la Grid Root |
463 root.Children.Add(Panel2); |
463 root.Children.Add(Panel2); |
464 break; |
464 break; |
465 case 3: |
465 case 3: |
466 UserControlPivot.ApplyColor(3, color); |
466 UserControlPivot.ApplyColor(3, color); |
467 Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); |
467 Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); |
468 Panel3.Name = "UserPanel3"; |
468 Panel3.Name = "UserPanel3"; |
469 Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
469 Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
470 Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
470 Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
471 Panel3.idcolor = color; |
471 Panel3.idcolor = color; |
472 //3-Rajout sur la Grid Root |
472 //3-Rajout sur la Grid Root |
473 root.Children.Add(Panel3); |
473 root.Children.Add(Panel3); |
474 break; |
474 break; |
475 case 4: |
475 case 4: |
476 UserControlPivot.ApplyColor(4, color); |
476 UserControlPivot.ApplyColor(4, color); |
477 Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode); |
477 Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject); |
478 Panel4.Name = "UserPanel4"; |
478 Panel4.Name = "UserPanel4"; |
479 Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
479 Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
480 Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
480 Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation); |
481 Panel4.idcolor = color; |
481 Panel4.idcolor = color; |
482 //3-Rajout sur la Grid Root |
482 //3-Rajout sur la Grid Root |