35
|
1 |
using System; |
|
2 |
using System.IO; |
|
3 |
using System.Net; |
|
4 |
using System.Windows; |
|
5 |
using System.Windows.Controls; |
|
6 |
using System.Windows.Data; |
|
7 |
using System.Windows.Media; |
|
8 |
using System.Windows.Media.Animation; |
|
9 |
using System.Windows.Navigation; |
104
|
10 |
using FingersDance.Control.ListVideo; |
|
11 |
using FingersDance.Control.SessionInput; |
143
|
12 |
using FingersDance.ViewModels; |
|
13 |
using FingersDance.Data; |
35
|
14 |
|
|
15 |
namespace FingersDance.Control.Screen |
|
16 |
{ |
|
17 |
public partial class UserControlScreen |
|
18 |
{ |
82
|
19 |
public String contexteGrid; |
112
|
20 |
public int id = 0; |
104
|
21 |
public event EventHandler UC_Screen_NewSession; |
143
|
22 |
public MainViewModel MainViewModel; |
|
23 |
public User User = new User(); |
95
|
24 |
|
143
|
25 |
public UserControlScreen(int id, MainViewModel mvmodel) |
|
26 |
{ |
|
27 |
this.InitializeComponent(); |
112
|
28 |
this.id = id; |
143
|
29 |
MainViewModel = mvmodel; |
|
30 |
|
|
31 |
if (MainViewModel.Session.VideoPath.Equals("")) |
|
32 |
{ |
|
33 |
//1-Creation de la ListVideo |
|
34 |
UserControlListVideo ListVideo = new UserControlListVideo(); |
|
35 |
ListVideo.Name = "ListVideo1"; |
35
|
36 |
|
143
|
37 |
//2-Ajout de la ListVideo au ControlScreen |
|
38 |
this.AddToGrid(ListVideo); |
104
|
39 |
|
143
|
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 |
} |
35
|
46 |
|
82
|
47 |
//Rajout un UIElement vers la grid du screen. |
|
48 |
public void AddToGrid(UIElement uie) |
|
49 |
{ |
|
50 |
if (uie != null) |
|
51 |
{ |
|
52 |
try { LayoutRoot.Children.Add(uie); } |
|
53 |
catch(Exception){} |
|
54 |
} |
|
55 |
} |
|
56 |
|
104
|
57 |
private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) |
|
58 |
{ |
|
59 |
//1-Creation d'une nouvelle seance. |
|
60 |
UserControlSessionInput SessionInput = new UserControlSessionInput(); |
|
61 |
SessionInput.Name = "SessionInput"; |
|
62 |
|
|
63 |
try |
|
64 |
{ |
|
65 |
//2-Recuperer la Grid (Layout root du UC screen)qui contient le UCListVideo et l'ajouter. |
|
66 |
|
|
67 |
LayoutRoot.Children.Add(SessionInput); |
|
68 |
|
|
69 |
//2.5 rensegner la video choisie au screen |
143
|
70 |
if (sender != null) |
|
71 |
MainViewModel.CreateSession(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path); |
|
72 |
|
104
|
73 |
//3-Creation des Events |
|
74 |
SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
75 |
//4-Supression du UC List Video |
|
76 |
LayoutRoot.Children.Remove((UserControlListVideo)sender); |
|
77 |
} |
|
78 |
catch (Exception ex) { } |
|
79 |
} |
143
|
80 |
|
104
|
81 |
private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) |
|
82 |
{ |
|
83 |
try |
|
84 |
{ |
143
|
85 |
//1-Creation du projet |
|
86 |
User = ((UserControlSessionInput)sender).User; |
|
87 |
MainViewModel.CreateProject(User); |
104
|
88 |
//2-Suppression UCSession Input |
|
89 |
LayoutRoot.Children.Remove((UserControlSessionInput)sender); |
|
90 |
//3-Suppression du UC Screen |
|
91 |
if(UC_Screen_NewSession!=null) |
|
92 |
UC_Screen_NewSession(this, new EventArgs()); |
|
93 |
} |
|
94 |
catch (Exception ex) { } |
|
95 |
} |
35
|
96 |
} |
|
97 |
} |