[longomatch] Only load backgrounds in stats once too



commit 97eea1fb8e50431d3f6ad0ab5623fb09f116babf
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Aug 7 18:11:50 2013 +0200

    Only load backgrounds in stats once too

 .../Gui/Component/Stats/CategoriesViewer.cs        |    5 ++++-
 .../Gui/Component/Stats/CategoryViewer.cs          |   14 +++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs 
b/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
index 075f5aa..3255f0d 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/CategoriesViewer.cs
@@ -43,6 +43,7 @@ namespace LongoMatch.Gui.Component.Stats
                
                public void LoadStats (ProjectStats pstats) {
                        TreeIter iter;
+                       CategoryStats st;
                        
                        store.Clear();
                        foreach (CategoryStats cstats in pstats.CategoriesStats) {
@@ -52,7 +53,9 @@ namespace LongoMatch.Gui.Component.Stats
                        treeview.Selection.SelectIter(iter);
                        categoryviewer1.HomeName = pstats.LocalTeam;
                        categoryviewer1.AwayName = pstats.VisitorTeam;
-                       categoryviewer1.LoadStats (store.GetValue (iter, 0) as CategoryStats);
+                       st = store.GetValue (iter, 0) as CategoryStats;
+                       categoryviewer1.LoadBackgrounds (st.Field, st.HalfField, st.Goal);
+                       categoryviewer1.LoadStats (st);
                }
                
                void HandleCursorChanged (object sender, EventArgs e)
diff --git a/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs 
b/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs
index 7ba0651..222e9e2 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/CategoryViewer.cs
@@ -20,6 +20,7 @@ using Gtk;
 using LongoMatch.Stats;
 using System.Collections.Generic;
 using LongoMatch.Common;
+using Image = LongoMatch.Common.Image;
 
 namespace LongoMatch.Gui.Component.Stats
 {
@@ -34,23 +35,27 @@ namespace LongoMatch.Gui.Component.Stats
                        HomeName = "Home";
                        AwayName = "Away";
                }
-               
+
                public string HomeName { get; set; }
                public string AwayName { get; set; }
                
+               public void LoadBackgrounds (Image field, Image halfField, Image goal) {
+                       alltagger.LoadBackgrounds (field, halfField, goal);
+                       hometagger.LoadBackgrounds (field, halfField, goal);
+                       awaytagger.LoadBackgrounds (field, halfField, goal);
+               }
+
                public void LoadStats (CategoryStats stats) {
                        homeLabel.Text = HomeName;
                        awayLabel.Text = AwayName;
                        
-                       alltagger.LoadBackgrounds (stats.Field, stats.HalfField, stats.Goal);
                        alltagger.LoadFieldCoordinates (stats.FieldCoordinates);
                        alltagger.LoadHalfFieldCoordinates (stats.HalfFieldCoordinates);
                        alltagger.LoadGoalCoordinates (stats.GoalCoordinates);
                        alltagger.CoordinatesSensitive = false;
                        allframe.Visible = stats.FieldCoordinates.Count + stats.HalfFieldCoordinates.Count +
                            stats.GoalCoordinates.Count != 0;
-                           
-                       hometagger.LoadBackgrounds (stats.Field, stats.HalfField, stats.Goal);
+                       
                        hometagger.LoadFieldCoordinates (stats.HomeFieldCoordinates);
                        hometagger.LoadHalfFieldCoordinates (stats.HomeHalfFieldCoordinates);
                        hometagger.LoadGoalCoordinates (stats.HomeGoalCoordinates);
@@ -58,7 +63,6 @@ namespace LongoMatch.Gui.Component.Stats
                        homeframe.Visible = stats.HomeFieldCoordinates.Count + 
stats.HomeHalfFieldCoordinates.Count +
                            stats.HomeGoalCoordinates.Count != 0;
                            
-                       awaytagger.LoadBackgrounds (stats.Field, stats.HalfField, stats.Goal);
                        awaytagger.LoadFieldCoordinates (stats.AwayFieldCoordinates);
                        awaytagger.LoadHalfFieldCoordinates (stats.AwayHalfFieldCoordinates);
                        awaytagger.LoadGoalCoordinates (stats.AwayGoalCoordinates);


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