[chronojump] on Encoder triggers capture without using them will popup a message



commit e4447472569fdff848ba7bea55bd5af21dfbc0b2
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jan 11 17:21:39 2018 +0100

    on Encoder triggers capture without using them will popup a message

 src/encoderCapture.cs |   10 ++++++++++
 src/gui/encoder.cs    |    7 +++++++
 src/trigger.cs        |    9 +++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index 1676523..a09fe7a 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -797,6 +797,16 @@ public abstract class EncoderCapture
                return triggerList;
        }
 
+       /*
+        * graph.R will findCurvesByTriggers if (length(op$TriggersOn) >= 2)
+        * else will findCurvesNew (like if not capturing by triggers)
+        * We need to know what graph.R will do to show a message to user
+        */
+       public bool MinimumTwoTriggersOn()
+       {
+               return triggerList.MinimumTwoOn();
+       }
+
        public string Eccon {
                get { return eccon; }
        }
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 510663a..33cfbf6 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -6216,6 +6216,13 @@ public partial class ChronoJumpWindow
                                                
eCapture.SaveTriggers(Convert.ToInt32(encoderSignalUniqueID)); //dbcon is closed
                                                showTriggersAndTab();
 
+                                               if(encoderRProcCapture.CutByTriggers && ! 
eCapture.MinimumTwoTriggersOn())
+                                                       new DialogMessage(
+                                                                       "Chronojump",
+                                                                       Constants.MessageTypes.WARNING,
+                                                                       "Trigger has not been pressed a 
minimum of two times." + "\n\n" +
+                                                                       "Repetitions have been cut 
automatically.");
+
                                                //2) send the json to server
                                                //check if encoderCaptureCurves > 0
                                                //(this is the case of a capture without repetitions or can 
have on ending cont mode)
diff --git a/src/trigger.cs b/src/trigger.cs
index b309435..e03881b 100644
--- a/src/trigger.cs
+++ b/src/trigger.cs
@@ -214,6 +214,15 @@ public class TriggerList
                return countOn;
        }
 
+       //see encoderCapture.MinimumTwoTriggersOn()
+       public bool MinimumTwoOn()
+       {
+               if(countOn() >= 2)
+                       return true;
+
+               return false;
+       }
+
        //if inOut == true will return last "in"
        private Trigger last(bool inOut)
        {


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