private void encoder_rhythm_set_values(EncoderRhythm encoderRhythm)
    {
        check_rhythm_active.Active = encoderRhythm.Active;

        /*
         * if(encoderRhythm.RepsOrPhases)
         *      radio_rhythm_together.Active = true;
         * else
         *      radio_rhythm_separated.Active = true;
         */
        //just before 1.8.0 always use separated
        radio_rhythm_separated.Active = true;

        //spin_rhythm_rep.Value = encoderRhythm.RepSeconds;
        spin_rhythm_ecc.Value           = encoderRhythm.EccSeconds;
        spin_rhythm_con.Value           = encoderRhythm.ConSeconds;
        spin_rhythm_rest_reps.Value     = encoderRhythm.RestRepsSeconds;
        spin_rhythm_reps_cluster.Value  = encoderRhythm.RepsCluster;
        spin_rhythm_rest_clusters.Value = encoderRhythm.RestClustersSeconds;

        frame_rhythm.Visible = check_rhythm_active.Active;

        if (encoderRhythm.RepsOrPhases)
        {
            notebook_duration_repetition.CurrentPage = 0;
        }
        else
        {
            notebook_duration_repetition.CurrentPage = 1;
        }

        if (encoderRhythm.RestRepsSeconds < 0.1)
        {
            check_rhythm_rest_reps.Active = false;
        }

        if (encoderRhythm.UseClusters())
        {
            check_rhythm_use_clusters.Active = true;
            vbox_rhythm_cluster.Visible      = true;
        }
        else
        {
            check_rhythm_use_clusters.Active = false;
            vbox_rhythm_cluster.Visible      = false;
        }

        should_show_vbox_rhythm_rest_after();
    }
Exemplo n.º 2
0
    private phases getNextPhase(phases previousPhase)
    {
        //manage what happens after cluster rest or if we should start a cluster rest
        if (encoderRhythm.UseClusters())
        {
            //check what happens after cluster rest
            if (previousPhase == phases.RESTCLUSTER)
            {
                if (encoderRhythm.RepsOrPhases)
                {
                    return(phases.REPETITION);
                }
                else if (gravitatory && !encoderRhythm.RestAfterEcc)                 //ecc-con
                {
                    return(phases.ECC);
                }
                else                 // ! gravitatory or gravitatory resting after ecc
                {
                    return(phases.CON);
                }
            }

            //check if we are on (REPETITION or ECC or CON) and we should start a cluster rest
            if
            (nreps > 0 && nreps % encoderRhythm.RepsCluster == 0 &&
             (previousPhase == phases.REPETITION ||
              (previousPhase == phases.CON && gravitatory && !encoderRhythm.RestAfterEcc) ||
              (previousPhase == phases.ECC && (!gravitatory || encoderRhythm.RestAfterEcc))
             )
            )
            {
                return(phases.RESTCLUSTER);
            }
        }

        if (encoderRhythm.RepsOrPhases)
        {
            if (previousPhase == phases.REPETITION)
            {
                if (encoderRhythm.RestRepsSeconds == 0)
                {
                    return(phases.REPETITION);
                }
                else
                {
                    return(phases.RESTREP);
                }
            }
            else               //RESTREP
            {
                return(phases.REPETITION);
            }
        }

        if (gravitatory && !encoderRhythm.RestAfterEcc)         //ecc-con
        {
            if (previousPhase == phases.ECC)
            {
                return(phases.CON);
            }
            else if (previousPhase == phases.CON)
            {
                if (encoderRhythm.RestRepsSeconds == 0)
                {
                    return(phases.ECC);
                }
                else
                {
                    return(phases.RESTREP);
                }
            }
            else             //(previousPhase == phases.RESTREP)
            {
                return(phases.ECC);
            }
        }

        else         // ! gravitatory or gravitatory resting after ecc
        {
            if (previousPhase == phases.CON)
            {
                return(phases.ECC);
            }
            else if (previousPhase == phases.ECC)
            {
                if (encoderRhythm.RestRepsSeconds == 0)
                {
                    return(phases.CON);
                }
                else
                {
                    return(phases.RESTREP);
                }
            }
            else             //(previousPhase == phases.RESTREP)
            {
                return(phases.CON);
            }
        }
    }