[chronojump] Exhibition testType selects Chronojump mode at start



commit 5138d382bbda151d495c8265abb36e27958b5107
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Feb 25 00:32:23 2019 +0100

    Exhibition testType selects Chronojump mode at start

 src/config.cs         |  4 ++++
 src/gui/chronojump.cs |  6 +++---
 src/gui/exhibition.cs | 13 ++++++++++++-
 src/gui/networks.cs   |  2 +-
 src/json.cs           |  2 +-
 5 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/config.cs b/src/config.cs
index bcc196c8..7cfd53e4 100644
--- a/src/config.cs
+++ b/src/config.cs
@@ -47,6 +47,7 @@ public class Config
        public bool PlaySoundsFromFile;
 
        public bool Exhibition; //like YOMO. does not have rfid capture, user autologout management, and 
automatic configuration of gui
+       public ExhibitionTest.testTypes ExhibitionStationType;
        /*
         * unused because the default serverURL chronojump.org is ok:
         * public string ExhibitionServerURL = "";
@@ -111,6 +112,9 @@ public class Config
                                                PlaySoundsFromFile = true;
                                        else if(parts[0] == "Exhibition" && Util.StringToBool(parts[1]))
                                                Exhibition = true;
+                                       else if(parts[0] == "ExhibitionStationType" && 
Enum.IsDefined(typeof(ExhibitionTest.testTypes), parts[1]))
+                                               ExhibitionStationType = (ExhibitionTest.testTypes)
+                                                       Enum.Parse(typeof(ExhibitionTest.testTypes), 
parts[1]);
                                        /*
                                        else if(parts[0] == "ExhibitionServerURL" && parts[1] != "")
                                                ExhibitionServerURL = parts[1];
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index bedaaa90..536de00a 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -696,8 +696,6 @@ public partial class ChronoJumpWindow
 
                LogB.Information("Calling configInitRead from gui / ChronojumpWindow");
                configInitRead();
-               if(configChronojump.Exhibition)
-                       exhibitionGuiAtStart();
 
                //presentationInit();
 
@@ -4509,7 +4507,6 @@ public partial class ChronoJumpWindow
 
                        if(configChronojump.Exhibition)
                                uploadExhibitionTest(ExhibitionTest.testTypes.JUMP, 
Convert.ToDouble(Util.GetHeightInCentimeters(currentJump.Tv.ToString())));
-
                } 
                else if( currentEventExecute.ChronopicDisconnected )
                        chronopicDisconnectedWhileExecuting();
@@ -4951,6 +4948,9 @@ public partial class ChronoJumpWindow
 
                        //put correct time value in eventWindow (put the time from chronopic and not onTimer 
soft chronometer)
                        event_execute_LabelTimeValue = currentRun.Time;
+
+                       if(configChronojump.Exhibition)
+                               uploadExhibitionTest(ExhibitionTest.testTypes.RUN, currentRun.Time);
                }
                else if( currentEventExecute.ChronopicDisconnected )
                        chronopicDisconnectedWhileExecuting();
diff --git a/src/gui/exhibition.cs b/src/gui/exhibition.cs
index 4ef60348..285dfe0e 100644
--- a/src/gui/exhibition.cs
+++ b/src/gui/exhibition.cs
@@ -30,8 +30,19 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_exhibition_4;
        [Widget] Gtk.Label label_persons; //persons text show the top of manage persons. Hidden on exhibition 
to be more clear (1,2,3,4)
 
-       private void exhibitionGuiAtStart()
+       private void exhibitionGuiAtStart(ExhibitionTest.testTypes exhibitionStationType)
        {
+               if(exhibitionStationType == ExhibitionTest.testTypes.JUMP)
+                       on_button_selector_start_jumps_simple_clicked (new object (), new EventArgs());
+               else if(exhibitionStationType == ExhibitionTest.testTypes.RUN)
+                       on_button_selector_start_runs_simple_clicked (new object (), new EventArgs());
+               else if(exhibitionStationType == ExhibitionTest.testTypes.INERTIAL)
+                       on_button_selector_start_encoder_inertial_clicked (new object (), new EventArgs());
+               else if(exhibitionStationType == ExhibitionTest.testTypes.FORCE_ROPE ||
+                               exhibitionStationType == ExhibitionTest.testTypes.FORCE_SHOT)
+                       on_button_selector_start_force_sensor_clicked (new object (), new EventArgs());
+
+               frame_exhibition.Visible = true;
                notebook_session_person.CurrentPage = 1;
                frame_persons.Sensitive = true;
                spin_exhibition_school.Value = 0; //need to assign an inital value (if not it shows blank 
value)
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index a5f14c70..11a14835 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -199,7 +199,7 @@ public partial class ChronoJumpWindow
                }
 
                if(configChronojump.Exhibition)
-                       frame_exhibition.Visible = true;
+                       exhibitionGuiAtStart(configChronojump.ExhibitionStationType);
 
                configDo();
        }
diff --git a/src/json.cs b/src/json.cs
index 449ca603..02e01e4c 100644
--- a/src/json.cs
+++ b/src/json.cs
@@ -1398,7 +1398,7 @@ public class ExhibitionTest
 {
        public int sessionID; //includes school and class-group
        public int personID;
-       public enum testTypes { JUMP, RUN, FORCE_ROPE, FORCE_SHOT, INERTIAL }; //run will be a an intervallic 
run
+       public enum testTypes { JUMP, RUN, INERTIAL, FORCE_ROPE, FORCE_SHOT };
        public testTypes testType;
        public double result;
        /* result is:


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