[chronojump] SqliteForceSensor.Select returns List<>



commit 7445b3847a074b9667603d0b5796702ad6533ea3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Oct 24 11:03:50 2019 +0200

    SqliteForceSensor.Select returns List<>

 src/gui/forceSensor.cs    | 5 ++---
 src/sqlite/forceSensor.cs | 8 ++++----
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index e4ebea0f..824948ec 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -1437,7 +1437,7 @@ LogB.Information(" fs R ");
        //very based on: on_encoder_load_signal_clicked () future have some inheritance
        private void on_button_force_sensor_load_clicked (object o, EventArgs args)
        {
-               ArrayList data = SqliteForceSensor.Select(false, -1, currentPerson.UniqueID, 
currentSession.UniqueID);
+               List<ForceSensor> data = SqliteForceSensor.Select(false, -1, currentPerson.UniqueID, 
currentSession.UniqueID);
 
                ArrayList dataPrint = new ArrayList();
                int count = 1;
@@ -1513,8 +1513,7 @@ LogB.Information(" fs R ");
 
                genericWin.HideAndNull();
 
-               ArrayList data = SqliteForceSensor.Select(false, uniqueID, currentPerson.UniqueID, 
currentSession.UniqueID);
-               ForceSensor fs = (ForceSensor) data[0];
+               ForceSensor fs = (ForceSensor) SqliteForceSensor.Select(false, uniqueID, 
currentPerson.UniqueID, currentSession.UniqueID)[0];
                if(fs == null)
                {
                        new DialogMessage(Constants.MessageTypes.WARNING, Constants.FileNotFoundStr());
diff --git a/src/sqlite/forceSensor.cs b/src/sqlite/forceSensor.cs
index 90f22024..9a0d21d3 100644
--- a/src/sqlite/forceSensor.cs
+++ b/src/sqlite/forceSensor.cs
@@ -133,7 +133,7 @@ class SqliteForceSensor : Sqlite
        }
 
        //SELECT forceSensor.*, forceSensorExercise.Name FROM forceSensor, forceSensorExercise WHERE 
forceSensor.exerciseID = forceSensorExercise.UniqueID ORDER BY forceSensor.uniqueID;
-       public static ArrayList Select (bool dbconOpened, int uniqueID, int personID, int sessionID)
+       public static List<ForceSensor> Select (bool dbconOpened, int uniqueID, int personID, int sessionID)
        {
                openIfNeeded(dbconOpened);
 
@@ -160,7 +160,7 @@ class SqliteForceSensor : Sqlite
                SqliteDataReader reader;
                reader = dbcmd.ExecuteReader();
 
-               ArrayList array = new ArrayList(1);
+               List<ForceSensor> list = new List<ForceSensor>();
                ForceSensor fs;
 
                while(reader.Read()) {
@@ -183,13 +183,13 @@ class SqliteForceSensor : Sqlite
                                        reader[13].ToString(),                  //stiffnessString
                                        reader[14].ToString()                   //exerciseName
                                        );
-                       array.Add(fs);
+                       list.Add(fs);
                }
 
                reader.Close();
                closeIfNeeded(dbconOpened);
 
-               return array;
+               return list;
        }
 
        public static ArrayList SelectRowsOfAnExercise(bool dbconOpened, int exerciseID)


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