# HG changeset patch # User PAMPHILE Jonathan # Date 1255521751 -7200 # Node ID c379899e9c947eb17728bf656d4c0dd818039f4d # Parent 1a5da89daee972cc210c6185d2df5798188d29fd MVVM diff -r 1a5da89daee9 -r c379899e9c94 .hgignore --- a/.hgignore Wed Oct 14 13:45:55 2009 +0200 +++ b/.hgignore Wed Oct 14 14:02:31 2009 +0200 @@ -36,4 +36,4 @@ glob:desktop.ini glob:*.orig glob:src\FingersDance\Resources\videos.xml -relre:glob:*.wmv +glob:*.wmv diff -r 1a5da89daee9 -r c379899e9c94 src/FingersDance.Control.Screen/UserControlScreen.xaml.cs --- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Wed Oct 14 13:45:55 2009 +0200 +++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Wed Oct 14 14:02:31 2009 +0200 @@ -1,6 +1,7 @@ using System; using System.IO; using System.Net; +using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -20,28 +21,27 @@ public int id = 0; public event EventHandler UC_Screen_NewSession; public MainViewModel MainViewModel; - public User User = new User(); + public ProjectViewModel Project = new ProjectViewModel(); + List sessions = new List(); + User User = new User(); public UserControlScreen(int id, MainViewModel mvmodel) { 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 - ListVideo_EH_ItemVideo_ContactDown(null, null); + OpenProject(); } //Rajout un UIElement vers la grid du screen. @@ -56,42 +56,136 @@ private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) { - //1-Creation d'une nouvelle seance. - UserControlSessionInput SessionInput = new UserControlSessionInput(); - SessionInput.Name = "SessionInput"; - try { - //2-Recuperer la Grid (Layout root du UC screen)qui contient le UCListVideo et l'ajouter. - - LayoutRoot.Children.Add(SessionInput); - - //2.5 rensegner la video choisie au screen - if (sender != null) - MainViewModel.CreateSession(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path); - - //3-Creation des Events - SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); - //4-Supression du UC List Video + //1 rensegner la video choisie au screen + MainViewModel.CreateSession(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path); + //2-Supression du UC List Video LayoutRoot.Children.Remove((UserControlListVideo)sender); + OpenSession(); } catch (Exception ex) { } } - + + private void OpenSession() + { + try + { + sessions = LoadSessions(MainViewModel.Session.VideoPath); + UserControlListSession listSession = new UserControlListSession(sessions); + listSession.Name = "ListSession"; + LayoutRoot.Children.Add(listSession); + listSession.EH_List_ContactDown += new EventHandler(listSession_EH_List_ContactDown); + } + catch (Exception) { } + } + + private List LoadSessions(string name) + { + try + { + return new List(); + } + catch (Exception) + { + return new List(); + } + } + + void listSession_EH_List_ContactDown(object sender, EventArgs e) + { + try + { + LayoutRoot.Children.Remove((UserControlListSession)sender); + if (((UserControlListSession)sender).SelectedItem.Equals("New Session")) + { + UserControlSessionInput SessionInput = new UserControlSessionInput(); + SessionInput.Name = "SessionInput"; + LayoutRoot.Children.Add(SessionInput); + SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); + } + else + { + foreach (Session elt in sessions) + { + if (elt.Name.Equals(((UserControlListSession)sender).SelectedItem)) + { + MainViewModel.Session.Projects = elt.Projects; + OpenProject(); + return; + } + } + } + } + catch (Exception) { } + } + private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) { try { - //1-Creation du projet - User = ((UserControlSessionInput)sender).User; - MainViewModel.CreateProject(User); + MainViewModel.Session.Alias = ((UserControlSessionInput)sender).Alias; + MainViewModel.Session.Email = ((UserControlSessionInput)sender).Email; + MainViewModel.Session.Description = ((UserControlSessionInput)sender).Description; + MainViewModel.Session.Name = ((UserControlSessionInput)sender).Name; + //2-Suppression UCSession Input LayoutRoot.Children.Remove((UserControlSessionInput)sender); - //3-Suppression du UC Screen - if(UC_Screen_NewSession!=null) - UC_Screen_NewSession(this, new EventArgs()); + OpenProject(); } catch (Exception ex) { } } + + private void OpenProject() + { + try + { + UserControlListProject listProjects = new UserControlListProject(MainViewModel.Session.Projects); + listProjects.Name = "ListProjects"; + LayoutRoot.Children.Add(listProjects); + listProjects.EH_Item_ContactDown += new EventHandler(listProjects_EH_Item_ContactDown); + } + catch (Exception) { } + } + + void listProjects_EH_Item_ContactDown(object sender, EventArgs e) + { + try + { + LayoutRoot.Children.Remove((UserControlListProject)sender); + if (((UserControlListProject)sender).SelectedItem.Equals("New Project")) + { + UserControlNewProject newProject = new UserControlNewProject(User); + newProject.Name = "newProject"; + LayoutRoot.Children.Add(newProject); + newProject.EH_NewProject_ContactDown += new EventHandler(newProject_EH_NewProject_ContactDown); + } + else + { + foreach(KeyValuePair elt in MainViewModel.Session.Projects) + if (elt.Key.Equals(((UserControlListProject)sender).SelectedItem)) + { + Project = new ProjectViewModel(elt.Value); + if (UC_Screen_NewSession != null) + UC_Screen_NewSession(this, new EventArgs()); + return; + } + } + } + catch (Exception) { } + } + + void newProject_EH_NewProject_ContactDown(object sender, EventArgs e) + { + try + { + LayoutRoot.Children.Remove((UserControlNewProject)sender); + Project = new ProjectViewModel(((UserControlNewProject)sender).Project); + MainViewModel.Session.Projects.Add(Project.Name, Project.Project); + if (UC_Screen_NewSession != null) + UC_Screen_NewSession(this, new EventArgs()); + } + catch (Exception) { } + } } } \ No newline at end of file diff -r 1a5da89daee9 -r c379899e9c94 src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj --- a/src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj Wed Oct 14 13:45:55 2009 +0200 +++ b/src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj Wed Oct 14 14:02:31 2009 +0200 @@ -70,9 +70,18 @@ - - - + + 3.0 + + + 3.0 + + + 3.0 + + + 3.0 + @@ -80,6 +89,18 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -109,6 +130,15 @@ True Settings.settings + + UserControlListProject.xaml + + + UserControlListSession.xaml + + + UserControlNewProject.xaml + @@ -125,6 +155,10 @@ + + {4DC517DD-1601-481E-BAAC-6FE271417F46} + FingersDance.Control + {EAF384DB-2AE4-4132-839D-60F9DAFDEAD8} FingersDance.Data diff -r 1a5da89daee9 -r c379899e9c94 src/FingersDance.Control.SessionInput/UserControlSessionInput.xaml --- a/src/FingersDance.Control.SessionInput/UserControlSessionInput.xaml Wed Oct 14 13:45:55 2009 +0200 +++ b/src/FingersDance.Control.SessionInput/UserControlSessionInput.xaml Wed Oct 14 14:02:31 2009 +0200 @@ -4,10 +4,13 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - xmlns:Custom="http://schemas.microsoft.com/surface/2008" xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic" + xmlns:Custom="http://schemas.microsoft.com/surface/2008" + xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic" x:Class="FingersDance.Control.SessionInput.UserControlSessionInput" x:Name="UserControl" - Background="#FFA09E9E" Width="256" Height="192"> + Background="#FFA09E9E" + Width="256" + Height="192">