[longomatch/redesign2: 112/140] Fill default subcategories for Players



commit f8ff8c43f95b18d18b65218dfbdb59917b4cf7cf
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Apr 9 16:47:59 2011 +0200

    Fill default subcategories for Players

 LongoMatch/Services/TemplatesService.cs |   34 ++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch/Services/TemplatesService.cs b/LongoMatch/Services/TemplatesService.cs
index 38dad36..37636e5 100644
--- a/LongoMatch/Services/TemplatesService.cs
+++ b/LongoMatch/Services/TemplatesService.cs
@@ -34,6 +34,7 @@ namespace LongoMatch.Services
 	public class TemplatesService
 	{
 		private Dictionary<Type, ITemplateProvider> dict;
+		private List<PlayerSubCategory> playerSubcatList;
 		
 		public TemplatesService (string basePath)
 		{
@@ -48,6 +49,8 @@ namespace LongoMatch.Services
 			         new TemplatesProvider<Categories, Category> (basePath,
 			                                                 Constants.CAT_TEMPLATE_EXT));
 			CheckDefaultTemplates();
+			CreateDefaultSubCategories();
+			
 		}
 		
 		private void CheckDefaultTemplates () {
@@ -55,6 +58,30 @@ namespace LongoMatch.Services
 				t.CheckDefaultTemplate();
 		}
 		
+		private void CreateDefaultSubCategories () {
+			PlayerSubCategory subcat;
+			
+			/* Local team players */
+			playerSubcatList = new List<PlayerSubCategory>();
+			subcat = new PlayerSubCategory{
+				Name=Catalog.GetString("Local team players"), AllowMultiple=true, FastTag=true};
+			subcat.Add(Team.LOCAL);
+			playerSubcatList.Add(subcat);
+
+			/* Visitor team players */
+			subcat = new PlayerSubCategory{
+				Name=Catalog.GetString("Visitor team players"), AllowMultiple=true, FastTag=true};
+			subcat.Add(Team.VISITOR);
+			playerSubcatList.Add(subcat);
+			
+			/* Local and Visitor team players */
+			subcat = new PlayerSubCategory{
+				Name=Catalog.GetString("All teams players"), AllowMultiple=true, FastTag=true};
+			subcat.Add(Team.LOCAL);
+			subcat.Add(Team.VISITOR);
+			playerSubcatList.Add(subcat);
+		}
+		
 		public ITemplateProvider<T, U> GetTemplateProvider<T, U>() where T: ITemplate<U> {
 			if (dict.ContainsKey(typeof(T)))
 				return (ITemplateProvider<T, U>)dict[typeof(T)];
@@ -86,6 +113,12 @@ namespace LongoMatch.Services
 				return (ITemplateProvider<Categories, Category>) dict[typeof(Categories)]; 
 			}
 		}
+		
+		public List<PlayerSubCategory> PlayerSubcategories {
+			get{
+				return playerSubcatList;
+			}
+		}
 	}
 	
 	public class TemplatesProvider<T, U>: ITemplateProvider<T, U> where T: ITemplate<U>
@@ -195,4 +228,3 @@ namespace LongoMatch.Services
 		}
 	}
 }
-



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