author | cavaliet |
Thu, 19 Nov 2009 18:37:26 +0100 | |
changeset 214 | beebae32b1ed |
parent 211 | 50e6fe2c2ea2 |
child 215 | d13dbcf861d7 |
permissions | -rw-r--r-- |
35 | 1 |
using System; |
2 |
using System.IO; |
|
3 |
using System.Net; |
|
148 | 4 |
using System.Collections.Generic; |
35 | 5 |
using System.Windows; |
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Data; |
|
8 |
using System.Windows.Media; |
|
9 |
using System.Windows.Media.Animation; |
|
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 | 12 |
using FingersDance.Control.ListVideo; |
13 |
using FingersDance.Control.SessionInput; |
|
143 | 14 |
using FingersDance.ViewModels; |
15 |
using FingersDance.Data; |
|
35 | 16 |
|
17 |
namespace FingersDance.Control.Screen |
|
18 |
{ |
|
19 |
public partial class UserControlScreen |
|
20 |
{ |
|
82 | 21 |
public String contexteGrid; |
112 | 22 |
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
|
23 |
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
|
24 |
private MainViewModel _mainViewModel; |
211
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
25 |
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
|
26 |
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
|
27 |
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
|
28 |
|
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 |
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
|
30 |
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
|
31 |
|
148 | 32 |
User User = new User(); |
95 | 33 |
|
143 | 34 |
public UserControlScreen(int id, MainViewModel mvmodel) |
35 |
{ |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
36 |
try |
143 | 37 |
{ |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
38 |
this.InitializeComponent(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
39 |
this.id = id; |
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
182
diff
changeset
|
40 |
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
|
41 |
_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
|
42 |
if (_mainViewModel.Project.VideoPath.Equals("")) |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
43 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
44 |
//1-Creation de la ListVideo |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
45 |
UserControlListVideo ListVideo = new UserControlListVideo(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
46 |
ListVideo.Name = "ListVideo1"; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
47 |
//2-Ajout de la ListVideo au ControlScreen |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
48 |
this.AddToGrid(ListVideo); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
49 |
//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
|
50 |
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
|
51 |
} |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
52 |
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
|
53 |
GetAnnotationOrSearchMode(); |
143 | 54 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
55 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
56 |
{ |
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
|
57 |
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
|
58 |
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
|
59 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
60 |
} |
143 | 61 |
} |
35 | 62 |
|
82 | 63 |
//Rajout un UIElement vers la grid du screen. |
64 |
public void AddToGrid(UIElement uie) |
|
65 |
{ |
|
66 |
if (uie != null) |
|
67 |
{ |
|
68 |
try { LayoutRoot.Children.Add(uie); } |
|
69 |
catch(Exception){} |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
70 |
} |
82 | 71 |
} |
72 |
||
104 | 73 |
private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) |
74 |
{ |
|
75 |
try |
|
76 |
{ |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
77 |
// 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
|
78 |
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
|
79 |
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
|
80 |
// 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
|
81 |
_mainViewModel.Project.VideoPath = videoPath; |
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
82 |
// 2-Supression du UC List Video |
104 | 83 |
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
|
84 |
// 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
|
85 |
GetAnnotationOrSearchMode(); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
86 |
//OpenProjectList(); |
104 | 87 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
88 |
catch (Exception ex) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
89 |
{ |
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
|
90 |
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
|
91 |
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
|
92 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
93 |
} |
104 | 94 |
} |
148 | 95 |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
96 |
private void GetAnnotationOrSearchMode() |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
97 |
{ |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
98 |
UserControlAnnotationOrSearch AnnotOrSearch = new UserControlAnnotationOrSearch(); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
99 |
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
|
100 |
this.AddToGrid(AnnotOrSearch); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
101 |
} |
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 |
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
|
104 |
{ |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
105 |
// We remove the UserControlAnnotationOrSearch |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
106 |
LayoutRoot.Children.Remove((UserControlAnnotationOrSearch)sender); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
107 |
// 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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
114 |
} |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
115 |
|
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
|
116 |
private void OpenProjectList() |
148 | 117 |
{ |
118 |
try |
|
119 |
{ |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
120 |
// We get all the ldt/project files from the current directory... |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
121 |
List<String> existingProjects = new List<String>(); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
122 |
foreach (String filename in Directory.GetFiles("./")) |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
123 |
{ |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
124 |
if (filename.Substring(filename.Length-4).ToLower()==".ldt") |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
125 |
existingProjects.Add(filename.Substring(2, filename.Length - 6)); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
126 |
} |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
127 |
// ... and display them the the select box UserControlListProject |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
128 |
UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
129 |
listProject.Name = "ListProject"; |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
130 |
LayoutRoot.Children.Add(listProject); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
131 |
listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown); |
148 | 132 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
133 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
134 |
{ |
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
|
135 |
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
|
136 |
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
|
137 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
138 |
} |
148 | 139 |
} |
140 |
||
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
|
141 |
void listProject_EH_ListProject_ContactDown(object sender, EventArgs e) |
148 | 142 |
{ |
143 |
try |
|
144 |
{ |
|
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
|
145 |
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
|
146 |
if (((UserControlListProject)sender).SelectedItem.Equals("New Project")) |
148 | 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 |
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
|
149 |
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
|
150 |
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
|
151 |
ProjectInput.EH_NewProjectForm_ContactDown += new System.EventHandler(this.ProjectInput_EH_NewProjectForm_ContactDown); |
148 | 152 |
} |
153 |
else |
|
154 |
{ |
|
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
|
155 |
// ((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
|
156 |
// Now we load the xml/ldt file to load all its datas (cuttings, annotations...) |
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
|
157 |
XDocument loadedLdt = XDocument.Load(((UserControlListProject)sender).SelectedItem + ".ldt"); |
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
|
158 |
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
|
159 |
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
|
160 |
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
|
161 |
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
|
162 |
XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content"); |
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 |
foreach (XElement cuttingNode in cuttingsParentNode.Elements()) |
148 | 164 |
{ |
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
|
165 |
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
|
166 |
foreach (XElement annotNode in cuttingNode.Element("elements").Elements()) |
148 | 167 |
{ |
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 |
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
|
169 |
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
|
170 |
float dur = (float)annotNode.Attribute("dur"); |
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 |
String gt = annotNode.Element("gestureType").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
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
Color c = Color.FromRgb(r, g, b); |
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
|
177 |
la.Add(new Annotation(aId, begin, dur, gt, c)); |
148 | 178 |
} |
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 |
loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la)); |
148 | 180 |
} |
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
|
181 |
// 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
|
182 |
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
|
183 |
_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
|
184 |
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
|
185 |
SearchedProject = loadedProject; |
211
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
186 |
OpenProject(); |
148 | 187 |
} |
188 |
} |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
189 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
190 |
{ |
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
|
191 |
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
|
192 |
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
|
193 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
194 |
} |
148 | 195 |
} |
196 |
||
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
|
197 |
private void ProjectInput_EH_NewProjectForm_ContactDown(object sender, EventArgs e) |
104 | 198 |
{ |
199 |
try |
|
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 |
//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
|
202 |
//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
|
203 |
_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
|
204 |
_mainViewModel.Project.Name = ((UserControlNewProjectForm)sender).ProjectName.Trim(); |
148 | 205 |
|
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
182
diff
changeset
|
206 |
|
104 | 207 |
//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
|
208 |
LayoutRoot.Children.Remove((UserControlNewProjectForm)sender); |
148 | 209 |
OpenProject(); |
104 | 210 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
211 |
catch (Exception ex) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
212 |
{ |
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
|
213 |
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
|
214 |
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
|
215 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
216 |
} |
104 | 217 |
} |
148 | 218 |
|
219 |
private void OpenProject() |
|
220 |
{ |
|
221 |
try |
|
222 |
{ |
|
211
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
223 |
if (AnnotationOrSearchMode == "Annotation") |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
224 |
{ |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
225 |
// 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
|
226 |
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
|
227 |
listCuttings.Name = "listCuttings"; |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
228 |
LayoutRoot.Children.Add(listCuttings); |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
229 |
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
|
230 |
} |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
231 |
else |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
232 |
{ |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
233 |
Cutting = null; |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
234 |
if (UC_Screen_NewCutting != null) |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
235 |
UC_Screen_NewCutting(this, new EventArgs()); |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
236 |
} |
148 | 237 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
238 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
239 |
{ |
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
|
240 |
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
|
241 |
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
|
242 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
243 |
} |
148 | 244 |
} |
245 |
||
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
|
246 |
void listCuttings_EH_Item_ContactDown(object sender, EventArgs e) |
148 | 247 |
{ |
248 |
try |
|
249 |
{ |
|
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
|
250 |
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
|
251 |
if (((UserControlListCutting)sender).SelectedItem.Equals("New Cutting")) |
148 | 252 |
{ |
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
|
253 |
// "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
|
254 |
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
|
255 |
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
|
256 |
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
|
257 |
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
|
258 |
} |
148 | 259 |
else |
260 |
{ |
|
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
|
261 |
// 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
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
return; |
148 | 266 |
} |
267 |
} |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
268 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
269 |
{ |
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
|
270 |
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
|
271 |
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
|
272 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
273 |
} |
148 | 274 |
} |
275 |
||
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
182
diff
changeset
|
276 |
void newCutting_EH_ContactDown(object sender, EventArgs e) |
148 | 277 |
{ |
278 |
try |
|
279 |
{ |
|
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
|
280 |
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
|
281 |
// 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
|
282 |
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
|
283 |
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
|
284 |
UC_Screen_NewCutting(this, new EventArgs()); |
148 | 285 |
} |
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
|
286 |
catch (Exception) |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
287 |
{ |
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
|
288 |
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
|
289 |
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
|
290 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
291 |
} |
148 | 292 |
} |
35 | 293 |
} |
294 |
} |