Esempio n. 1
0
    /* ---------------------------------------------------------
     * ----------------  JUMPS EXECUTION (no RJ) ----------------
     *  --------------------------------------------------------
     */
    //suitable for all jumps not repetitive
    private void on_normal_jump_activate(object o, EventArgs args)
    {
        double jumpWeight = 0;
        if(currentJumpType.HasWeight) {
            if(extra_window_jumps_option == "%")
                jumpWeight = extra_window_jumps_weight;
            else
                jumpWeight = Util.WeightFromKgToPercent(extra_window_jumps_weight, currentPersonSession.Weight);
        }
        double myFall = 0;
        if(currentJumpType.Name == Constants.TakeOffName || currentJumpType.Name == Constants.TakeOffWeightName)
            myFall = 0;
        else if( ! currentJumpType.StartIn) {
            myFall = extra_window_jumps_fall;
        }

        //used by cancel and finish
        //currentEventType = new JumpType();
        currentEventType = currentJumpType;

        //hide jumping buttons
        sensitiveGuiEventDoing();

        //show the event doing window
        double progressbarLimit = 3; //3 phases for show the Dj
        if( currentJumpType.StartIn ||
                currentJumpType.Name == Constants.TakeOffName ||
                currentJumpType.Name == Constants.TakeOffWeightName)
            progressbarLimit = 2; //2 for normal jump (or take off)

        //don't let update until test finishes
        if(createdStatsWin)
            showUpdateStatsAndHideData(false);

        ExecutingGraphData egd = event_execute_initializeVariables(
            currentPerson.UniqueID,
            currentPerson.Name,
            Catalog.GetString("Phases"),  	  //name of the different moments
            Constants.JumpTable, //tableName
            currentJumpType.Name
            );

        event_execute_ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
        event_execute_ButtonFinish.Clicked += new EventHandler(on_finish_clicked);

        //when user clicks on update the eventExecute window
        //(for showing with his new confgured values: max, min and guides
        event_execute_ButtonUpdate.Clicked -= new EventHandler(on_update_clicked); //if we don't do this, on_update_clicked it's called 'n' times when 'n' events are done
        event_execute_ButtonUpdate.Clicked += new EventHandler(on_update_clicked);

        currentEventExecute = new JumpExecute(currentPerson.UniqueID, currentPerson.Name,
                currentSession.UniqueID, currentJumpType.Name, myFall, jumpWeight,
                chronopicWin.CP, event_execute_textview_message, app1, prefsDigitsNumber, volumeOn,
                progressbarLimit, egd);

        if (!chronopicWin.Connected)
            currentEventExecute.SimulateInitValues(rand);

        if( currentJumpType.StartIn )
            currentEventExecute.Manage();
         else
            currentEventExecute.ManageFall();

        thisJumpIsSimple = true; //used by: on_event_execute_update_graph_in_progress_clicked
        currentEventExecute.FakeButtonUpdateGraph.Clicked +=
            new EventHandler(on_event_execute_update_graph_in_progress_clicked);
        currentEventExecute.FakeButtonEventEnded.Clicked += new EventHandler(on_event_execute_EventEnded);
        currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished);
    }
Esempio n. 2
0
    /* ---------------------------------------------------------
     * ----------------  JUMPS EXECUTION (no RJ) ----------------
     *  --------------------------------------------------------
     */
    //suitable for all jumps not repetitive
    private void on_normal_jump_activate(bool canCaptureC)
    {
        if(execute_auto_doing)
            sensitiveGuiAutoExecuteOrWait (true);

        double jumpWeight = 0;
        if(currentJumpType.HasWeight) {
            if(extra_window_jumps_option == "%")
                jumpWeight = (double) extra_window_jumps_spinbutton_weight.Value;
            else
                jumpWeight = Util.WeightFromKgToPercent(
                        (double) extra_window_jumps_spinbutton_weight.Value,
                        currentPersonSession.Weight);
        }
        double myFall = 0;
        if(currentJumpType.HasFall) {
            if(extra_window_jumps_check_dj_fall_calculate.Active)
                myFall = -1;
            else
                myFall = (double) extra_window_jumps_spinbutton_fall.Value;
        }

        string description = "";
        if(currentJumpType.Name == "slCMJleft" || currentJumpType.Name == "slCMJright") {
            description = slCMJString();

            extra_window_jumps_spin_single_leg_distance.Value = 0;
            extra_window_jumps_spin_single_leg_angle.Value = 90;
        }

        //used by cancel and finish
        //currentEventType = new JumpType();
        currentEventType = currentJumpType;

        //hide jumping buttons
        if(! execute_auto_doing)
            sensitiveGuiEventDoing();

        //show the event doing window
        double progressbarLimit = 3; //3 phases for show the Dj
        if(myFall == -1)
            progressbarLimit = 4; //4 if there's a pre-jump
        else if( currentJumpType.StartIn ||
                currentJumpType.Name == Constants.TakeOffName ||
                currentJumpType.Name == Constants.TakeOffWeightName)
            progressbarLimit = 2; //2 for normal jump (or take off)

        //don't let update until test finishes
        if(createdStatsWin)
            showUpdateStatsAndHideData(false);

        event_execute_initializeVariables(
            ! canCaptureC,	//is simulated
            currentPerson.UniqueID,
            currentPerson.Name,
            Catalog.GetString("Phases"),  	  //name of the different moments
            Constants.JumpTable, //tableName
            currentJumpType.Name
            );
        event_execute_button_cancel.Sensitive = true;

        ExecutingGraphData egd = event_execute_prepareForTest ();

        event_execute_ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
        event_execute_ButtonFinish.Clicked += new EventHandler(on_finish_clicked);

        //when user clicks on update the eventExecute window
        //(for showing with his new confgured values: max, min and guides
        event_execute_ButtonUpdate.Clicked -= new EventHandler(on_update_clicked); //if we don't do this, on_update_clicked it's called 'n' times when 'n' events are done
        event_execute_ButtonUpdate.Clicked += new EventHandler(on_update_clicked);

        currentEventExecute = new JumpExecute(currentPerson.UniqueID, currentPerson.Name,
                currentSession.UniqueID, currentJumpType.Name, myFall, jumpWeight,
                //chronopicWin.CP, event_execute_label_message, app1, preferences.digitsNumber, preferences.volumeOn,
                cp2016.CP, event_execute_label_message, app1, preferences.digitsNumber, preferences.volumeOn,
                progressbarLimit, egd, description);

        //UtilGtk.ChronopicColors(viewport_chronopics, label_chronopics, label_connected_chronopics, chronopicWin.Connected);

        if (! canCaptureC)
            currentEventExecute.SimulateInitValues(rand);

        if( currentJumpType.StartIn )
            currentEventExecute.Manage();
        else
            currentEventExecute.ManageFall();

        thisJumpIsSimple = true; //used by: on_event_execute_update_graph_in_progress_clicked
        currentEventExecute.FakeButtonUpdateGraph.Clicked +=
            new EventHandler(on_event_execute_update_graph_in_progress_clicked);
        currentEventExecute.FakeButtonEventEnded.Clicked += new EventHandler(on_event_execute_EventEnded);

        currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished);
        currentEventExecute.FakeButtonThreadDyed.Clicked += new EventHandler(on_test_finished_can_touch_gtk);
    }