[longomatch] Fix Exception with hotkeys when there is no capturer



commit 14f72523c1701abc0bc5554af0e646e99aa9186b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Oct 29 20:32:30 2014 +0100

    Fix Exception with hotkeys when there is no capturer

 LongoMatch.Services/Services/HotKeysManager.cs |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/LongoMatch.Services/Services/HotKeysManager.cs b/LongoMatch.Services/Services/HotKeysManager.cs
index fff196d..d3881f3 100644
--- a/LongoMatch.Services/Services/HotKeysManager.cs
+++ b/LongoMatch.Services/Services/HotKeysManager.cs
@@ -31,6 +31,7 @@ namespace LongoMatch.Services
        {
                Dictionary<HotKey, DashboardButton> dashboardHotkeys;
                IAnalysisWindow analysisWindow;
+               ProjectType projectType;
                ICapturerBin capturer;
                Dashboard dashboard;
                AnalysisEventButton pendingButton;
@@ -119,25 +120,26 @@ namespace LongoMatch.Services
                                case KeyAction.FitTimeline:
                                        analysisWindow.FitTimeline ();
                                        return;
-                               case KeyAction.PauseClock:
-                                       if (capturer != null) {
+                               }
+                               
+                               if (projectType == ProjectType.CaptureProject ||
+                                       projectType == ProjectType.FakeCaptureProject ||
+                                       projectType == ProjectType.URICaptureProject) {
+                                       switch (action) {
+                                       case KeyAction.PauseClock:
                                                if (capturer.Capturing) {
                                                        capturer.PausePeriod ();
                                                } else {
                                                        capturer.ResumePeriod ();
                                                }
-                                       }
-                                       break;
-                               case KeyAction.StartPeriod:
-                                       if (capturer != null) {
+                                               break;
+                                       case KeyAction.StartPeriod:
                                                capturer.StartPeriod ();
-                                       }
-                                       break;
-                               case KeyAction.StopPeriod:
-                                       if (capturer != null) {
+                                               break;
+                                       case KeyAction.StopPeriod:
                                                capturer.StopPeriod ();
+                                               break;
                                        }
-                                       break;
                                }
                        }
                }


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