7 using System.Windows.Media; |
7 using System.Windows.Media; |
8 using System.Windows.Media.Animation; |
8 using System.Windows.Media.Animation; |
9 using System.Windows.Navigation; |
9 using System.Windows.Navigation; |
10 using FingersDance.Control.ListVideo; |
10 using FingersDance.Control.ListVideo; |
11 using FingersDance.Control.SessionInput; |
11 using FingersDance.Control.SessionInput; |
|
12 using FingersDance.ViewModels; |
|
13 using FingersDance.Data; |
12 |
14 |
13 namespace FingersDance.Control.Screen |
15 namespace FingersDance.Control.Screen |
14 { |
16 { |
15 public partial class UserControlScreen |
17 public partial class UserControlScreen |
16 { |
18 { |
17 public String contexteGrid; |
19 public String contexteGrid; |
18 public string Path = ""; |
|
19 public int id = 0; |
20 public int id = 0; |
20 public event EventHandler UC_Screen_NewSession; |
21 public event EventHandler UC_Screen_NewSession; |
|
22 public MainViewModel MainViewModel; |
|
23 public User User = new User(); |
21 |
24 |
22 public UserControlScreen(int id) |
25 public UserControlScreen(int id, MainViewModel mvmodel) |
23 { |
26 { |
24 this.InitializeComponent(); |
27 this.InitializeComponent(); |
25 this.id = id; |
28 this.id = id; |
26 //1-Creation de la ListVideo |
29 MainViewModel = mvmodel; |
27 UserControlListVideo ListVideo = new UserControlListVideo(); |
|
28 ListVideo.Name = "ListVideo1"; |
|
29 |
30 |
30 //2-Ajout de la ListVideo au ControlScreen |
31 if (MainViewModel.Session.VideoPath.Equals("")) |
31 this.AddToGrid(ListVideo); |
32 { |
|
33 //1-Creation de la ListVideo |
|
34 UserControlListVideo ListVideo = new UserControlListVideo(); |
|
35 ListVideo.Name = "ListVideo1"; |
32 |
36 |
33 //3-Creation des Events pour chaque item de la video |
37 //2-Ajout de la ListVideo au ControlScreen |
34 ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo_EH_ItemVideo_ContactDown); |
38 this.AddToGrid(ListVideo); |
35 } |
39 |
|
40 //3-Creation des Events pour chaque item de la video |
|
41 ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo_EH_ItemVideo_ContactDown); |
|
42 } |
|
43 else |
|
44 ListVideo_EH_ItemVideo_ContactDown(null, null); |
|
45 } |
36 |
46 |
37 //Rajout un UIElement vers la grid du screen. |
47 //Rajout un UIElement vers la grid du screen. |
38 public void AddToGrid(UIElement uie) |
48 public void AddToGrid(UIElement uie) |
39 { |
49 { |
40 if (uie != null) |
50 if (uie != null) |
44 } |
54 } |
45 } |
55 } |
46 |
56 |
47 private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) |
57 private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) |
48 { |
58 { |
49 |
|
50 //Creation d'un ScatterView Item |
|
51 //ScatterViewItem scatterViewItemSessionInput = new ScatterViewItem(); |
|
52 //scatterViewItemSessionInput.Name = "ScatterViewItemSessionInput"; |
|
53 |
|
54 |
|
55 //1-Creation d'une nouvelle seance. |
59 //1-Creation d'une nouvelle seance. |
56 UserControlSessionInput SessionInput = new UserControlSessionInput(); |
60 UserControlSessionInput SessionInput = new UserControlSessionInput(); |
57 SessionInput.Name = "SessionInput"; |
61 SessionInput.Name = "SessionInput"; |
58 |
62 |
59 try |
63 try |
61 //2-Recuperer la Grid (Layout root du UC screen)qui contient le UCListVideo et l'ajouter. |
65 //2-Recuperer la Grid (Layout root du UC screen)qui contient le UCListVideo et l'ajouter. |
62 |
66 |
63 LayoutRoot.Children.Add(SessionInput); |
67 LayoutRoot.Children.Add(SessionInput); |
64 |
68 |
65 //2.5 rensegner la video choisie au screen |
69 //2.5 rensegner la video choisie au screen |
66 this.Path = ((UserControlListVideo)sender).path; |
70 if (sender != null) |
|
71 MainViewModel.CreateSession(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path); |
|
72 |
67 //3-Creation des Events |
73 //3-Creation des Events |
68 SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
74 SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
69 //4-Supression du UC List Video |
75 //4-Supression du UC List Video |
70 LayoutRoot.Children.Remove((UserControlListVideo)sender); |
76 LayoutRoot.Children.Remove((UserControlListVideo)sender); |
71 |
|
72 //Init Scatter View Properties and Add it to the scatter view. |
|
73 /*scatterViewItemSessionInput.Content = SessionInput; |
|
74 scatterViewItemSessionInput.CanMove = true; |
|
75 scatterViewItemSessionInput.CanScale = false; |
|
76 scatterViewItemSessionInput.CanRotate = true; |
|
77 scatterViewItemSessionInput.Center = new Point((double)actualGrid.ActualWidth,(double)actualGrid.ActualHeight); |
|
78 scaterview.Items.Add(scatterViewItemSessionInput);*/ |
|
79 } |
77 } |
80 catch (Exception ex) { } |
78 catch (Exception ex) { } |
81 } |
79 } |
82 |
80 |
83 private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) |
81 private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) |
84 { |
82 { |
85 try |
83 try |
86 { |
84 { |
|
85 //1-Creation du projet |
|
86 User = ((UserControlSessionInput)sender).User; |
|
87 MainViewModel.CreateProject(User); |
87 //2-Suppression UCSession Input |
88 //2-Suppression UCSession Input |
88 LayoutRoot.Children.Remove((UserControlSessionInput)sender); |
89 LayoutRoot.Children.Remove((UserControlSessionInput)sender); |
89 //3-Suppression du UC Screen |
90 //3-Suppression du UC Screen |
90 if(UC_Screen_NewSession!=null) |
91 if(UC_Screen_NewSession!=null) |
91 UC_Screen_NewSession(this, new EventArgs()); |
92 UC_Screen_NewSession(this, new EventArgs()); |