[longomatch] Use global templates provider



commit 2d023858e797f8f76e1bd101c9abc3522425e040
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed May 28 16:40:18 2014 +0200

    Use global templates provider

 LongoMatch.Core/Config.cs                          |    2 ++
 LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs  |    1 -
 LongoMatch.GUI/Gui/Component/AnalysisComponent.cs  |    6 ------
 LongoMatch.GUI/Gui/Component/CategoryProperties.cs |    6 +++---
 .../Gui/Component/PlaysListTreeWidget.cs           |   11 +----------
 .../Gui/Component/PlaysSelectionWidget.cs          |    6 ------
 LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs    |    4 ++--
 LongoMatch.Services/Services/Core.cs               |    1 +
 8 files changed, 9 insertions(+), 28 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 5b7b2f7..ee87866 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -37,6 +37,8 @@ namespace LongoMatch
                public static IDrawingToolkit DrawingToolkit;
                public static ITeamTemplatesProvider TeamTemplatesProvider;
                public static ICategoriesTemplatesProvider CategoriesTemplatesProvider;
+               public static ISubcategoriesTemplatesProvider SubcategoriesTemplatesProvider;
+
                public static IDataBaseManager DatabaseManager;
                public static IRenderingJobsManager RenderingJobsManger;
 
diff --git a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs 
b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
index 3f255ba..7acdd53 100644
--- a/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IAnalysisWindow.cs
@@ -75,7 +75,6 @@ namespace LongoMatch.Interfaces.GUI
                
                IPlayerBin Player{get;}
                ICapturerBin Capturer{get;}
-               ITemplatesService TemplatesService{set;}
                IPlaylistWidget Playlist {get;}
        }
 }
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index ff4a91d..9dfc435 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -113,12 +113,6 @@ namespace LongoMatch.Gui.Component
                        }
                }
                
-               public ITemplatesService TemplatesService {
-                       set {
-                               playsSelection.TemplatesService = value;
-                       }
-               }
-               
                public bool Fullscreen {
                        set {
                                playercapturer.FullScreen = value;
diff --git a/LongoMatch.GUI/Gui/Component/CategoryProperties.cs 
b/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
index 01fe86c..b7f647a 100644
--- a/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
+++ b/LongoMatch.GUI/Gui/Component/CategoryProperties.cs
@@ -68,9 +68,9 @@ namespace LongoMatch.Gui.Component
                        }
                }
                
-               public void LoadSubcategories(ITemplatesService ts) {
-                       subcategoriesProvider = ts.SubCategoriesTemplateProvider;
-                       LoadSubcategories(ts.PlayerSubcategories);
+               public void LoadSubcategories() {
+                       subcategoriesProvider = Config.SubcategoriesTemplatesProvider;
+                       LoadSubcategories();
                }
                
                private void LoadSubcategories(List<PlayerSubCategory> playerSubcategories) {
diff --git a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
index 5dbffcf..712d7e3 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
@@ -48,8 +48,6 @@ namespace LongoMatch.Gui.Component
                public event RenderPlaylistHandler RenderPlaylist;
                public event DuplicatePlayHandler DuplicatePlay;
 
-               ITemplatesService ts;
-
                private Project project;
 
                public PlaysListTreeWidget()
@@ -67,13 +65,6 @@ namespace LongoMatch.Gui.Component
                        treeview.DuplicatePlay += OnDuplicatePlay;
                }
                
-               public ITemplatesService TemplatesService
-               {
-                       set {
-                               ts = value;
-                       }
-               }
-               
                public PlaysFilter Filter {
                        set{
                                treeview.Filter = value;
@@ -182,7 +173,7 @@ namespace LongoMatch.Gui.Component
                }
                
                protected virtual void OnEditProperties(TimeNode tNode, object val) {
-                       EditCategoryDialog dialog = new EditCategoryDialog(ts);
+                       EditCategoryDialog dialog = new EditCategoryDialog();
                        dialog.Category = tNode as Category; 
                        dialog.Template = project.Categories;
                        dialog.Project = project;
diff --git a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs 
b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
index 3fb77b8..fb04954 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
@@ -90,12 +90,6 @@ namespace LongoMatch.Gui.Component
                        }
                }
                
-               public ITemplatesService TemplatesService {
-                       set {
-                               playsList.TemplatesService = value;
-                       }
-               }
-               
                public void AddPlay(Play play) {
                        playsList.AddPlay(play);
                        UpdateTeamsModels();
diff --git a/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs b/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs
index 49d5f53..a291e28 100644
--- a/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/EditCategoryDialog.cs
@@ -37,11 +37,11 @@ namespace LongoMatch.Gui.Dialog
        {
                private List<HotKey> hkList;
 
-               public EditCategoryDialog(ITemplatesService ts)
+               public EditCategoryDialog()
                {
                        this.Build();
                        timenodeproperties2.HotKeyChanged += OnHotKeyChanged;
-                       timenodeproperties2.LoadSubcategories(ts);
+                       timenodeproperties2.LoadSubcategories();
                }
 
                public Category Category {
diff --git a/LongoMatch.Services/Services/Core.cs b/LongoMatch.Services/Services/Core.cs
index 0484437..a99967e 100644
--- a/LongoMatch.Services/Services/Core.cs
+++ b/LongoMatch.Services/Services/Core.cs
@@ -86,6 +86,7 @@ namespace LongoMatch.Services
                        ts = new TemplatesService (Config.TemplatesDir);
                        Config.TeamTemplatesProvider = ts.TeamTemplateProvider;
                        Config.CategoriesTemplatesProvider = ts.CategoriesTemplateProvider;
+                       Config.SubcategoriesTemplatesProvider = ts.SubCategoriesTemplateProvider;
 
                        /* Start DB services */
                        dbManager = new DataBaseManager (Config.DBDir, guiToolkit);


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