src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs
author cavaliet
Wed, 25 Nov 2009 10:48:46 +0100
changeset 230 010a2af88bb7
parent 208 0699cab5cbb3
permissions -rw-r--r--
Merge

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FingersDance.Data;
using FingersDance.Control;

namespace FingersDance.Control.SessionInput
{
    /// <summary>
    /// Interaction logic for UserControlListProject.xaml
    /// </summary>
    public partial class UserControlListProject : UserControl
    {
        //Creation d'un Event pour Chaque Item Video
        public event EventHandler EH_ListProject_ContactDown;
        public string SelectedItem = "";

        public UserControlListProject(List<String> projectNames, String AnnotationOrSearchMode)
        {
            InitializeComponent();
            OpenProjects(projectNames, AnnotationOrSearchMode);
        }

        private void OpenProjects(List<String> projectNames, String AnnotationOrSearchMode)
        {
            // We add the "new project" item only if we are in "Annotation" mode. Search mode only needs existing projects
            if (AnnotationOrSearchMode == "Annotation")
            {
                CustomListBoxItem Contener = new CustomListBoxItem();
                Contener.Name = "New Project";
                UserControlCustomLabel l = new UserControlCustomLabel("New Project");
                Contener.Content = l;
                stackPanel.Children.Add(Contener);
                Contener.ContactTapGesture += Item_ContactTapGesture;
            }
            foreach (String projectName in projectNames)
            {
                CustomListBoxItem Contener = new CustomListBoxItem();
                Contener.Name = projectName;
                UserControlCustomLabel l = new UserControlCustomLabel(projectName);
                Contener.Content = l;
                stackPanel.Children.Add(Contener);
                Contener.ContactTapGesture += Item_ContactTapGesture;
            }
        }

        //Event appelé lors de la selection d'un Item dans la Liste
        private void Item_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
        {
            SelectedItem = ((CustomListBoxItem)sender).Name;
            if (EH_ListProject_ContactDown != null)
                EH_ListProject_ContactDown(this, new EventArgs());
        }
    }
}