src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs
changeset 147 1a5da89daee9
child 153 3636bb5f4b67
equal deleted inserted replaced
146:dd8ed4d3beb6 147:1a5da89daee9
       
     1 using System;
       
     2 using System.Collections.Generic;
       
     3 using System.Linq;
       
     4 using System.Text;
       
     5 using System.Windows;
       
     6 using System.Windows.Controls;
       
     7 using System.Windows.Data;
       
     8 using System.Windows.Documents;
       
     9 using System.Windows.Input;
       
    10 using System.Windows.Media;
       
    11 using System.Windows.Media.Imaging;
       
    12 using System.Windows.Navigation;
       
    13 using System.Windows.Shapes;
       
    14 using FingersDance.Data;
       
    15 using FingersDance.Control;
       
    16 
       
    17 namespace FingersDance.Control.SessionInput
       
    18 {
       
    19     /// <summary>
       
    20     /// Interaction logic for UserControlListProject.xaml
       
    21     /// </summary>
       
    22     public partial class UserControlListProject
       
    23     {
       
    24         //Creation d'un Event pour Chaque Item Video
       
    25         public event EventHandler EH_Item_ContactDown;
       
    26         public string SelectedItem = "";
       
    27 
       
    28         public UserControlListProject(Dictionary<string, Project> projects)
       
    29         {
       
    30             InitializeComponent();
       
    31             OpenSessions(projects);
       
    32         }
       
    33 
       
    34         private void OpenSessions(Dictionary<string, Project> projects)
       
    35         {
       
    36             try
       
    37             {
       
    38                 CustomListBoxItem Contener = new CustomListBoxItem();
       
    39                 Contener.Name = "New Project";
       
    40                 Label l = new Label();
       
    41                 l.Content = "New Project";
       
    42                 Contener.Content = l;
       
    43                 stackPanel.Children.Add(Contener);
       
    44                 Contener.ContactTapGesture += Item_ContactTapGesture;
       
    45                 foreach (KeyValuePair<string, Project> elt in projects)
       
    46                 {
       
    47                     Contener = new CustomListBoxItem();
       
    48                     Contener.Name = elt.Key;
       
    49                     l = new Label();
       
    50                     l.Content = elt.Key;
       
    51                     Contener.Content = l;
       
    52                     stackPanel.Children.Add(Contener);
       
    53                     Contener.ContactTapGesture += Item_ContactTapGesture;
       
    54                 }
       
    55             }
       
    56             catch (Exception) { }
       
    57         }
       
    58 
       
    59         //Event appelé lors de la selection d'un Item dans la Liste
       
    60         private void Item_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
       
    61         {
       
    62             SelectedItem = ((CustomListBoxItem)sender).Name;
       
    63             if (EH_Item_ContactDown != null)
       
    64                 EH_Item_ContactDown(this, new EventArgs());
       
    65         }
       
    66     }
       
    67 }