diff -r c0661ecf943e -r 05aba5def1fc src/FingersDance.Control.Screen/UserControlScreen.xaml.cs --- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Tue Nov 24 12:57:18 2009 +0100 +++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Tue Nov 24 22:08:57 2009 +0100 @@ -118,20 +118,20 @@ { try { - // We get all the ldt/project files from the current directory... - List existingProjects = new List(); - String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); - String ext = ".ldt"; - foreach (String filename in Directory.GetFiles(path)) - { - if (filename.Substring(filename.Length-4).ToLower()==ext) - existingProjects.Add(filename.Substring(path.Length + 1, filename.Length - ext.Length - path.Length - 1)); - } - // ... and display them the the select box UserControlListProject - UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode); - listProject.Name = "ListProject"; - LayoutRoot.Children.Add(listProject); - listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown); + // We get all the ldt/project files from the current directory... + List existingProjects = new List(); + String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + String ext = ".ldt"; + foreach (String filename in Directory.GetFiles(path)) + { + if (filename.Substring(filename.Length-4).ToLower()==ext) + existingProjects.Add(filename.Substring(path.Length + 1, filename.Length - ext.Length - path.Length - 1)); + } + // ... and display them the the select box UserControlListProject + UserControlListProject listProject = new UserControlListProject(existingProjects, AnnotationOrSearchMode); + listProject.Name = "ListProject"; + LayoutRoot.Children.Add(listProject); + listProject.EH_ListProject_ContactDown += new EventHandler(listProject_EH_ListProject_ContactDown); } catch (Exception) { @@ -143,8 +143,8 @@ void listProject_EH_ListProject_ContactDown(object sender, EventArgs e) { - try - { + //try + //{ LayoutRoot.Children.Remove((UserControlListProject)sender); if (((UserControlListProject)sender).SelectedItem.Equals("New Project")) { @@ -185,7 +185,15 @@ la.Add(Annotation); Data.AddAnnotation(Annotation); } - loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value,cuttingNode.Element("title").Value,la)); + String cutColorString = cuttingNode.Attribute("color").Value; // is type 0xRRGGBB + Byte rCut = Convert.ToByte(cutColorString.Substring(2, 2), 16); + Byte gCut = Convert.ToByte(cutColorString.Substring(4, 2), 16); + Byte bCut = Convert.ToByte(cutColorString.Substring(6, 2), 16); + Color cCut = Color.FromRgb(rCut, gCut, bCut); + // We take off the loaded color from the reference color list. + ColorFactory.TakeOffColor(cCut); + // We add the cutting to the loaded project + loadedProject.Cuttings.Add(new Cutting(cuttingNode.Attribute("id").Value, cuttingNode.Element("title").Value, la, cCut)); } // We define the loaded project as the current session's project in annotation mode or the searched project in search mode if (AnnotationOrSearchMode == "Annotation") @@ -194,13 +202,13 @@ SearchedProject = loadedProject; OpenProject(); } - } - catch (Exception) - { - Cutting = null; - if (UC_Screen_NewCutting != null) - UC_Screen_NewCutting(this, new EventArgs()); - } + //} + //catch (Exception) + //{ + // Cutting = null; + // if (UC_Screen_NewCutting != null) + // UC_Screen_NewCutting(this, new EventArgs()); + //} } private void ProjectInput_EH_NewProjectForm_ContactDown(object sender, EventArgs e)