[longomatch] Only save projects is autosave is enabled



commit 18f4422de4c0d276bbc09e37dfb77866d0976b70
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Jun 26 14:27:26 2013 +0200

    Only save projects is autosave is enabled

 LongoMatch.Services/Services/EventsManager.cs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index 2a04359..e5793e7 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -59,6 +59,12 @@ namespace LongoMatch.Services
                        ConnectSignals();
                }
 
+               void Save (Project project) {
+                       if (Config.AutoSave) {
+                               Core.DB.UpdateProject (project);
+                       }
+               }
+               
                public void SetProject (Project project, ProjectType projectType,
                                        PlaysFilter filter)
                {
@@ -150,9 +156,7 @@ namespace LongoMatch.Services
                        if (projectType == ProjectType.FileProject) {
                                player.Play();
                        }
-                       if (Config.AutoSave) {
-                               Core.DB.UpdateProject (openedProject);
-                       }
+                       Save (openedProject);
                }
 
                protected virtual void OnNewTagAtFrame(Category category, int frame) {
@@ -246,7 +250,7 @@ namespace LongoMatch.Services
 
                        if(projectType == ProjectType.FileProject) {
                                player.CloseActualSegment();
-                               Core.DB.UpdateProject(openedProject);
+                               Save (openedProject);
                        }
                        filter.Update();
                }
@@ -291,7 +295,7 @@ namespace LongoMatch.Services
                        newplay.Notes = play.Notes;
                        newplay.Drawings = play.Drawings;
                        mainWindow.AddPlay(newplay);
-                       Core.DB.UpdateProject (openedProject);
+                       Save (openedProject);
                }
        }
 }


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