src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
author cavaliet
Tue, 10 Nov 2009 13:47:58 +0100
changeset 191 8a25a85f2656
parent 190 619ca3ae13c7
child 192 11083c390ce4
permissions -rw-r--r--
First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
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;
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    11
using FingersDance.Control.ListVideo;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    12
using FingersDance.Control.SessionInput;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    13
using FingersDance.ViewModels;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    14
using FingersDance.Data;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    15
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    16
namespace FingersDance.Control.Screen
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    17
{
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    18
	public partial class UserControlScreen
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    19
	{
82
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    20
        public String contexteGrid;
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
    21
        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
    22
        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
    23
        private MainViewModel _mainViewModel;
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
    24
        public Cutting 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
    25
        private List<Project> existingProjects = new List<Project>();
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    26
        User User = new User();
95
07972aa3f2e0 ListVideo
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 82
diff changeset
    27
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    28
        public UserControlScreen(int id, MainViewModel mvmodel)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    29
        {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    30
            try
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    31
            {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    32
                this.InitializeComponent();
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    33
                this.id = id;
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
    34
                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
    35
                _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
    36
                if (_mainViewModel.Project.VideoPath.Equals(""))
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    37
                {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    38
                    //1-Creation de la ListVideo
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    39
                    UserControlListVideo ListVideo = new UserControlListVideo();
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    40
                    ListVideo.Name = "ListVideo1";
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    41
                    //2-Ajout de la ListVideo au ControlScreen
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    42
                    this.AddToGrid(ListVideo);
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    43
                    //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
    44
                    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
    45
                }
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    46
                else
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    47
                    OpenProject();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    48
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    49
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    50
            {
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
    51
                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
    52
                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
    53
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    54
            }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 112
diff changeset
    55
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    56
82
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    57
        //Rajout un UIElement vers la grid du screen.
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    58
        public void AddToGrid(UIElement uie)
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    59
        {
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    60
            if (uie != null)
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    61
            {
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    62
                try { LayoutRoot.Children.Add(uie); }
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    63
                catch(Exception){}
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    64
            }          
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    65
        }
c37122b567fa Work ControlScreen
sarias
parents: 80
diff changeset
    66
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    67
        private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    68
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    69
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    70
            {
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
    71
                //1 renseigner la video choisie au screen et créer un nouveau projet à partir de ce chemin vidéo
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
    72
                _mainViewModel.CreateProject(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    73
                //2-Supression du UC List Video
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    74
                LayoutRoot.Children.Remove((UserControlListVideo)sender);
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
    75
                OpenProjectList();
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    76
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    77
            catch (Exception ex)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    78
            {
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
    79
                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
    80
                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
    81
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    82
            }
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
    83
        }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    84
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
    85
        private void OpenProjectList()
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    86
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    87
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    88
            {
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
    89
                existingProjects = LoadProjects(_mainViewModel.Project.VideoPath);
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
    90
                UserControlListProject listProject = new UserControlListProject(existingProjects);
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
    91
                listProject.Name = "ListProject";
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
                LayoutRoot.Children.Add(listProject);
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
    93
                listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
    94
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    95
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
    96
            {
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
    97
                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
    98
                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
    99
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   100
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   101
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   102
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
   103
        private List<Project> LoadProjects(string name)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   104
        {
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
   105
            // Does nothing because for the moment we do not load sessions when we know the video path, we just create a new session
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   106
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   107
            {
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
   108
                List<Project> lp = new List<Project>();
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
   109
                foreach (String filename in Directory.GetFiles("./"))
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
   110
                {
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
   111
                    if (filename.Substring(filename.Length-4).ToLower()==".ldt")
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
   112
                        lp.Add(new Project(filename.Substring(2,filename.Length - 6), "", ""));
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
   113
                }
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
   114
                return lp;
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   115
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   116
            catch (Exception) 
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   117
            {
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
   118
                return new List<Project>();
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   119
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   120
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   121
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
   122
        void listProject_EH_ListProject_ContactDown(object sender, EventArgs e)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   123
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   124
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   125
            {
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
   126
                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
   127
                if (((UserControlListProject)sender).SelectedItem.Equals("New Project"))
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   128
                {
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
   129
                    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
   130
                    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
   131
                    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
   132
                    ProjectInput.EH_NewProjectForm_ContactDown += new System.EventHandler(this.ProjectInput_EH_NewProjectForm_ContactDown);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   133
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   134
                else
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   135
                {
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
   136
                    foreach (Project elt in existingProjects)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   137
                    {
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
   138
                        if (elt.Name.Equals(((UserControlListProject)sender).SelectedItem))
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   139
                        {
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
   140
                            _mainViewModel.Project.Project = elt;
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   141
                            OpenProject();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   142
                            return;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   143
                        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   144
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   145
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   146
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   147
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   148
            {
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
   149
                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
   150
                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
   151
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   152
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   153
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   154
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
   155
        private void ProjectInput_EH_NewProjectForm_ContactDown(object sender, EventArgs e)
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   156
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   157
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   158
            {
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
   159
                //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
   160
                //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
   161
                _mainViewModel.Project.Description = ((UserControlNewProjectForm)sender).Description;
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
   162
                _mainViewModel.Project.Name = ((UserControlNewProjectForm)sender).SessionName.Trim();
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   163
                
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
   164
                
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   165
                //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
   166
                LayoutRoot.Children.Remove((UserControlNewProjectForm)sender);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   167
                OpenProject();
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   168
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   169
            catch (Exception ex) 
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   170
            {
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
   171
                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
   172
                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
   173
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   174
            }
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 95
diff changeset
   175
        }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   176
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   177
        private void OpenProject()
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   178
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   179
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   180
            {
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
   181
                UserControlListCutting listCuttings = new UserControlListCutting(_mainViewModel.Project.CuttingsDict);
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
   182
                listCuttings.Name = "listCuttings";
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
   183
                LayoutRoot.Children.Add(listCuttings);
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
   184
                listCuttings.EH_Item_ContactDown += new EventHandler(listCuttings_EH_Item_ContactDown);
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   185
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   186
            catch (Exception) 
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   187
            {
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
   188
                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
   189
                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
   190
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   191
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   192
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   193
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
   194
        void listCuttings_EH_Item_ContactDown(object sender, EventArgs e)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   195
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   196
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   197
            {
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
   198
                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
   199
                if (((UserControlListCutting)sender).SelectedItem.Equals("New Cutting"))
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   200
                {
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
   201
                    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
   202
                    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
   203
                    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
   204
                    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
   205
                }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   206
                else
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   207
                {
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
   208
                    foreach(KeyValuePair<string, Cutting> elt in _mainViewModel.Project.CuttingsDict)
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
   209
                        if (elt.Key.Equals(((UserControlListCutting)sender).SelectedItem))
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   210
                        {
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
   211
                            Cutting = elt.Value;
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
   212
                            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
   213
                                UC_Screen_NewCutting(this, new EventArgs());
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   214
                            return;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   215
                        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   216
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   217
            }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   218
            catch (Exception)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   219
            {
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
                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
   221
                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
   222
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   223
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   224
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   225
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
   226
        void newCutting_EH_ContactDown(object sender, EventArgs e)
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   227
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   228
            try
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   229
            {
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
   230
                LayoutRoot.Children.Remove((UserControlNewCuttingForm)sender);
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
   231
                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
   232
                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
   233
                    UC_Screen_NewCutting(this, new EventArgs());
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   234
            }
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
   235
            catch (Exception)
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   236
            {
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
   237
                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
   238
                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
   239
                    UC_Screen_NewCutting(this, new EventArgs());
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 148
diff changeset
   240
            }
148
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 143
diff changeset
   241
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   242
	}
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   243
}