src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs
author cavaliet
Wed, 25 Nov 2009 10:49:44 +0100
changeset 231 4eff6b0c9215
parent 208 0699cab5cbb3
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     1
using System;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     2
using System.Collections.Generic;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     3
using System.Linq;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     4
using System.Text;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     5
using System.Windows;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     6
using System.Windows.Controls;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     7
using System.Windows.Data;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     8
using System.Windows.Documents;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
     9
using System.Windows.Input;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    10
using System.Windows.Media;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    11
using System.Windows.Media.Imaging;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    12
using System.Windows.Navigation;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    13
using System.Windows.Shapes;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    14
using FingersDance.Data;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    15
using FingersDance.Control;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    16
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    17
namespace FingersDance.Control.SessionInput
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    18
{
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    19
    /// <summary>
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    20
    /// Interaction logic for UserControlListProject.xaml
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    21
    /// </summary>
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 182
diff changeset
    22
    public partial class UserControlListProject : UserControl
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    23
    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    24
        //Creation d'un Event pour Chaque Item Video
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 182
diff changeset
    25
        public event EventHandler EH_ListProject_ContactDown;
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    26
        public string SelectedItem = "";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    27
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    28
        public UserControlListProject(List<String> projectNames, String AnnotationOrSearchMode)
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    29
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    30
            InitializeComponent();
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    31
            OpenProjects(projectNames, AnnotationOrSearchMode);
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    32
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    33
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    34
        private void OpenProjects(List<String> projectNames, String AnnotationOrSearchMode)
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    35
        {
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    36
            // We add the "new project" item only if we are in "Annotation" mode. Search mode only needs existing projects
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    37
            if (AnnotationOrSearchMode == "Annotation")
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    38
            {
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    39
                CustomListBoxItem Contener = new CustomListBoxItem();
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    40
                Contener.Name = "New Project";
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    41
                UserControlCustomLabel l = new UserControlCustomLabel("New Project");
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    42
                Contener.Content = l;
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    43
                stackPanel.Children.Add(Contener);
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    44
                Contener.ContactTapGesture += Item_ContactTapGesture;
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    45
            }
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 187
diff changeset
    46
            foreach (String projectName in projectNames)
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    47
            {
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    48
                CustomListBoxItem Contener = new CustomListBoxItem();
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 187
diff changeset
    49
                Contener.Name = projectName;
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    50
                UserControlCustomLabel l = new UserControlCustomLabel(projectName);
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    51
                Contener.Content = l;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    52
                stackPanel.Children.Add(Contener);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    53
                Contener.ContactTapGesture += Item_ContactTapGesture;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    54
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    55
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    56
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    57
        //Event appelé lors de la selection d'un Item dans la Liste
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    58
        private void Item_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    59
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    60
            SelectedItem = ((CustomListBoxItem)sender).Name;
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 182
diff changeset
    61
            if (EH_ListProject_ContactDown != null)
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 182
diff changeset
    62
                EH_ListProject_ContactDown(this, new EventArgs());
147
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    63
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    64
    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
diff changeset
    65
}