src/FingersDance.Control.SessionInput/UserControlListSession.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 UserControlListSession.xaml
       
    21     /// </summary>
       
    22     public partial class UserControlListSession
       
    23     {
       
    24         //Creation d'un Event pour Chaque Item Video
       
    25         public event EventHandler EH_List_ContactDown;
       
    26         public string SelectedItem = "";
       
    27 
       
    28         public UserControlListSession(List<Session> sessions)
       
    29         {
       
    30             InitializeComponent();
       
    31             OpenSessions(sessions);
       
    32         }
       
    33 
       
    34         private void OpenSessions(List<Session> sessions)
       
    35         {
       
    36             CustomListBoxItem Contener = new CustomListBoxItem();
       
    37             Contener.Name = "New Session";
       
    38             Label l = new Label();
       
    39             l.Content = "New Session";
       
    40             Contener.Content = l;
       
    41             stackPanel.Children.Add(Contener);
       
    42             Contener.ContactTapGesture += Item_ContactTapGesture;
       
    43             foreach (Session elt in sessions)
       
    44             {
       
    45                 Contener = new CustomListBoxItem();
       
    46                 Contener.Name = elt.Name;
       
    47                 l = new Label();
       
    48                 l.Content = elt.Name;
       
    49                 Contener.Content = l;
       
    50                 stackPanel.Children.Add(Contener);
       
    51                 Contener.ContactTapGesture += Item_ContactTapGesture;
       
    52             }
       
    53         }
       
    54 
       
    55         //Event appelé lors de la selection d'un Item dans la Liste
       
    56         private void Item_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
       
    57         {
       
    58             SelectedItem = ((CustomListBoxItem)sender).Name;
       
    59             if (EH_List_ContactDown != null)
       
    60                 EH_List_ContactDown(this, new EventArgs());
       
    61         }
       
    62     }
       
    63 }