--- a/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Nov 04 13:36:30 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Nov 04 16:28:01 2009 +0100
@@ -404,22 +404,34 @@
//1-Suppression du UC Screen
Grid root = (Grid)(((UserControlScreen)sender).Parent);
root.Children.Remove(((UserControlScreen)sender));
-
- if (((UserControlScreen)sender).Cutting != null)
+
+ if (((UserControlScreen)sender).CuttingVM != null)
{
//2-Creation du User Panel
- CuttingViewModel newCuttingVM = ((UserControlScreen)sender).Cutting;
+ CuttingViewModel newCuttingVM = ((UserControlScreen)sender).CuttingVM;
- 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)))
- return;
+ // We test if each Panel does not already own the sent cuttingVM
+ if (Panel1 != null)
+ if (Panel1.CuttingVM.Title==newCuttingVM.Title)
+ return;
+ if (Panel2 != null)
+ if (Panel2.CuttingVM.Title == newCuttingVM.Title)
+ return;
+ if (Panel3 != null)
+ if (Panel3.CuttingVM.Title == newCuttingVM.Title)
+ return;
+ if (Panel4 != null)
+ if (Panel4.CuttingVM.Title == newCuttingVM.Title)
+ return;
+ // And now we build the new UserPanel
Random c = new Random();
uint color = (uint)c.Next(12) + 1; // for the number to be >0
switch (((UserControlScreen)sender).id)
{
case 1:
UserControlPivot.ApplyColor(1, color);
- Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
+ Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
Panel1.Name = "UserPanel1";
Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel1.idcolor = color;
@@ -428,7 +440,7 @@
break;
case 2:
UserControlPivot.ApplyColor(2, color);
- Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
+ Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
Panel2.Name = "UserPanel2";
Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel2.idcolor = color;
@@ -437,7 +449,7 @@
break;
case 3:
UserControlPivot.ApplyColor(3, color);
- Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
+ Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
Panel3.Name = "UserPanel3";
Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel3.idcolor = color;
@@ -446,7 +458,7 @@
break;
case 4:
UserControlPivot.ApplyColor(4, color);
- Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
+ Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCuttingVM, _mainviewmodel.Project.VideoPath);
Panel4.Name = "UserPanel4";
Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel4.idcolor = color;