[longomatch] Fix usage of new ProjectID filed



commit 418f429324942522b9d608c724e47514109553a8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Mar 25 17:30:18 2015 +0100

    Fix usage of new ProjectID filed

 LongoMatch.Core/Store/ProjectDescription.cs      |   10 ++++++++++
 LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs |    2 +-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Store/ProjectDescription.cs b/LongoMatch.Core/Store/ProjectDescription.cs
index f036039..4dfbeb2 100644
--- a/LongoMatch.Core/Store/ProjectDescription.cs
+++ b/LongoMatch.Core/Store/ProjectDescription.cs
@@ -20,6 +20,7 @@ using Newtonsoft.Json;
 using LongoMatch.Core.Store;
 using LongoMatch.Core.Interfaces;
 using LongoMatch.Core.Common;
+using System.Runtime.Serialization;
 
 namespace LongoMatch.Core.Store
 {
@@ -37,6 +38,15 @@ namespace LongoMatch.Core.Store
                        MatchDate = LastModified = DateTime.Now;
                }
 
+               [OnDeserialized]
+               internal void OnDeserializedMethod (StreamingContext context)
+               {
+                       // For old projects missing ProjectID 
+                       if (ProjectID == Guid.Empty) {
+                               ProjectID = ID;
+                       }
+               }
+
                /// <summary>
                /// Unique ID of the parent project
                /// </summary>
diff --git a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs 
b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
index becd8d7..5272469 100644
--- a/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/ProjectsManagerPanel.cs
@@ -206,7 +206,7 @@ namespace LongoMatch.Gui.Panel
                        selectedProjects = projects;
                        if (projects.Count == 1) {
                                try {
-                                       LoadProject (DB.GetProject (projects [0].ID));
+                                       LoadProject (DB.GetProject (projects [0].ProjectID));
                                } catch (Exception ex) {
                                        Log.Exception (ex);
                                        Config.GUIToolkit.ErrorMessage (ex.Message, this);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]