diff -r beb938b4fb76 -r bd33267300aa client/src/Iri.Modernisation.Data/Ldt/LDTElement.cs --- a/client/src/Iri.Modernisation.Data/Ldt/LDTElement.cs Wed Jan 27 10:55:59 2010 +0100 +++ b/client/src/Iri.Modernisation.Data/Ldt/LDTElement.cs Thu Feb 04 16:38:04 2010 +0100 @@ -10,6 +10,7 @@ using System.Windows.Shapes; using System.Collections.Generic; using System.Xml.Linq; +using Iri.Modernisation.Data.Models; namespace Iri.Modernisation.Data.LDTClass { /// @@ -40,7 +41,7 @@ /// /// Attribut /// - public int Color { get; set; } + public double Color { get; set; } /// /// Attribut /// @@ -63,10 +64,34 @@ public List Tags { get; set; } /// + /// Attribute + /// + public int Type { get; set; } + + /// /// Elements /// public String Video { get; set; } + public LDTElement(Annotation annotation) + { + Id = annotation.Id; + Title = annotation.Title; + Abstract = annotation.Description; + Begin = annotation.TimerIn.TotalMilliseconds; + Dur = annotation.TimerOut.TotalMilliseconds - annotation.TimerIn.TotalMilliseconds; + Tags = annotation.Tags; + Date = DateTime.Now; + Src = String.Empty; + Author = String.Empty; + Audio = String.Empty; + Video = String.Empty; + + Color = double.Parse(annotation.Type.Color.A.ToString() + annotation.Type.Color.R.ToString() + annotation.Type.Color.G.ToString() + annotation.Type.Color.B.ToString()); + Type = 0; + + } + public LDTElement(XElement e) { Tags = new List(); @@ -76,7 +101,7 @@ Dur = Double.Parse(e.Attribute("dur").Value); Author = e.Attribute("author").Value; Date = DateTime.Parse(e.Attribute("date").Value); - Color = int.Parse(e.Attribute("color").Value); + Color = double.Parse(e.Attribute("color").Value); Src = e.Attribute("src").Value; Title = e.Element("title").Value; Abstract = e.Element("abstract").Value; @@ -89,6 +114,14 @@ { Video = e.Element("video").Value; } + if(e.Attribute("type")==null) + { + Type = 0; + } + else + { + Type = int.Parse(e.Attribute("type").Value); + } foreach (XElement Str in e.Element("tags").Elements()) { Tags.Add(Str.Value); @@ -96,7 +129,8 @@ } public LDTElement() { - Id = String.Empty; + Id = System.Guid.NewGuid().ToString(); + Type = 0; Begin = 0; Dur = 0; Author = String.Empty; @@ -122,6 +156,7 @@ new XAttribute("date",Date.ToString("")), new XAttribute("color",Color), new XAttribute("src",Src), + new XAttribute("type",Type.ToString()), new XElement("title",Title), new XElement("abstract",Abstract), new XElement("audio",Audio),