Debug data management for others panels to redisplay.
authorcavaliet
Wed, 04 Nov 2009 16:28:01 +0100
changeset 186 83615722dbab
parent 185 9b62e08d6167
child 187 b266af50744c
Debug data management for others panels to redisplay.
src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj
src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
src/FingersDance/MainSurfaceWindow.xaml.cs
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Wed Nov 04 13:36:30 2009 +0100
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Wed Nov 04 16:28:01 2009 +0100
@@ -21,7 +21,7 @@
         public int id = 0;
         public event EventHandler UC_Screen_NewCutting;
         public MainViewModel MainViewModel;
-        public CuttingViewModel Cutting;
+        public CuttingViewModel CuttingVM;
         private List<Project> existingProjects = new List<Project>();
         User User = new User();
 
@@ -31,6 +31,7 @@
             {
                 this.InitializeComponent();
                 this.id = id;
+                User.Name = "User " + id;
                 MainViewModel = mvmodel;
                 if (MainViewModel.Project.VideoPath.Equals(""))
                 {
@@ -47,7 +48,7 @@
             }
             catch (Exception)
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
@@ -75,7 +76,7 @@
             }
             catch (Exception ex)
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
@@ -93,7 +94,7 @@
             }
             catch (Exception)
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
@@ -139,7 +140,7 @@
             }
             catch (Exception)
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
@@ -154,13 +155,14 @@
                 MainViewModel.Project.Description = ((UserControlSessionInput)sender).Description;
                 MainViewModel.Project.Name = ((UserControlSessionInput)sender).SessionName;
                 
+                
                 //2-Suppression UCSession Input
                 LayoutRoot.Children.Remove((UserControlSessionInput)sender);
                 OpenProject();
             }
             catch (Exception ex) 
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
@@ -177,7 +179,7 @@
             }
             catch (Exception) 
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
@@ -193,14 +195,14 @@
                     UserControlNewProject newCutting = new UserControlNewProject(User);
                     newCutting.Name = "newCutting";
                     LayoutRoot.Children.Add(newCutting);
-                    newCutting.EH_NewCutting_ContactDown += new EventHandler(newCutting_EH_NewProject_ContactDown);
+                    newCutting.EH_NewCutting_ContactDown += new EventHandler(newCutting_EH_ContactDown);
                 }
                 else
                 {
                     foreach(KeyValuePair<string, Cutting> elt in MainViewModel.Project.CuttingsDict)
                         if (elt.Key.Equals(((UserControlListProject)sender).SelectedItem))
                         {
-                            Cutting = new CuttingViewModel(elt.Value, 815);
+                            CuttingVM = new CuttingViewModel(elt.Value, 815);
                             if (UC_Screen_NewCutting != null)
                                 UC_Screen_NewCutting(this, new EventArgs());
                             return;
@@ -209,26 +211,25 @@
             }
             catch (Exception)
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
         }
 
-        void newCutting_EH_NewProject_ContactDown(object sender, EventArgs e)
+        void newCutting_EH_ContactDown(object sender, EventArgs e)
         {
             try
             {
-                Console.WriteLine("newCutting_EH_NewProject_ContactDown");
                 LayoutRoot.Children.Remove((UserControlNewProject)sender);
-                Cutting = new CuttingViewModel(((UserControlNewProject)sender).Cutting, 850);
-                MainViewModel.Project.CuttingsDict.Add(Cutting.Title, ((UserControlNewProject)sender).Cutting);
+                CuttingVM = new CuttingViewModel(((UserControlNewProject)sender).Cutting, 850);
+                MainViewModel.Project.CuttingsDict.Add(CuttingVM.Title, ((UserControlNewProject)sender).Cutting);
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
             catch (Exception)
             {
-                Cutting = null;
+                CuttingVM = null;
                 if (UC_Screen_NewCutting != null)
                     UC_Screen_NewCutting(this, new EventArgs());
             }
--- a/src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj	Wed Nov 04 13:36:30 2009 +0100
+++ b/src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj	Wed Nov 04 16:28:01 2009 +0100
@@ -140,9 +140,9 @@
       <Project>{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}</Project>
       <Name>FingersDance.Control.TimeLine</Name>
     </ProjectReference>
-    <ProjectReference Include="..\FingersDance.Data\FingersDance.Data.csproj">
-      <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
-      <Name>FingersDance.Data</Name>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Wed Nov 04 13:36:30 2009 +0100
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Wed Nov 04 16:28:01 2009 +0100
@@ -8,7 +8,7 @@
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
 using FingersDance.Control.TimeLine;
-using FingersDance.Data;
+using FingersDance.ViewModels;
 
 namespace FingersDance.Control.SyncSource
 {
@@ -25,11 +25,11 @@
 			// Insert code required on object creation below this point.
 		}
 
-        public void Load(string path, Color col, Cutting projCutting)
+        public void Load(string path, Color col, CuttingViewModel cutVM)
         {
             this.UserControlPlayer.initPlayer(path);
             //Initialisation du Timer
-            UCTimeLine.initTimer(col, projCutting);
+            UCTimeLine.initTimer(col, cutVM);
             this.UserControlPlayer.playerPlay();
             this.userControlTimeLine.OnSuccessAnnotation+=new EventHandler(userControlTimeLine_OnSuccessAnnotation);
             this.UserControlPlayer.PlayerStopOrPause +=new EventHandler(UserControlPlayer_PlayerStopOrPause);
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Wed Nov 04 13:36:30 2009 +0100
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Wed Nov 04 16:28:01 2009 +0100
@@ -136,7 +136,7 @@
         }
 
         #region Timer
-        public void initTimer(Color col, Cutting cutPar)
+        public void initTimer(Color col, CuttingViewModel cutVMPar)
         {
             timer = new DispatcherTimer();
             timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
@@ -151,8 +151,8 @@
             //AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3"));
             //AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4"));
             //AnnotList.Add(new Annotation(120 - (4 * AnnotWidth), 50, "Saut 5"));
-            cutPar = new Cutting("titre de cutting", AnnotList);
-            CuttingVM = new CuttingViewModel(cutPar, AnnotWidth);
+            CuttingVM = new CuttingViewModel(new Cutting(cutVMPar.Title, AnnotList), AnnotWidth);
+            cutVMPar = CuttingVM;
             tv.DataContext = CuttingVM;
 
         }
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Wed Nov 04 13:36:30 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Wed Nov 04 16:28:01 2009 +0100
@@ -53,12 +53,13 @@
 			// Insert code required on object creation below this point.
 		}
 
-        public UserControlUserPanel(int idPar, Color col, Cutting cut, string path)
+        public UserControlUserPanel(int idPar, Color col, CuttingViewModel cutVMPar, string path)
         {
             this.InitializeComponent();
             id = idPar;
             //_Project = p;
-            this.UserControlSyncSource.Load(path, col, cut);
+            cutVM = cutVMPar;
+            this.UserControlSyncSource.Load(path, col, cutVM);
             UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation);
             //SAR -Contact Down event for TAG Control
             InitializeDefinitions();
--- 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;