src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
changeset 152 46577fd0a294
parent 148 c379899e9c94
child 156 e16c8c913c65
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Wed Oct 14 17:42:22 2009 +0200
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Thu Oct 15 02:29:22 2009 +0200
@@ -27,21 +27,30 @@
 
         public UserControlScreen(int id, MainViewModel mvmodel)
         {
-            this.InitializeComponent();
-            this.id = id;
-            MainViewModel = mvmodel;
-            if (MainViewModel.Session.VideoPath.Equals(""))
+            try
             {
-                //1-Creation de la ListVideo
-                UserControlListVideo ListVideo = new UserControlListVideo();
-                ListVideo.Name = "ListVideo1";
-                //2-Ajout de la ListVideo au ControlScreen
-                this.AddToGrid(ListVideo);
-                //3-Creation des Events pour chaque item de la video
-                ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo_EH_ItemVideo_ContactDown);
+                this.InitializeComponent();
+                this.id = id;
+                MainViewModel = mvmodel;
+                if (MainViewModel.Session.VideoPath.Equals(""))
+                {
+                    //1-Creation de la ListVideo
+                    UserControlListVideo ListVideo = new UserControlListVideo();
+                    ListVideo.Name = "ListVideo1";
+                    //2-Ajout de la ListVideo au ControlScreen
+                    this.AddToGrid(ListVideo);
+                    //3-Creation des Events pour chaque item de la video
+                    ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo_EH_ItemVideo_ContactDown);
+                }
+                else
+                    OpenProject();
             }
-            else
-                OpenProject();
+            catch (Exception)
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         //Rajout un UIElement vers la grid du screen.
@@ -64,7 +73,12 @@
                 LayoutRoot.Children.Remove((UserControlListVideo)sender);
                 OpenSession();
             }
-            catch (Exception ex) { }
+            catch (Exception ex)
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         private void OpenSession()
@@ -77,7 +91,12 @@
                 LayoutRoot.Children.Add(listSession);
                 listSession.EH_List_ContactDown += new EventHandler(listSession_EH_List_ContactDown);
             }
-            catch (Exception) { }
+            catch (Exception)
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         private List<Session> LoadSessions(string name)
@@ -117,7 +136,12 @@
                     }
                 }
             }
-            catch (Exception) { }
+            catch (Exception)
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
@@ -133,7 +157,12 @@
                 LayoutRoot.Children.Remove((UserControlSessionInput)sender);
                 OpenProject();
             }
-            catch (Exception ex) { }
+            catch (Exception ex) 
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         private void OpenProject()
@@ -145,7 +174,12 @@
                 LayoutRoot.Children.Add(listProjects);
                 listProjects.EH_Item_ContactDown += new EventHandler(listProjects_EH_Item_ContactDown);
             }
-            catch (Exception) { }
+            catch (Exception) 
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         void listProjects_EH_Item_ContactDown(object sender, EventArgs e)
@@ -172,7 +206,12 @@
                         }
                 }
             }
-            catch (Exception) { }
+            catch (Exception)
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 
         void newProject_EH_NewProject_ContactDown(object sender, EventArgs e)
@@ -185,7 +224,12 @@
                 if (UC_Screen_NewSession != null)
                     UC_Screen_NewSession(this, new EventArgs());
             }
-            catch (Exception) { }
+            catch (Exception) 
+            {
+                Project = null;
+                if (UC_Screen_NewSession != null)
+                    UC_Screen_NewSession(this, new EventArgs());
+            }
         }
 	}
 }
\ No newline at end of file