src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
author cavaliet
Tue, 24 Nov 2009 22:08:57 +0100
changeset 229 05aba5def1fc
parent 225 b60e13ed75c8
permissions -rw-r--r--
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     1
using System;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     2
using System.IO;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     3
using System.Net;
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
     4
using System.Collections.Generic;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     5
using System.Windows;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     6
using System.Windows.Controls;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     7
using System.Windows.Data;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     8
using System.Windows.Media;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     9
using System.Windows.Media.Animation;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    10
using System.Windows.Navigation;
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: 191
diff changeset
    11
using System.Xml.Linq;
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    12
using FingersDance.Control.ListVideo;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    13
using FingersDance.Control.SessionInput;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    14
using FingersDance.ViewModels;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    15
using FingersDance.Data;
215
d13dbcf861d7 BOutton annotation, tag volume, chargement des annotations sauvegardées du projet dans le dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 214
diff changeset
    16
using FingersDance.Factory;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    17
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    18
namespace FingersDance.Control.Screen
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    19
{
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    20
	public partial class UserControlScreen
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    21
	{
82
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    22
        public String contexteGrid;
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
    23
        public int id = 0;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
    24
        public event EventHandler UC_Screen_NewCutting;
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
    25
        private MainViewModel _mainViewModel;
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
    26
        public String AnnotationOrSearchMode;
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
    27
        public Project SearchedProject;
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
    28
        public Cutting Cutting;
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: 191
diff changeset
    29
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: 191
diff changeset
    30
        private String videoName;
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: 191
diff changeset
    31
        private String videoPath;
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: 191
diff changeset
    32
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    33
        User User = new User();
95
07972aa3f2e0 ListVideo
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 82
diff changeset
    34
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    35
        public UserControlScreen(int id, MainViewModel mvmodel)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    36
        {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    37
            try
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    38
            {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    39
                this.InitializeComponent();
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    40
                this.id = id;
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
    41
                User.Name = "User " + id;
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
    42
                _mainViewModel = mvmodel;
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
    43
                if (_mainViewModel.Project.VideoPath.Equals(""))
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    44
                {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    45
                    //1-Creation de la ListVideo
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    46
                    UserControlListVideo ListVideo = new UserControlListVideo();
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    47
                    ListVideo.Name = "ListVideo1";
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    48
                    //2-Ajout de la ListVideo au ControlScreen
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    49
                    this.AddToGrid(ListVideo);
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    50
                    //3-Creation des Events pour chaque item de la video
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
    51
                    ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(ListVideo_EH_ItemVideo_ContactDown);
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    52
                }
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    53
                else
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
    54
                    GetAnnotationOrSearchMode();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    55
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    56
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    57
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
    58
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
    59
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
    60
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    61
            }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    62
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    63
82
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    64
        //Rajout un UIElement vers la grid du screen.
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    65
        public void AddToGrid(UIElement uie)
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    66
        {
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    67
            if (uie != null)
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    68
            {
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    69
                try { LayoutRoot.Children.Add(uie); }
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    70
                catch(Exception){}
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    71
            }
82
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    72
        }
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    73
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    74
        private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    75
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    76
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    77
            {
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    78
                // 1- renseigner la video choisie au screen et créer un nouveau projet à partir de ce chemin vidéo
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: 191
diff changeset
    79
                videoName = ((UserControlListVideo)sender).VideoName;
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: 191
diff changeset
    80
                videoPath = ((UserControlListVideo)sender).path;
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
    81
                // We initialize it in _mainViewModel for it to remembered in every place of the application
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
    82
                _mainViewModel.Project.VideoPath = videoPath;
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    83
                // 2-Supression du UC List Video
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    84
                LayoutRoot.Children.Remove((UserControlListVideo)sender);
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    85
                // 3 - Choose between Annotation Or Search Mode
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    86
                GetAnnotationOrSearchMode();
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    87
                //OpenProjectList();
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    88
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    89
            catch (Exception ex)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    90
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
    91
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
    92
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
    93
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    94
            }
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    95
        }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    96
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    97
        private void GetAnnotationOrSearchMode()
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    98
        {
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
    99
            UserControlAnnotationOrSearch AnnotOrSearch = new UserControlAnnotationOrSearch();
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   100
            AnnotOrSearch.ModeChosen += new EventHandler<AnnotationOrSearchEventArg>(AnnotOrSearch_ModeChosen);
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   101
            this.AddToGrid(AnnotOrSearch);
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   102
        }
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   103
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   104
        void AnnotOrSearch_ModeChosen(object sender, AnnotationOrSearchEventArg e)
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   105
        {
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   106
            // We remove the UserControlAnnotationOrSearch
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   107
            LayoutRoot.Children.Remove((UserControlAnnotationOrSearch)sender);
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   108
            // We show the project list and send the chosen mode
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   109
            AnnotationOrSearchMode = e.ChosenMode;
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   110
            if (AnnotationOrSearchMode == "Annotation" && _mainViewModel.Project.Cuttings.Count!=0)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   111
                OpenProject();
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   112
            else
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   113
                OpenProjectList();
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   114
208
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   115
        }
0699cab5cbb3 first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents: 192
diff changeset
   116
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   117
        private void OpenProjectList()
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   118
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   119
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   120
            {
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   121
                // We get all the ldt/project files from the current directory...
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   122
                List<String> existingProjects = new List<String>();
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   123
                String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   124
                String ext = ".ldt";
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   125
                foreach (String filename in Directory.GetFiles(path))
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   126
                {
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   127
                    if (filename.Substring(filename.Length-4).ToLower()==ext)
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   128
                        existingProjects.Add(filename.Substring(path.Length + 1, filename.Length - ext.Length - path.Length - 1));
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   129
                }
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   130
                // ... and display them the the select box UserControlListProject
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   131
                UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   132
                listProject.Name = "ListProject";
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   133
                LayoutRoot.Children.Add(listProject);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   134
                listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   135
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   136
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   137
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   138
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   139
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   140
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   141
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   142
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   143
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   144
        void listProject_EH_ListProject_ContactDown(object sender, EventArgs e)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   145
        {
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   146
            //try
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   147
            //{
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   148
                LayoutRoot.Children.Remove((UserControlListProject)sender);
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   149
                if (((UserControlListProject)sender).SelectedItem.Equals("New Project"))
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   150
                {
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   151
                    UserControlNewProjectForm ProjectInput = new UserControlNewProjectForm();
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   152
                    ProjectInput.Name = "ProjectInput";
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   153
                    LayoutRoot.Children.Add(ProjectInput);
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   154
                    ProjectInput.EH_NewProjectForm_ContactDown += new System.EventHandler(this.ProjectInput_EH_NewProjectForm_ContactDown);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   155
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   156
                else
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   157
                {
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: 191
diff changeset
   158
                    // ((UserControlListProject)sender).SelectedItem is the name of the selected project
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: 191
diff changeset
   159
                    // Now we load the xml/ldt file to load all its datas (cuttings, annotations...)
223
90d2be5c3d39 commit with changes for real table file management
cavaliet
parents: 215
diff changeset
   160
                    String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/" + ((UserControlListProject)sender).SelectedItem + ".ldt";
90d2be5c3d39 commit with changes for real table file management
cavaliet
parents: 215
diff changeset
   161
                    XDocument loadedLdt = XDocument.Load(path);
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   162
                    Project loadedProject = new Project(videoName, _mainViewModel.Project.VideoPath); // we use this video in the case an other panel was in search mode before annotation mode
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: 191
diff changeset
   163
                    loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value;
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: 191
diff changeset
   164
                    loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value;
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: 191
diff changeset
   165
                    loadedProject.Cuttings = new List<Cutting>();
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: 191
diff changeset
   166
                    XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content");
215
d13dbcf861d7 BOutton annotation, tag volume, chargement des annotations sauvegardées du projet dans le dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 214
diff changeset
   167
                    DataDictionary Data = (new DataFactory()).Data;
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: 191
diff changeset
   168
                    foreach (XElement cuttingNode in cuttingsParentNode.Elements())
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   169
                    {
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: 191
diff changeset
   170
                        List<Annotation> la = new List<Annotation>();
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: 191
diff changeset
   171
                        foreach (XElement annotNode in cuttingNode.Element("elements").Elements())
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   172
                        {
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: 191
diff changeset
   173
                            String aId = annotNode.Attribute("id").Value;
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: 191
diff changeset
   174
                            float begin = (float)annotNode.Attribute("begin");
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: 191
diff changeset
   175
                            float dur = (float)annotNode.Attribute("dur");
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 223
diff changeset
   176
                            String[] gt = annotNode.Element("gestureType").Value.Split(new Char[] { ',' });
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 223
diff changeset
   177
                            List<String> gtList = new List<String>();
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 223
diff changeset
   178
                            gtList.AddRange(gt);
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: 191
diff changeset
   179
                            String colorString = annotNode.Attribute("color").Value; // is type 0xRRGGBB
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: 191
diff changeset
   180
                            Byte r = Convert.ToByte(colorString.Substring(2, 2), 16);
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: 191
diff changeset
   181
                            Byte g = Convert.ToByte(colorString.Substring(4, 2), 16);
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: 191
diff changeset
   182
                            Byte b = Convert.ToByte(colorString.Substring(6, 2), 16);
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: 191
diff changeset
   183
                            Color c = Color.FromRgb(r, g, b);
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 223
diff changeset
   184
                            Annotation Annotation = new Annotation(aId, begin, dur, gtList, c);
215
d13dbcf861d7 BOutton annotation, tag volume, chargement des annotations sauvegardées du projet dans le dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 214
diff changeset
   185
                            la.Add(Annotation);
d13dbcf861d7 BOutton annotation, tag volume, chargement des annotations sauvegardées du projet dans le dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 214
diff changeset
   186
                            Data.AddAnnotation(Annotation);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   187
                        }
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   188
                        String cutColorString = cuttingNode.Attribute("color").Value; // is type 0xRRGGBB
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   189
                        Byte rCut = Convert.ToByte(cutColorString.Substring(2, 2), 16);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   190
                        Byte gCut = Convert.ToByte(cutColorString.Substring(4, 2), 16);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   191
                        Byte bCut = Convert.ToByte(cutColorString.Substring(6, 2), 16);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   192
                        Color cCut = Color.FromRgb(rCut, gCut, bCut);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   193
                        // We take off the loaded color from the reference color list.
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   194
                        ColorFactory.TakeOffColor(cCut);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   195
                        // We add the cutting to the loaded project
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   196
                        loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value, cuttingNode.Element("title").Value, la, cCut));
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   197
                    }
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   198
                    // We define the loaded project as the current session's project in annotation mode or the searched project in search mode
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   199
                    if (AnnotationOrSearchMode == "Annotation")
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   200
                        _mainViewModel.Project = new ProjectViewModel(loadedProject);
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   201
                    else
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   202
                        SearchedProject = loadedProject;
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   203
                    OpenProject();
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   204
                }
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   205
            //}
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   206
            //catch (Exception)
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   207
            //{
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   208
            //    Cutting = null;
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   209
            //    if (UC_Screen_NewCutting != null)
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   210
            //        UC_Screen_NewCutting(this, new EventArgs());
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   211
            //}
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   212
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   213
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   214
        private void ProjectInput_EH_NewProjectForm_ContactDown(object sender, EventArgs e)
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   215
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   216
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   217
            {
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   218
                //MainViewModel.Project.Alias = ((UserControlNewProjectForm)sender).Alias;
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   219
                //MainViewModel.Project.Email = ((UserControlNewProjectForm)sender).Email;
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   220
                _mainViewModel.Project.Description = ((UserControlNewProjectForm)sender).Description;
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: 191
diff changeset
   221
                _mainViewModel.Project.Name = ((UserControlNewProjectForm)sender).ProjectName.Trim();
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   222
                
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
   223
                
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   224
                //2-Suppression UCSession Input
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   225
                LayoutRoot.Children.Remove((UserControlNewProjectForm)sender);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   226
                OpenProject();
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   227
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   228
            catch (Exception ex) 
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   229
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   230
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   231
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   232
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   233
            }
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   234
        }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   235
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   236
        private void OpenProject()
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   237
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   238
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   239
            {
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   240
                if (AnnotationOrSearchMode == "Annotation")
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   241
                {
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   242
                    // We display the list of cuttings available for the current project
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   243
                    UserControlListCutting listCuttings = new UserControlListCutting(_mainViewModel.Project.CuttingsDict);
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   244
                    listCuttings.Name = "listCuttings";
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   245
                    LayoutRoot.Children.Add(listCuttings);
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   246
                    listCuttings.EH_Item_ContactDown += new EventHandler(listCuttings_EH_Item_ContactDown);
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   247
                }
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   248
                else
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   249
                {
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   250
                    Cutting = null;
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   251
                    if (UC_Screen_NewCutting != null)
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   252
                        UC_Screen_NewCutting(this, new EventArgs());
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 208
diff changeset
   253
                }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   254
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   255
            catch (Exception) 
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   256
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   257
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   258
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   259
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   260
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   261
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   262
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   263
        void listCuttings_EH_Item_ContactDown(object sender, EventArgs e)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   264
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   265
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   266
            {
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   267
                LayoutRoot.Children.Remove((UserControlListCutting)sender);
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   268
                if (((UserControlListCutting)sender).SelectedItem.Equals("New Cutting"))
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   269
                {
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   270
                    // "New Cutting" was was selected -> we display the form
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   271
                    UserControlNewCuttingForm newCutting = new UserControlNewCuttingForm(User);
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   272
                    newCutting.Name = "newCutting";
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   273
                    LayoutRoot.Children.Add(newCutting);
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   274
                    newCutting.EH_NewCuttingForm_ContactDown += new EventHandler(newCutting_EH_ContactDown);
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   275
                }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   276
                else
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   277
                {
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: 191
diff changeset
   278
                    // An already existing project was clicked -> we load the selected project from the dictionnary
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: 191
diff changeset
   279
                    Cutting = _mainViewModel.Project.CuttingsDict[((UserControlListCutting)sender).SelectedItem];
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: 191
diff changeset
   280
                    if (UC_Screen_NewCutting != null)
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: 191
diff changeset
   281
                        UC_Screen_NewCutting(this, new EventArgs());
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: 191
diff changeset
   282
                    return;
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   283
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   284
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   285
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   286
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   287
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   288
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   289
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   290
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   291
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   292
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
   293
        void newCutting_EH_ContactDown(object sender, EventArgs e)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   294
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   295
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   296
            {
187
b266af50744c Change file and event names for code to be clearer and more coherent with the project and cuttings organisation
cavaliet
parents: 186
diff changeset
   297
                LayoutRoot.Children.Remove((UserControlNewCuttingForm)sender);
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: 191
diff changeset
   298
                // The new cutting form sent the cutting instance so we can dispatch the event UC_Screen_NewCutting
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   299
                Cutting = ((UserControlNewCuttingForm)sender).Cutting;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   300
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   301
                    UC_Screen_NewCutting(this, new EventArgs());
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   302
            }
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   303
            catch (Exception)
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   304
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 187
diff changeset
   305
                Cutting = null;
182
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   306
                if (UC_Screen_NewCutting != null)
25b49d4f1635 First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents: 156
diff changeset
   307
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   308
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   309
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   310
	}
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   311
}