src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
changeset 215 d13dbcf861d7
parent 214 beebae32b1ed
child 223 90d2be5c3d39
equal deleted inserted replaced
214:beebae32b1ed 215:d13dbcf861d7
    11 using System.Xml.Linq;
    11 using System.Xml.Linq;
    12 using FingersDance.Control.ListVideo;
    12 using FingersDance.Control.ListVideo;
    13 using FingersDance.Control.SessionInput;
    13 using FingersDance.Control.SessionInput;
    14 using FingersDance.ViewModels;
    14 using FingersDance.ViewModels;
    15 using FingersDance.Data;
    15 using FingersDance.Data;
       
    16 using FingersDance.Factory;
    16 
    17 
    17 namespace FingersDance.Control.Screen
    18 namespace FingersDance.Control.Screen
    18 {
    19 {
    19 	public partial class UserControlScreen
    20 	public partial class UserControlScreen
    20 	{
    21 	{
   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
   159                     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
   159                     loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value;
   160                     loadedProject.Name = loadedLdt.Root.Element("project").Attribute("title").Value;
   160                     loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value;
   161                     loadedProject.Description = loadedLdt.Root.Element("project").Attribute("abstract").Value;
   161                     loadedProject.Cuttings = new List<Cutting>();
   162                     loadedProject.Cuttings = new List<Cutting>();
   162                     XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content");
   163                     XElement cuttingsParentNode = loadedLdt.Root.Element("annotations").Element("content");
       
   164                     DataDictionary Data = (new DataFactory()).Data;
   163                     foreach (XElement cuttingNode in cuttingsParentNode.Elements())
   165                     foreach (XElement cuttingNode in cuttingsParentNode.Elements())
   164                     {
   166                     {
   165                         List<Annotation> la = new List<Annotation>();
   167                         List<Annotation> la = new List<Annotation>();
   166                         foreach (XElement annotNode in cuttingNode.Element("elements").Elements())
   168                         foreach (XElement annotNode in cuttingNode.Element("elements").Elements())
   167                         {
   169                         {
   172                             String colorString = annotNode.Attribute("color").Value; // is type 0xRRGGBB
   174                             String colorString = annotNode.Attribute("color").Value; // is type 0xRRGGBB
   173                             Byte r = Convert.ToByte(colorString.Substring(2, 2), 16);
   175                             Byte r = Convert.ToByte(colorString.Substring(2, 2), 16);
   174                             Byte g = Convert.ToByte(colorString.Substring(4, 2), 16);
   176                             Byte g = Convert.ToByte(colorString.Substring(4, 2), 16);
   175                             Byte b = Convert.ToByte(colorString.Substring(6, 2), 16);
   177                             Byte b = Convert.ToByte(colorString.Substring(6, 2), 16);
   176                             Color c = Color.FromRgb(r, g, b);
   178                             Color c = Color.FromRgb(r, g, b);
   177                             la.Add(new Annotation(aId, begin, dur, gt, c));
   179                             Annotation Annotation = new Annotation(aId, begin, dur, gt, c);
       
   180                             la.Add(Annotation);
       
   181                             Data.AddAnnotation(Annotation);
   178                         }
   182                         }
   179                         loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la));
   183                         loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la));
   180                     }
   184                     }
   181                     // We define the loaded project as the current session's project in annotation mode or the searched project in search mode
   185                     // We define the loaded project as the current session's project in annotation mode or the searched project in search mode
   182                     if (AnnotationOrSearchMode == "Annotation")
   186                     if (AnnotationOrSearchMode == "Annotation")