author | cavaliet |
Thu, 19 Nov 2009 12:15:12 +0100 | |
changeset 211 | 50e6fe2c2ea2 |
parent 208 | 0699cab5cbb3 |
child 214 | beebae32b1ed |
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; |
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
|
26 |
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
|
27 |
|
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 |
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
|
29 |
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
|
30 |
|
148 | 31 |
User User = new User(); |
95 | 32 |
|
143 | 33 |
public UserControlScreen(int id, MainViewModel mvmodel) |
34 |
{ |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
35 |
try |
143 | 36 |
{ |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
37 |
this.InitializeComponent(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
38 |
this.id = id; |
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
182
diff
changeset
|
39 |
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
|
40 |
_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
|
41 |
if (_mainViewModel.Project.VideoPath.Equals("")) |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
42 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
43 |
//1-Creation de la ListVideo |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
44 |
UserControlListVideo ListVideo = new UserControlListVideo(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
45 |
ListVideo.Name = "ListVideo1"; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
46 |
//2-Ajout de la ListVideo au ControlScreen |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
47 |
this.AddToGrid(ListVideo); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
48 |
//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
|
49 |
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
|
50 |
} |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
51 |
else |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
52 |
OpenProject(); |
143 | 53 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
54 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
55 |
{ |
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
|
56 |
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
|
57 |
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
|
58 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
59 |
} |
143 | 60 |
} |
35 | 61 |
|
82 | 62 |
//Rajout un UIElement vers la grid du screen. |
63 |
public void AddToGrid(UIElement uie) |
|
64 |
{ |
|
65 |
if (uie != null) |
|
66 |
{ |
|
67 |
try { LayoutRoot.Children.Add(uie); } |
|
68 |
catch(Exception){} |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
69 |
} |
82 | 70 |
} |
71 |
||
104 | 72 |
private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e) |
73 |
{ |
|
74 |
try |
|
75 |
{ |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
76 |
// 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
|
77 |
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
|
78 |
videoPath = ((UserControlListVideo)sender).path; |
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
79 |
// 2-Supression du UC List Video |
104 | 80 |
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
|
81 |
// 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
|
82 |
GetAnnotationOrSearchMode(); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
83 |
//OpenProjectList(); |
104 | 84 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
85 |
catch (Exception ex) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
86 |
{ |
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
|
87 |
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
|
88 |
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
|
89 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
90 |
} |
104 | 91 |
} |
148 | 92 |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
93 |
private void GetAnnotationOrSearchMode() |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
94 |
{ |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
95 |
UserControlAnnotationOrSearch AnnotOrSearch = new UserControlAnnotationOrSearch(); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
96 |
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
|
97 |
this.AddToGrid(AnnotOrSearch); |
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 |
|
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
100 |
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
|
101 |
{ |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
102 |
// We remove the UserControlAnnotationOrSearch |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
103 |
LayoutRoot.Children.Remove((UserControlAnnotationOrSearch)sender); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
104 |
// 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
|
105 |
AnnotationOrSearchMode = e.ChosenMode; |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
106 |
OpenProjectList(); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
107 |
} |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
108 |
|
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
|
109 |
private void OpenProjectList() |
148 | 110 |
{ |
111 |
try |
|
112 |
{ |
|
208
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
113 |
// First We create the project if we are in annotation mode |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
114 |
if(AnnotationOrSearchMode=="Annotation") |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
115 |
_mainViewModel.CreateProject(videoName, videoPath); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
116 |
// 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
|
117 |
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
|
118 |
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
|
119 |
{ |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
120 |
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
|
121 |
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
|
122 |
} |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
123 |
// ... 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
|
124 |
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
|
125 |
listProject.Name = "ListProject"; |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
126 |
LayoutRoot.Children.Add(listProject); |
0699cab5cbb3
first step of search mode : add choice panel and integrate the annotation mode.
cavaliet
parents:
192
diff
changeset
|
127 |
listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown); |
148 | 128 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
129 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
130 |
{ |
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
|
131 |
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
|
132 |
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
|
133 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
134 |
} |
148 | 135 |
} |
136 |
||
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
|
137 |
void listProject_EH_ListProject_ContactDown(object sender, EventArgs e) |
148 | 138 |
{ |
139 |
try |
|
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 |
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
|
142 |
if (((UserControlListProject)sender).SelectedItem.Equals("New Project")) |
148 | 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 |
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
|
145 |
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
|
146 |
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
|
147 |
ProjectInput.EH_NewProjectForm_ContactDown += new System.EventHandler(this.ProjectInput_EH_NewProjectForm_ContactDown); |
148 | 148 |
} |
149 |
else |
|
150 |
{ |
|
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
|
151 |
// ((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
|
152 |
// 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
|
153 |
XDocument loadedLdt = XDocument.Load(((UserControlListProject)sender).SelectedItem + ".ldt"); |
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
|
154 |
Project loadedProject = new Project(videoName, 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
|
155 |
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
|
156 |
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
|
157 |
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
|
158 |
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
|
159 |
foreach (XElement cuttingNode in cuttingsParentNode.Elements()) |
148 | 160 |
{ |
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
|
161 |
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
|
162 |
foreach (XElement annotNode in cuttingNode.Element("elements").Elements()) |
148 | 163 |
{ |
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
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
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
|
168 |
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
|
169 |
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
|
170 |
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
|
171 |
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
|
172 |
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
|
173 |
la.Add(new Annotation(aId, begin, dur, gt, c)); |
148 | 174 |
} |
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
|
175 |
loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la)); |
148 | 176 |
} |
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
|
177 |
// We define the loaded project as the current session's project. |
211
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
178 |
_mainViewModel.Project = new ProjectViewModel(loadedProject); |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
179 |
OpenProject(); |
148 | 180 |
} |
181 |
} |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
182 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
183 |
{ |
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
|
184 |
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
|
185 |
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
|
186 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
187 |
} |
148 | 188 |
} |
189 |
||
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
|
190 |
private void ProjectInput_EH_NewProjectForm_ContactDown(object sender, EventArgs e) |
104 | 191 |
{ |
192 |
try |
|
193 |
{ |
|
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
|
194 |
//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
|
195 |
//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
|
196 |
_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
|
197 |
_mainViewModel.Project.Name = ((UserControlNewProjectForm)sender).ProjectName.Trim(); |
148 | 198 |
|
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
182
diff
changeset
|
199 |
|
104 | 200 |
//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
|
201 |
LayoutRoot.Children.Remove((UserControlNewProjectForm)sender); |
148 | 202 |
OpenProject(); |
104 | 203 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
204 |
catch (Exception ex) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
205 |
{ |
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
|
206 |
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
|
207 |
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
|
208 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
209 |
} |
104 | 210 |
} |
148 | 211 |
|
212 |
private void OpenProject() |
|
213 |
{ |
|
214 |
try |
|
215 |
{ |
|
211
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
216 |
if (AnnotationOrSearchMode == "Annotation") |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
217 |
{ |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
218 |
// 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
|
219 |
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
|
220 |
listCuttings.Name = "listCuttings"; |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
221 |
LayoutRoot.Children.Add(listCuttings); |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
222 |
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
|
223 |
} |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
224 |
else |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
225 |
{ |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
226 |
Cutting = null; |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
227 |
if (UC_Screen_NewCutting != null) |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
228 |
UC_Screen_NewCutting(this, new EventArgs()); |
50e6fe2c2ea2
second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents:
208
diff
changeset
|
229 |
} |
148 | 230 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
231 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
232 |
{ |
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
|
233 |
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
|
234 |
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
|
235 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
236 |
} |
148 | 237 |
} |
238 |
||
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
|
239 |
void listCuttings_EH_Item_ContactDown(object sender, EventArgs e) |
148 | 240 |
{ |
241 |
try |
|
242 |
{ |
|
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
|
243 |
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
|
244 |
if (((UserControlListCutting)sender).SelectedItem.Equals("New Cutting")) |
148 | 245 |
{ |
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
|
246 |
// "New Uutting" 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
|
247 |
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
|
248 |
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
|
249 |
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
|
250 |
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
|
251 |
} |
148 | 252 |
else |
253 |
{ |
|
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
|
254 |
// 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
|
255 |
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
|
256 |
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
|
257 |
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
|
258 |
return; |
148 | 259 |
} |
260 |
} |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
261 |
catch (Exception) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
262 |
{ |
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
|
263 |
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
|
264 |
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
|
265 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
266 |
} |
148 | 267 |
} |
268 |
||
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
182
diff
changeset
|
269 |
void newCutting_EH_ContactDown(object sender, EventArgs e) |
148 | 270 |
{ |
271 |
try |
|
272 |
{ |
|
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
|
273 |
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
|
274 |
// 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
|
275 |
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
|
276 |
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
|
277 |
UC_Screen_NewCutting(this, new EventArgs()); |
148 | 278 |
} |
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
|
279 |
catch (Exception) |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
280 |
{ |
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
|
281 |
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
|
282 |
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
|
283 |
UC_Screen_NewCutting(this, new EventArgs()); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
148
diff
changeset
|
284 |
} |
148 | 285 |
} |
35 | 286 |
} |
287 |
} |