17 namespace FingersDance.Control.SessionInput |
17 namespace FingersDance.Control.SessionInput |
18 { |
18 { |
19 /// <summary> |
19 /// <summary> |
20 /// Interaction logic for UserControlListProject.xaml |
20 /// Interaction logic for UserControlListProject.xaml |
21 /// </summary> |
21 /// </summary> |
22 public partial class UserControlListProject |
22 public partial class UserControlListProject : UserControl |
23 { |
23 { |
24 //Creation d'un Event pour Chaque Item Video |
24 //Creation d'un Event pour Chaque Item Video |
25 public event EventHandler EH_Item_ContactDown; |
25 public event EventHandler EH_ListProject_ContactDown; |
26 public string SelectedItem = ""; |
26 public string SelectedItem = ""; |
27 |
27 |
28 public UserControlListProject(Dictionary<string, Cutting> cuttings) |
28 public UserControlListProject(List<Project> projects) |
29 { |
29 { |
30 InitializeComponent(); |
30 InitializeComponent(); |
31 OpenSessions(cuttings); |
31 OpenProjects(projects); |
32 } |
32 } |
33 |
33 |
34 private void OpenSessions(Dictionary<string, Cutting> cuttings) |
34 private void OpenProjects(List<Project> projects) |
35 { |
35 { |
36 try |
36 CustomListBoxItem Contener = new CustomListBoxItem(); |
|
37 Contener.Name = "New Project"; |
|
38 UserControlCustomLabel l = new UserControlCustomLabel("New Project"); |
|
39 Contener.Content = l; |
|
40 stackPanel.Children.Add(Contener); |
|
41 Contener.ContactTapGesture += Item_ContactTapGesture; |
|
42 foreach (Project elt in projects) |
37 { |
43 { |
38 CustomListBoxItem Contener = new CustomListBoxItem(); |
44 Contener = new CustomListBoxItem(); |
39 Contener.Name = "New Cutting"; |
45 Contener.Name = elt.Name; |
40 UserControlCustomLabel l = new UserControlCustomLabel("New Cutting"); |
46 l = new UserControlCustomLabel(elt.Name); |
41 Contener.Content = l; |
47 Contener.Content = l; |
42 stackPanel.Children.Add(Contener); |
48 stackPanel.Children.Add(Contener); |
43 Contener.ContactTapGesture += Item_ContactTapGesture; |
49 Contener.ContactTapGesture += Item_ContactTapGesture; |
44 foreach (KeyValuePair<string, Cutting> elt in cuttings) |
|
45 { |
|
46 Contener = new CustomListBoxItem(); |
|
47 Contener.Name = elt.Key; |
|
48 l = new UserControlCustomLabel(elt.Key); |
|
49 Contener.Content = l; |
|
50 stackPanel.Children.Add(Contener); |
|
51 Contener.ContactTapGesture += Item_ContactTapGesture; |
|
52 } |
|
53 } |
50 } |
54 catch (Exception) { } |
|
55 } |
51 } |
56 |
52 |
57 //Event appelé lors de la selection d'un Item dans la Liste |
53 //Event appelé lors de la selection d'un Item dans la Liste |
58 private void Item_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
54 private void Item_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
59 { |
55 { |
60 SelectedItem = ((CustomListBoxItem)sender).Name; |
56 SelectedItem = ((CustomListBoxItem)sender).Name; |
61 if (EH_Item_ContactDown != null) |
57 if (EH_ListProject_ContactDown != null) |
62 EH_Item_ContactDown(this, new EventArgs()); |
58 EH_ListProject_ContactDown(this, new EventArgs()); |
63 } |
59 } |
64 } |
60 } |
65 } |
61 } |