|
0
|
1 |
using System; |
|
|
2 |
using System.Net; |
|
|
3 |
using System.Windows; |
|
|
4 |
using System.Windows.Controls; |
|
|
5 |
using System.Windows.Documents; |
|
|
6 |
using System.Windows.Ink; |
|
|
7 |
using System.Windows.Input; |
|
|
8 |
using System.Windows.Media; |
|
|
9 |
using System.Windows.Media.Animation; |
|
|
10 |
using System.Windows.Shapes; |
|
|
11 |
using System.Collections.Generic; |
|
|
12 |
using System.Xml.Linq; |
|
38
|
13 |
using Iri.Modernisation.Data.Models; |
|
0
|
14 |
namespace Iri.Modernisation.Data.LDTClass |
|
|
15 |
{ |
|
|
16 |
/// <summary> |
|
|
17 |
/// Balise Element |
|
|
18 |
/// </summary> |
|
|
19 |
public class LDTElement |
|
|
20 |
{ |
|
|
21 |
/// <summary> |
|
|
22 |
/// Attribut |
|
|
23 |
/// </summary> |
|
|
24 |
public String Id { get; set; } |
|
|
25 |
/// <summary> |
|
|
26 |
/// Attribut |
|
|
27 |
/// </summary> |
|
34
|
28 |
public Double Begin { get; set; } |
|
0
|
29 |
/// <summary> |
|
|
30 |
/// Attribut |
|
|
31 |
/// </summary> |
|
34
|
32 |
public Double Dur { get; set; } |
|
0
|
33 |
/// <summary> |
|
|
34 |
/// Attribut |
|
|
35 |
/// </summary> |
|
|
36 |
public String Author { get; set; } |
|
|
37 |
/// <summary> |
|
|
38 |
/// Attribut |
|
|
39 |
/// </summary> |
|
|
40 |
public DateTime Date { get; set; } |
|
|
41 |
/// <summary> |
|
|
42 |
/// Attribut |
|
|
43 |
/// </summary> |
|
38
|
44 |
public double Color { get; set; } |
|
0
|
45 |
/// <summary> |
|
|
46 |
/// Attribut |
|
|
47 |
/// </summary> |
|
|
48 |
public String Src { get; set; } |
|
|
49 |
/// <summary> |
|
|
50 |
/// Element |
|
|
51 |
/// </summary> |
|
|
52 |
public String Title { get; set; } |
|
|
53 |
/// <summary> |
|
|
54 |
/// Element |
|
|
55 |
/// </summary> |
|
|
56 |
public String Abstract { get; set; } |
|
|
57 |
/// <summary> |
|
|
58 |
/// Element |
|
|
59 |
/// </summary> |
|
|
60 |
public String Audio { get; set; } |
|
|
61 |
/// <summary> |
|
|
62 |
/// Elements |
|
|
63 |
/// </summary> |
|
|
64 |
public List<String> Tags { get; set; } |
|
39
|
65 |
|
|
38
|
66 |
|
|
|
67 |
/// <summary> |
|
34
|
68 |
/// Elements |
|
|
69 |
/// </summary> |
|
|
70 |
public String Video { get; set; } |
|
|
71 |
|
|
38
|
72 |
public LDTElement(Annotation annotation) |
|
|
73 |
{ |
|
|
74 |
Id = annotation.Id; |
|
|
75 |
Title = annotation.Title; |
|
|
76 |
Abstract = annotation.Description; |
|
|
77 |
Begin = annotation.TimerIn.TotalMilliseconds; |
|
|
78 |
Dur = annotation.TimerOut.TotalMilliseconds - annotation.TimerIn.TotalMilliseconds; |
|
|
79 |
Tags = annotation.Tags; |
|
|
80 |
Date = DateTime.Now; |
|
|
81 |
Src = String.Empty; |
|
|
82 |
Author = String.Empty; |
|
|
83 |
Audio = String.Empty; |
|
|
84 |
Video = String.Empty; |
|
|
85 |
|
|
|
86 |
Color = double.Parse(annotation.Type.Color.A.ToString() + annotation.Type.Color.R.ToString() + annotation.Type.Color.G.ToString() + annotation.Type.Color.B.ToString()); |
|
39
|
87 |
|
|
38
|
88 |
|
|
|
89 |
} |
|
|
90 |
|
|
0
|
91 |
public LDTElement(XElement e) |
|
|
92 |
{ |
|
|
93 |
Tags = new List<String>(); |
|
|
94 |
|
|
|
95 |
Id = e.Attribute("id").Value; |
|
34
|
96 |
Begin = Double.Parse(e.Attribute("begin").Value); |
|
|
97 |
Dur = Double.Parse(e.Attribute("dur").Value); |
|
0
|
98 |
Author = e.Attribute("author").Value; |
|
|
99 |
Date = DateTime.Parse(e.Attribute("date").Value); |
|
38
|
100 |
Color = double.Parse(e.Attribute("color").Value); |
|
0
|
101 |
Src = e.Attribute("src").Value; |
|
|
102 |
Title = e.Element("title").Value; |
|
|
103 |
Abstract = e.Element("abstract").Value; |
|
|
104 |
Audio = e.Element("audio").Value; |
|
34
|
105 |
if (e.Element("video")==null) |
|
|
106 |
{ |
|
|
107 |
Video = String.Empty; |
|
|
108 |
} |
|
|
109 |
else |
|
|
110 |
{ |
|
|
111 |
Video = e.Element("video").Value; |
|
|
112 |
} |
|
39
|
113 |
|
|
0
|
114 |
foreach (XElement Str in e.Element("tags").Elements()) |
|
|
115 |
{ |
|
|
116 |
Tags.Add(Str.Value); |
|
|
117 |
} |
|
|
118 |
} |
|
34
|
119 |
public LDTElement() |
|
|
120 |
{ |
|
38
|
121 |
Id = System.Guid.NewGuid().ToString(); |
|
39
|
122 |
|
|
34
|
123 |
Begin = 0; |
|
|
124 |
Dur = 0; |
|
|
125 |
Author = String.Empty; |
|
|
126 |
Date = DateTime.Now; |
|
|
127 |
Color = 0; |
|
|
128 |
Src = String.Empty; |
|
|
129 |
Title = String.Empty; |
|
|
130 |
Abstract = String.Empty; |
|
|
131 |
Audio = String.Empty; |
|
|
132 |
Video = String.Empty; |
|
|
133 |
Tags = new List<string>(); |
|
|
134 |
} |
|
0
|
135 |
|
|
|
136 |
public XElement XML |
|
|
137 |
{ |
|
|
138 |
get |
|
|
139 |
{ |
|
|
140 |
XElement temp = new XElement("element", |
|
|
141 |
new XAttribute("id",Id), |
|
|
142 |
new XAttribute("begin",Begin), |
|
|
143 |
new XAttribute("dur",Dur), |
|
|
144 |
new XAttribute("author",Author), |
|
|
145 |
new XAttribute("date",Date.ToString("")), |
|
|
146 |
new XAttribute("color",Color), |
|
|
147 |
new XAttribute("src",Src), |
|
|
148 |
new XElement("title",Title), |
|
|
149 |
new XElement("abstract",Abstract), |
|
34
|
150 |
new XElement("audio",Audio), |
|
|
151 |
new XElement("video",Video) |
|
0
|
152 |
); |
|
|
153 |
XElement XTags = new XElement("tags"); |
|
|
154 |
foreach (String Tag in Tags) |
|
|
155 |
{ |
|
|
156 |
XTags.Add(new XElement("tag", Tag)); |
|
|
157 |
} |
|
|
158 |
temp.Add(XTags); |
|
|
159 |
return temp; |
|
|
160 |
} |
|
|
161 |
} |
|
|
162 |
} |
|
|
163 |
} |