예제 #1
0
    protected override void write()
    {
        LogB.Information(string.Format("TIME: {0}", time.ToString()));

        /*
         * string myStringPush =   Catalog.GetString("Last run") + ": " + RunnerName + " " +
         *      type + " " + Catalog.GetString("time") + ": " + Util.TrimDecimals( time.ToString(), pDN ) +
         *      " " + Catalog.GetString("speed") + ": " + Util.TrimDecimals ( (distance/time).ToString(), pDN );
         */
        if (simulated)
        {
            feedbackMessage = Catalog.GetString(Constants.SimulatedMessage);
        }
        else
        {
            feedbackMessage = "";
        }
        needShowFeedbackMessage = true;


        string description = "";

        if (type == "Margaria")
        {
            // P = W * 9.8 * D / t
            // W: person weight
            // D: distance between 3d and 9th stair
            double weight         = SqlitePersonSession.SelectAttribute(false, personID, sessionID, Constants.Weight);
            double distanceMeters = distance / 1000;
            description = "P = " + Util.TrimDecimals((weight * 9.8 * distanceMeters / time).ToString(), pDN) + " (Watts)";
        }
        else if (type == "Gesell-DBT")
        {
            description = "0";
        }


        string table = Constants.RunTable;

        uniqueID = SqliteRun.Insert(false, table, "NULL", personID, sessionID,
                                    type, distance, time, description,
                                    Util.BoolToNegativeInt(simulated),
                                    !startIn    //initialSpeed true if not startIn
                                    );

        //define the created object
        eventDone = new Run(uniqueID, personID, sessionID, type, distance, time, description, Util.BoolToNegativeInt(simulated), !startIn);


        //event will be raised, and managed in chronojump.cs
        fakeButtonFinished.Click();

        //app1.PrepareRunSimpleGraph(time, distance/time);
        PrepareEventGraphRunSimpleObject = new PrepareEventGraphRunSimple(time, distance / time, sessionID, personID, table, type);
        needUpdateGraphType = eventType.RUN;
        needUpdateGraph     = true;

        needEndEvent = true;         //used for hiding some buttons on eventWindow
    }
예제 #2
0
파일: run.cs 프로젝트: GNOME/chronojump
    private void updateGraphRunsSimple()
    {
        if(currentPerson == null || currentSession == null)
            return;

        //intializeVariables if not done before
        event_execute_initializeVariables(
            ! cp2016.StoredCanCaptureContacts, //is simulated
            currentPerson.UniqueID,
            currentPerson.Name,
            Catalog.GetString("Phases"),  	  //name of the different moments
            Constants.RunTable, //tableName
            currentRunType.Name
            );

        PrepareEventGraphRunSimple eventGraph = new PrepareEventGraphRunSimple(
                1, 1, //both unused
                   	currentSession.UniqueID, currentPerson.UniqueID, Constants.RunTable, currentEventType.Name);

        if(eventGraph.personMAXAtSQLAllSessions > 0 || eventGraph.runsAtSQL.Length > 0)
            PrepareRunSimpleGraph(eventGraph, false); //don't animate
    }
예제 #3
0
파일: run.cs 프로젝트: GNOME/chronojump
    protected override void write()
    {
        LogB.Information(string.Format("TIME: {0}", time.ToString()));

        /*
        string myStringPush =   Catalog.GetString("Last run") + ": " + RunnerName + " " +
            type + " " + Catalog.GetString("time") + ": " + Util.TrimDecimals( time.ToString(), pDN ) +
            " " + Catalog.GetString("speed") + ": " + Util.TrimDecimals ( (distance/time).ToString(), pDN );
        */
        if(simulated)
            feedbackMessage = Catalog.GetString(Constants.SimulatedMessage);
        else
            feedbackMessage = "";
        needShowFeedbackMessage = true;

        string description = "";
        if(type == "Margaria") {
            // P = W * 9.8 * D / t
            // W: person weight
            // D: distance between 3d and 9th stair
            double weight = SqlitePersonSession.SelectAttribute(false, personID, sessionID, Constants.Weight);
            double distanceMeters = distance / 1000;
            description = "P = " + Util.TrimDecimals ( (weight * 9.8 * distanceMeters / time).ToString(), pDN) + " (Watts)";
        } else if(type == "Gesell-DBT")
            description = "0";

        string table = Constants.RunTable;

        uniqueID = SqliteRun.Insert(false, table, "NULL", personID, sessionID,
                type, distance, time, description,
                Util.BoolToNegativeInt(simulated),
                !startIn	//initialSpeed true if not startIn
                );

        //define the created object
        eventDone = new Run(uniqueID, personID, sessionID, type, distance, time, description, Util.BoolToNegativeInt(simulated), !startIn);

        //event will be raised, and managed in chronojump.cs
        fakeButtonFinished.Click();

        //app1.PrepareRunSimpleGraph(time, distance/time);
        PrepareEventGraphRunSimpleObject = new PrepareEventGraphRunSimple(time, distance/time, sessionID, personID, table, type);
        needUpdateGraphType = eventType.RUN;
        needUpdateGraph = true;

        needEndEvent = true; //used for hiding some buttons on eventWindow
    }