QueryServerWindow.on_combo_sports_changed C# (CSharp) Method

on_combo_sports_changed() private method

private on_combo_sports_changed ( object o, EventArgs args ) : void
o object
args EventArgs
return void
    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());
    }