ComboGetActive() public static method

public static ComboGetActive ( ComboBox myCombo ) : string
myCombo ComboBox
return string
Example #1
0
    void on_button_accept_clicked(object o, EventArgs args)
    {
        int    eventID  = Convert.ToInt32(label_event_id_value.Text);
        string myPerson = UtilGtk.ComboGetActive(combo_persons);

        string [] myPersonFull = myPerson.Split(new char[] { ':' });

        string myDesc = entry_description.Text;


        updateEvent(eventID, Convert.ToInt32(myPersonFull[0]), myDesc);

        hideWindow();
    }
Example #2
0
    void on_entries_required_changed(object o, EventArgs args)
    {
        bool allOk = true;

        if (UtilGtk.ComboGetActive(combo_test_types) != Catalog.GetString(Constants.UndefinedDefault))
        {
            image_test_type.Hide();
            combo_tests.Sensitive     = true;
            combo_variables.Sensitive = true;
        }
        else
        {
            image_test_type.Show();
            combo_tests.Sensitive     = false;
            combo_variables.Sensitive = false;
            allOk = false;
        }

        //a continent cannot be searched without selecting the country
        if (UtilGtk.ComboGetActive(combo_continents) == Catalog.GetString(Constants.Any))
        {
            combo_countries.Sensitive = false;
            image_country.Hide();
        }
        else
        {
            combo_countries.Sensitive = true;
            if (UtilGtk.ComboGetActive(combo_countries) == Catalog.GetString(Constants.UndefinedDefault))
            {
                image_country.Show();
                allOk = false;
            }
            else
            {
                image_country.Hide();
            }
        }


        if (allOk)
        {
            textViewUpdate(sqlBuildSelect(false));
            button_search.Sensitive = true;
        }
        else
        {
            textViewUpdate("");
            button_search.Sensitive = false;
        }
    }
Example #3
0
    public string GetSelectedNameEnglish()
    {
        string nameTranslatedSelected = UtilGtk.ComboGetActive(combo);

        foreach (SelectTypes type in l_types)
        {
            if (type.NameTranslated == nameTranslatedSelected)
            {
                return(type.NameEnglish);
            }
        }

        return("");
    }
Example #4
0
    private void on_combo_ages2_changed(object o, EventArgs args)
    {
        string age2 = UtilGtk.ComboGetActive(combo_ages2);

        if (age2 == Catalog.GetString(Constants.Any))
        {
            spin_ages2.Sensitive = false;
        }
        else
        {
            spin_ages2.Sensitive = true;
        }

        on_entries_required_changed(new object(), new EventArgs());
    }
Example #5
0
    private void on_combo_ages1_changed(object o, EventArgs args)
    {
        string age1 = UtilGtk.ComboGetActive(combo_ages1);

        string [] ages2;

        //if (age1 == Catalog.GetString(Constants.Any) ||	age1 == equalThan) {
        if (age1 == Catalog.GetString(Constants.Any))
        {
            if (age1 == Catalog.GetString(Constants.Any))              //zero values
            {
                spin_ages1.Sensitive = false;
            }
            else
            {
                spin_ages1.Sensitive = true;
            }

            //no value 2
            label_age_and.Sensitive = false;
            combo_ages2.Sensitive   = false;
            spin_ages2.Sensitive    = false;

            ages2 = Util.StringToStringArray(Constants.Any);
        }
        else
        {
            spin_ages1.Sensitive    = true;
            label_age_and.Sensitive = true;
            combo_ages2.Sensitive   = true;
            spin_ages2.Sensitive    = true;
            //if (age1 == lowerThan || age1 == lowerOrEqualThan)
            if (age1 == lowerThan)
            {
                ages2 = ages2Higher;
            }
            else
            {
                ages2 = ages2Lower;
            }
        }

        UtilGtk.ComboUpdate(combo_ages2, ages2, "");
        combo_ages2.Active = UtilGtk.ComboMakeActive(ages2, Catalog.GetString(Constants.Any));

        on_entries_required_changed(new object(), new EventArgs());
    }
Example #6
0
    private string getEntriesString()
    {
        string str       = "";
        string separator = "";

        string ddString = dd0.Text + "-" + dd1.Text + "-" + dd2.Text + "-" + dd3.Text + "-" + dd4.Text + "-" +
                          dd5.Text + "-" + dd6.Text + "-" + dd7.Text + "-" + dd8.Text + "-" + dd9.Text;

        string [] s = ddString.Split(new char[] { '-' });

        for (int i = 0; i < Convert.ToInt32(UtilGtk.ComboGetActive(combo_distance_different_tracks)); i++)
        {
            str      += separator + s[i];
            separator = "-";
        }
        return(str);
    }
Example #7
0
 private void on_entries_required_changed(object o, EventArgs args)
 {
     if (
         entry_name.Text.Length > 0 &&
         entry_email.Text.Length > 0 &&
         label_date.Text.Length > 0 &&
         label_date.Text != Catalog.GetString(Constants.UndefinedDefault) &&
         UtilGtk.ComboGetActive(combo_countries) != Catalog.GetString(Constants.CountryUndefined) &&
         !radio_cp_undef.Active &&
         !(radio_cp_other.Active && entry_cp_other.Text.Length == 0) &&
         !radio_device_undef.Active &&
         !(radio_device_other.Active && entry_device_other.Text.Length == 0)
         )
     {
         button_accept.Sensitive = true;
     }
     else
     {
         button_accept.Sensitive = false;
     }
 }
Example #8
0
    private void printUnits(string result)
    {
        string testType = UtilGtk.ComboGetActive(combo_test_types);

        if (testType == Catalog.GetString(Constants.JumpSimpleName) ||
            testType == Catalog.GetString(Constants.JumpReactiveName))
        {
            label_results_num_units.Text = Catalog.GetString("jumps");
        }
        else if (testType == Catalog.GetString(Constants.RunSimpleName))
        {
            label_results_num_units.Text = Catalog.GetString("races");
        }

        string strVariable = UtilGtk.ComboGetActive(combo_variables);

        if (result == "0")
        {
            label_results_avg_units.Text = "";
        }
        else if (strVariable == "TV" || strVariable == "TC" || strVariable == Catalog.GetString("Time"))
        {
            label_results_avg_units.Text = Catalog.GetString("seconds");
        }
        else if (strVariable == Constants.RJPotencyBoscoFormula)
        {
            label_results_avg_units.Text = Catalog.GetString("watts");
        }
        else if (strVariable == Constants.QIndexFormula)
        {
            label_results_avg_units.Text = "";
        }
        else
        {
            label_results_avg_units.Text = "%";
        }
    }
 private void on_combo_d_num_changed(object o, EventArgs args)
 {
     reset_hbox_list_d(Convert.ToInt32(UtilGtk.ComboGetActive(combo_d_num)));
 }
    /*
     * Use this to retrieve values after accept
     * do not use to know current encoder configuration
     * because that is stored in gui/encoder as
     * encoderConfigurationCurrent
     */
    public EncoderConfiguration GetAcceptedValues()
    {
        EncoderConfiguration ec = (EncoderConfiguration)list[listCurrent];

        ec.d              = -1;
        ec.list_d         = new List <double>();
        ec.D              = -1;
        ec.anglePush      = -1;
        ec.angleWeight    = -1;
        ec.inertiaMachine = -1;

        if (ec.has_d)
        {
            if (ec.has_inertia)
            {
                ec.list_d = get_list_d();

                bool found = false;
                if (Util.IsNumber(main_gui_anchorage_str, true))
                {
                    LogB.Information("main_gui_anchorage = " + main_gui_anchorage_str);
                    double guiAnchorage = Convert.ToDouble(main_gui_anchorage_str);
                    foreach (double d in ec.list_d)
                    {
                        LogB.Information("d = " + d.ToString());
                        if (d == guiAnchorage)
                        {
                            ec.d  = guiAnchorage;
                            found = true;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    ec.d = ec.list_d[0];
                }
            }
            else
            {
                ec.d = (double)spin_d.Value;
            }
        }

        if (ec.has_D)
        {
            ec.D = (double)spin_D.Value;
        }

        if (ec.has_angle_push)
        {
            ec.anglePush = (int)spin_angle_push.Value;
        }

        if (ec.has_angle_weight)
        {
            ec.angleWeight = (int)spin_angle_weight.Value;
        }

        if (ec.has_inertia)
        {
            ec.inertiaMachine    = (int)spin_inertia_machine.Value;
            ec.inertiaTotal      = (int)spin_inertia_machine.Value;
            ec.extraWeightN      = main_gui_extraWeightN;
            ec.extraWeightGrams  = (int)spin_inertia_mass.Value;
            ec.extraWeightLength = (double)spin_inertia_length.Value;
        }

        if (ec.has_gearedDown)
        {
            ec.SetGearedDownFromDisplay(UtilGtk.ComboGetActive(combo_gearedUp));
        }

        return(ec);
    }
Example #11
0
    private void on_button_connect_cp_clicked(object o, EventArgs args)
    {
        if (o == null)
        {
            return;
        }

        if (isWindows)
        {
            if (o == button_connect_cp1)
            {
                ((ChronopicPortData)cpd[0]).Port = UtilGtk.ComboGetActive(combo_windows1);
            }
            else if (o == button_connect_cp2)
            {
                ((ChronopicPortData)cpd[1]).Port = UtilGtk.ComboGetActive(combo_windows2);
            }
            else if (o == button_connect_cp3)
            {
                ((ChronopicPortData)cpd[2]).Port = UtilGtk.ComboGetActive(combo_windows3);
            }
            else if (o == button_connect_cp4)
            {
                ((ChronopicPortData)cpd[3]).Port = UtilGtk.ComboGetActive(combo_windows4);
            }
        }
        else
        {
            if (o == button_connect_cp1)
            {
                ((ChronopicPortData)cpd[0]).Port = UtilGtk.ComboGetActive(combo_linux1);
            }
            else if (o == button_connect_cp2)
            {
                ((ChronopicPortData)cpd[1]).Port = UtilGtk.ComboGetActive(combo_linux2);
            }
            else if (o == button_connect_cp3)
            {
                ((ChronopicPortData)cpd[2]).Port = UtilGtk.ComboGetActive(combo_linux3);
            }
            else if (o == button_connect_cp4)
            {
                ((ChronopicPortData)cpd[3]).Port = UtilGtk.ComboGetActive(combo_linux4);
            }
        }

        if (o == button_connect_cp1)
        {
            currentCp = 1;
        }
        else if (o == button_connect_cp2)
        {
            currentCp = 2;
        }
        else if (o == button_connect_cp3)
        {
            currentCp = 3;
        }
        else         // if (o == button_connect_cp4)
        {
            currentCp = 4;
        }

        prepareChronopicConnection();
    }
Example #12
0
    protected void on_button_accept_clicked(object o, EventArgs args)
    {
        eval.Name      = entry_name.Text.ToString();
        eval.Email     = entry_email.Text.ToString();
        eval.DateBorn  = dateTime;
        eval.CountryID = Convert.ToInt32(
            Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries));

        eval.Comments = textview_comments.Buffer.Text;

        if (radio_cp_undef.Active)
        {
            eval.Chronometer = Constants.UndefinedDefault;
        }
        else if (radio_cp1.Active)
        {
            eval.Chronometer = Constants.ChronometerCp1;
        }
        else if (radio_cp2.Active)
        {
            eval.Chronometer = Constants.ChronometerCp2;
        }
        else if (radio_cp3.Active)
        {
            eval.Chronometer = Constants.ChronometerCp3;
        }
        else
        {
            eval.Chronometer = entry_cp_other.Text.ToString();
        }


        if (radio_device_undef.Active)
        {
            eval.Device = Constants.UndefinedDefault;
        }
        else if (radio_contact_steel.Active)
        {
            eval.Device = Constants.DeviceContactSteel;
        }
        else if (radio_contact_modular.Active)
        {
            eval.Device = Constants.DeviceContactCircuit;
        }
        else if (radio_infrared.Active)
        {
            eval.Device = Constants.DeviceInfrared;
        }
        else
        {
            eval.Device = entry_device_other.Text.ToString();
        }


        changed = false;
        if (creating)
        {
            eval.InsertAtDB(false);
            changed = true;
        }
        else
        {
            //1st see if there are changes
            if (eval.Equals(evalBefore))
            {
                //nothing changed
                //
                //new DialogMessage(Constants.MessageTypes.INFO, "nothing changed.\n");
            }
            else
            {
                //changed
                eval.Update(false);
                changed = true;
            }
        }

        fakeButtonAccept.Click();

        EvaluatorWindowBox.evaluator_window.Hide();
        EvaluatorWindowBox = null;
    }
Example #13
0
    private void on_combo_sports_changed(object o, EventArgs args)
    {
        if (o == null)
        {
            return;
        }

        //LogB.Information("changed");
        try {
            int sportID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports));
            sport = SqliteSport.Select(false, sportID);

            if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportAny))
            {
                //if sport is undefined, level should be undefined, and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                    combo_levels.Sensitive     = false;
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportNone))
            {
                //if sport is none, level should be sedentary and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelSedentaryID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelSedentary));
                    combo_levels.Sensitive = false;

                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));

                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else
            {
                //sport is not undefined and not none

                //if level is "sedentary", then change level to "undefined"
                if (UtilGtk.ComboGetActive(combo_levels) ==
                    Constants.LevelSedentaryID.ToString() + ":" +
                    Catalog.GetString(Constants.LevelSedentary))
                {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                }

                //show level
                combo_levels.Sensitive = true;

                if (sport.HasSpeciallities)
                {
                    combo_speciallities.Destroy();
                    createComboSpeciallities(sport.UniqueID);
                    label_speciallity.Show();
                    combo_speciallities.Show();
                }
                else
                {
                    LogB.Information("hide");
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
            }
        } catch {
            //LogB.Warning("do later");
        }

        on_entries_required_changed(new object(), new EventArgs());
        LogB.Information(sport.ToString());
    }
Example #14
0
    string sqlBuildSelect(bool performQuery)
    {
        string testType  = UtilGtk.ComboGetActive(combo_test_types);
        string tableName = "";

        if (testType == Catalog.GetString(Constants.JumpSimpleName))
        {
            tableName = Constants.JumpTable;
        }
        else if (testType == Catalog.GetString(Constants.JumpReactiveName))
        {
            tableName = Constants.JumpRjTable;
        }
        else if (testType == Catalog.GetString(Constants.RunSimpleName))
        {
            tableName = Constants.RunTable;
        }
        else
        {
            new DialogMessage(Constants.MessageTypes.WARNING, "Problem on sqlBuildSelect");
            return("");
        }

        string strVariable = UtilGtk.ComboGetActive(combo_variables);

        if (strVariable == Constants.DjIndexFormula)
        {
            strVariable = Constants.DjIndexFormulaOnly;
        }
        else if (strVariable == Constants.QIndexFormula)
        {
            strVariable = Constants.QIndexFormulaOnly;
        }
        else if (strVariable == Catalog.GetString("Average Index"))
        {
            strVariable = Constants.RjIndexFormulaOnly;
        }
        else if (strVariable == Constants.RJPotencyBoscoFormula)
        {
            strVariable = Constants.RJPotencyBoscoFormulaOnly;
        }

        /*
         * as in server maybe Catalog locale is different than in client
         * we cannot pass a localized "Any" hoping that will match server.
         * then if it's any, pass "" (if string) or corresponding undefined ID (if int)
         */

        int sexID = Constants.AnyID;

        if (UtilGtk.ComboGetActive(combo_sexes) == Catalog.GetString(Constants.Males))
        {
            sexID = Constants.MaleID;
        }
        else if (UtilGtk.ComboGetActive(combo_sexes) == Catalog.GetString(Constants.Females))
        {
            sexID = Constants.FemaleID;
        }

        /*
         * ageInterval can be:
         * "" -> any ages
         * ">=|30" -> higher or equal than 30
         * ">=|30|< |40" -> higher or equal than 30 and lower than 40
         */

        string ageInterval = "";
        string age1        = UtilGtk.ComboGetActive(combo_ages1);

        if (age1 != "" && age1 != Catalog.GetString(Constants.Any))
        {
            ageInterval  = age1.Substring(0, 2);           //get the code
            ageInterval += ":" + spin_ages1.Value.ToString();

            string age2 = UtilGtk.ComboGetActive(combo_ages2);
            if (age2 != "" && age2 != Catalog.GetString(Constants.Any))
            {
                ageInterval += ":" + age2.Substring(0, 2);                //get the code
                ageInterval += ":" + spin_ages2.Value.ToString();
            }
        }

        try {
            string sqlString = Sqlite.SQLBuildQueryString(
                tableName,
                UtilGtk.ComboGetActive(combo_tests),
                strVariable,
                sexID,
                ageInterval,
                Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries)),
                Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports)),
                Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
                Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
                Util.FetchID(UtilGtk.ComboGetActive(combo_evaluators))
                );

            if (performQuery)
            {
                ChronojumpServer myServer = new ChronojumpServer();
                myServer.ConnectDatabase();
                string result = myServer.Query(
                    tableName,
                    UtilGtk.ComboGetActive(combo_tests),
                    strVariable,
                    sexID,
                    ageInterval,
                    Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries)),
                    Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports)),
                    Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
                    Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
                    Util.FetchID(UtilGtk.ComboGetActive(combo_evaluators))
                    );
                myServer.DisConnectDatabase();

                string [] resultFull = result.Split(new char[] { ':' });
                label_results_num.Text = resultFull[0];

                printUnits(resultFull[0]);

                if (resultFull[0] == "0")
                {
                    label_results_avg.Text = "-";
                }
                else
                {
                    label_results_avg.Text = Util.TrimDecimals(
                        Util.ChangeDecimalSeparator(resultFull[1]), pDN);
                }
            }

            return(sqlString);
        } catch {
            //fix problem on changing continent that updates country and two signals come
            //also on run (maybe because there's no data)
            label_results_num.Text = "0";
            label_results_avg.Text = "-";
            printUnits("0");
            return("");
        }
    }
Example #15
0
 void on_combo_distance_different_tracks_changed(object o, EventArgs args)
 {
     reset_hbox_distance_variable(Convert.ToInt32(UtilGtk.ComboGetActive(combo_distance_different_tracks)));
 }
Example #16
0
    //change stuff in Sqlite and in preferences object that will be retrieved by GetPreferences
    void on_button_accept_clicked(object o, EventArgs args)
    {
        Sqlite.Open();

        if (preferences.digitsNumber != Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals)))
        {
            SqlitePreferences.Update("digitsNumber", UtilGtk.ComboGetActive(combo_decimals), true);
            preferences.digitsNumber = Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals));
        }

        if (preferences.showPower != PreferencesWindowBox.checkbutton_power.Active)
        {
            SqlitePreferences.Update("showPower", PreferencesWindowBox.checkbutton_power.Active.ToString(), true);
            preferences.showPower = PreferencesWindowBox.checkbutton_power.Active;
        }

        if (preferences.showStiffness != PreferencesWindowBox.checkbutton_stiffness.Active)
        {
            SqlitePreferences.Update("showStiffness", PreferencesWindowBox.checkbutton_stiffness.Active.ToString(), true);
            preferences.showStiffness = PreferencesWindowBox.checkbutton_stiffness.Active;
        }

        if (preferences.showInitialSpeed != PreferencesWindowBox.checkbutton_initial_speed.Active)
        {
            SqlitePreferences.Update("showInitialSpeed", PreferencesWindowBox.checkbutton_initial_speed.Active.ToString(), true);
            preferences.showInitialSpeed = PreferencesWindowBox.checkbutton_initial_speed.Active;
        }

        if (preferences.showAngle != PreferencesWindowBox.checkbutton_angle.Active)
        {
            SqlitePreferences.Update("showAngle", PreferencesWindowBox.checkbutton_angle.Active.ToString(), true);
            preferences.showAngle = PreferencesWindowBox.checkbutton_angle.Active;
        }

        if (PreferencesWindowBox.checkbutton_show_tv_tc_index.Active)
        {
            SqlitePreferences.Update("showQIndex", PreferencesWindowBox.radiobutton_show_q_index.Active.ToString(), true);
            SqlitePreferences.Update("showDjIndex", PreferencesWindowBox.radiobutton_show_dj_index.Active.ToString(), true);
            preferences.showQIndex  = PreferencesWindowBox.radiobutton_show_q_index.Active;
            preferences.showDjIndex = PreferencesWindowBox.radiobutton_show_dj_index.Active;
        }
        else
        {
            SqlitePreferences.Update("showQIndex", "False", true);
            SqlitePreferences.Update("showDjIndex", "False", true);
            preferences.showQIndex  = false;
            preferences.showDjIndex = false;
        }


        if (preferences.askDeletion != PreferencesWindowBox.checkbutton_ask_deletion.Active)
        {
            SqlitePreferences.Update("askDeletion", PreferencesWindowBox.checkbutton_ask_deletion.Active.ToString(), true);
            preferences.askDeletion = PreferencesWindowBox.checkbutton_ask_deletion.Active;
        }

        if (preferences.weightStatsPercent != PreferencesWindowBox.radio_weight_percent.Active)
        {
            SqlitePreferences.Update("weightStatsPercent", PreferencesWindowBox.radio_weight_percent.Active.ToString(), true);
            preferences.weightStatsPercent = PreferencesWindowBox.radio_weight_percent.Active;
        }

        if (preferences.heightPreferred != PreferencesWindowBox.radio_elevation_height.Active)
        {
            SqlitePreferences.Update("heightPreferred", PreferencesWindowBox.radio_elevation_height.Active.ToString(), true);
            preferences.heightPreferred = PreferencesWindowBox.radio_elevation_height.Active;
        }

        if (preferences.metersSecondsPreferred != PreferencesWindowBox.radio_speed_ms.Active)
        {
            SqlitePreferences.Update("metersSecondsPreferred", PreferencesWindowBox.radio_speed_ms.Active.ToString(), true);
            preferences.metersSecondsPreferred = PreferencesWindowBox.radio_speed_ms.Active;
        }

        if (preferences.runSpeedStartArrival != PreferencesWindowBox.radio_runs_speed_start_arrival.Active)
        {
            SqlitePreferences.Update("runSpeedStartArrival", PreferencesWindowBox.radio_runs_speed_start_arrival.Active.ToString(), true);
            preferences.runSpeedStartArrival = PreferencesWindowBox.radio_runs_speed_start_arrival.Active;
        }

        //start of double contacts stuff ----

        //1 simple runs ----

        //1.1 was FIRST or AVERAGE or LAST and now will be NONE
        if ((preferences.runDoubleContactsMode != Constants.DoubleContact.NONE) &&
            !PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active)
        {
            SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.NONE.ToString(), true);
            preferences.runDoubleContactsMode = Constants.DoubleContact.NONE;
        }
        else if (PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active)
        {
            //1.2 mode has changed between FIRST, AVERAGE or LAST
            if (PreferencesWindowBox.radio_runs_prevent_double_contact_first.Active &&
                (preferences.runDoubleContactsMode != Constants.DoubleContact.FIRST))
            {
                SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.FIRST.ToString(), true);
                preferences.runDoubleContactsMode = Constants.DoubleContact.FIRST;
            }
            else if (PreferencesWindowBox.radio_runs_prevent_double_contact_average.Active &&
                     (preferences.runDoubleContactsMode != Constants.DoubleContact.AVERAGE))
            {
                SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString(), true);
                preferences.runDoubleContactsMode = Constants.DoubleContact.AVERAGE;
            }
            else if (PreferencesWindowBox.radio_runs_prevent_double_contact_last.Active &&
                     (preferences.runDoubleContactsMode != Constants.DoubleContact.LAST))
            {
                SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.LAST.ToString(), true);
                preferences.runDoubleContactsMode = Constants.DoubleContact.LAST;
            }

            if (preferences.runDoubleContactsMS != (int)PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value)
            {
                SqlitePreferences.Update("runDoubleContactsMS",
                                         PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value.ToString(), true);        //saved as string
                preferences.runDoubleContactsMS = (int)spinbutton_runs_prevent_double_contact.Value;
            }
        }

        //2 intervallic runs ----

        //2.1 was FIRST or AVERAGE or LAST and now will be NONE
        if ((preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE) &&
            !PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active)
        {
            SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.NONE.ToString(), true);
            preferences.runIDoubleContactsMode = Constants.DoubleContact.NONE;
        }
        else if (PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active)
        {
            //2.2 mode has changed between FIRST, AVERAGE or LAST
            if (PreferencesWindowBox.radio_runs_i_prevent_double_contact_first.Active &&
                (preferences.runIDoubleContactsMode != Constants.DoubleContact.FIRST))
            {
                SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.FIRST.ToString(), true);
                preferences.runIDoubleContactsMode = Constants.DoubleContact.FIRST;
            }
            else if (PreferencesWindowBox.radio_runs_i_prevent_double_contact_average.Active &&
                     (preferences.runIDoubleContactsMode != Constants.DoubleContact.AVERAGE))
            {
                SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString(), true);
                preferences.runIDoubleContactsMode = Constants.DoubleContact.AVERAGE;
            }
            else if (PreferencesWindowBox.radio_runs_i_prevent_double_contact_last.Active &&
                     (preferences.runIDoubleContactsMode != Constants.DoubleContact.LAST))
            {
                SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.LAST.ToString(), true);
                preferences.runIDoubleContactsMode = Constants.DoubleContact.LAST;
            }

            if (preferences.runIDoubleContactsMS != (int)PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value)
            {
                SqlitePreferences.Update("runIDoubleContactsMS",
                                         PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value.ToString(), true);        //saved as string
                preferences.runIDoubleContactsMS = (int)spinbutton_runs_i_prevent_double_contact.Value;
            }
        }

        //---- end of double contacts stuff


        if (preferences.encoderPropulsive != PreferencesWindowBox.checkbutton_encoder_propulsive.Active)
        {
            SqlitePreferences.Update("encoderPropulsive",
                                     PreferencesWindowBox.checkbutton_encoder_propulsive.Active.ToString(), true);
            preferences.encoderPropulsive = PreferencesWindowBox.checkbutton_encoder_propulsive.Active;
        }

        if (preferences.encoderSmoothCon != (double)PreferencesWindowBox.spin_encoder_smooth_con.Value)
        {
            SqlitePreferences.Update("encoderSmoothCon", Util.ConvertToPoint(
                                         (double)PreferencesWindowBox.spin_encoder_smooth_con.Value), true);
            preferences.encoderSmoothCon = (double)PreferencesWindowBox.spin_encoder_smooth_con.Value;
        }

        if (preferences.videoDeviceNum != UtilGtk.ComboGetActivePos(combo_camera))
        {
            SqlitePreferences.Update("videoDevice", UtilGtk.ComboGetActivePos(combo_camera).ToString(), true);
            preferences.videoDeviceNum = UtilGtk.ComboGetActivePos(combo_camera);
        }


        if (PreferencesWindowBox.radio_export_latin.Active)
        {
            SqlitePreferences.Update("CSVExportDecimalSeparator", "COMMA", true);
            preferences.CSVExportDecimalSeparator = "COMMA";
        }
        else
        {
            SqlitePreferences.Update("CSVExportDecimalSeparator", "POINT", true);
            preferences.CSVExportDecimalSeparator = "POINT";
        }

        string selectedLanguage = getSelectedLanguage();

        //if there was a language on SQL but now "detected" is selected, put "" in language on SQL
        if (preferences.language != "" && radio_language_detected.Active)
        {
            SqlitePreferences.Update("language", "", true);
            preferences.language = "";
        }
        //if force a language, and SQL language is != than selected language, change language on SQL
        else if (radio_language_force.Active && preferences.language != selectedLanguage)
        {
            SqlitePreferences.Update("language", selectedLanguage, true);
            preferences.language = selectedLanguage;
        }


        if (preferences.RGraphsTranslate != PreferencesWindowBox.radio_graphs_translate.Active)
        {
            SqlitePreferences.Update("RGraphsTranslate",
                                     PreferencesWindowBox.radio_graphs_translate.Active.ToString(), true);
            preferences.RGraphsTranslate = PreferencesWindowBox.radio_graphs_translate.Active;
        }

        if (preferences.useHeightsOnJumpIndexes != PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active)
        {
            SqlitePreferences.Update("useHeightsOnJumpIndexes",
                                     PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active.ToString(), true);
            preferences.useHeightsOnJumpIndexes = PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active;
        }

        if (PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active)
        {
            SqlitePreferences.Update("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.BEST.ToString(), true);
            preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BEST;
        }
        else if (PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active)
        {
            SqlitePreferences.Update("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.ALL.ToString(), true);
            preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL;
        }
        else
        {
            SqlitePreferences.Update("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.NONE.ToString(), true);
            preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.NONE;
        }

        Constants.Encoder1RMMethod encoder1RMMethod;
        if (PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active)
        {
            encoder1RMMethod = Constants.Encoder1RMMethod.NONWEIGHTED;
        }
        else if (PreferencesWindowBox.radio_encoder_1RM_weighted.Active)
        {
            encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED;
        }
        else if (PreferencesWindowBox.radio_encoder_1RM_weighted2.Active)
        {
            encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED2;
        }
        else         // (PreferencesWindowBox.radio_encoder_1RM_weighted3.Active)
        {
            encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED3;
        }

        SqlitePreferences.Update("encoder1RMMethod", encoder1RMMethod.ToString(), true);
        preferences.encoder1RMMethod = encoder1RMMethod;

        Sqlite.Close();

        PreferencesWindowBox.preferences_win.Hide();
        PreferencesWindowBox = null;
    }
Example #17
0
 int getExerciseIDFromAnyCombo(Gtk.ComboBox combo, string [] comboArrayString, bool comboWithTranslation)
 {
     return(getExerciseIDFromName(comboArrayString, UtilGtk.ComboGetActive(combo), comboWithTranslation));
 }