[longomatch] Make Config.Style a property and initialize it for tests



commit cb1bb806f43d019def55236c77aaae18fb0a8ea5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Mar 2 14:40:36 2015 +0100

    Make Config.Style a property and initialize it for tests

 LongoMatch.Core/Config.cs    |   16 ++++++++++++++--
 LongoMatch.Core/StyleConf.cs |   17 +++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 01c956f..2043d8a 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -47,10 +47,10 @@ namespace LongoMatch
                public static IDataBaseManager DatabaseManager;
                public static IRenderingJobsManager RenderingJobsManger;
                
-               public static StyleConf Style;
-
+               static StyleConf style;
                static ConfigState state;
 
+
                public static void Init () {
                        string home;
 
@@ -116,6 +116,18 @@ namespace LongoMatch
                        }
                }
                
+               public static StyleConf Style {
+                       get {
+                               if (style == null) {
+                                       style = new StyleConf ();
+                               }
+                               return style;
+                       }
+                       set {
+                               style = value;
+                       }
+               }
+
                public static string ConfigFile {
                        get {
                                string filename = Constants.SOFTWARE_NAME.ToLower() + "-1.0.config";
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
index 40a94a3..2e80494 100644
--- a/LongoMatch.Core/StyleConf.cs
+++ b/LongoMatch.Core/StyleConf.cs
@@ -16,6 +16,7 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
 using System;
+using LongoMatch.Core.Common;
 
 namespace LongoMatch.Core.Common
 {
@@ -152,9 +153,25 @@ namespace LongoMatch.Core.Common
                
                public Color PaletteText { get; set; }
 
+               public StyleConf ()
+               {
+                       HomeTeamColor = Color.Red;
+                       AwayTeamColor = Color.Blue;
+                       PaletteBackground = Color.Black;
+                       PaletteBackgroundLight = Color.Black;
+                       PaletteBackgroundDark = Color.Black;
+                       PaletteBackgroundDarkBright = Color.Black;
+                       PaletteWidgets = Color.Black;
+                       PaletteSelected = Color.Black;
+                       PaletteActive = Color.Black;
+                       PaletteTool = Color.Black;
+                       PaletteText = Color.Black;
+               }
+               
                public static StyleConf Load (string filename)
                {
                        return Serializer.Load <StyleConf> (filename);
                }
+               
        }
 }


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