ComboUpdate() public static method

public static ComboUpdate ( ComboBox myCombo, string myData, string strDefault ) : int
myCombo ComboBox
myData string
strDefault string
return int
Beispiel #1
0
    private void on_combo_tests_changed(object o, EventArgs args)
    {
        if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.UndefinedDefault))
        {
            UtilGtk.ComboUpdate(combo_variables, Util.StringToStringArray(Constants.UndefinedDefault), "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.JumpSimpleName))
        {
            JumpType jt = SqliteJumpType.SelectAndReturnJumpType(UtilGtk.ComboGetActive(combo_tests), false);
            if (jt.StartIn)
            {
                UtilGtk.ComboUpdate(combo_variables, variablesJumpSimple, "");
            }
            else
            {
                UtilGtk.ComboUpdate(combo_variables, variablesJumpSimpleWithTC, "");
            }
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.JumpReactiveName))
        {
            UtilGtk.ComboUpdate(combo_variables, variablesJumpReactive, "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.RunSimpleName))
        {
            UtilGtk.ComboUpdate(combo_variables, variablesRunSimple, "");
        }
        else
        {
            new DialogMessage(Constants.MessageTypes.WARNING, "Problem on tests");
        }

        combo_variables.Active = 0;

        on_entries_required_changed(new object(), new EventArgs());
    }
Beispiel #2
0
    private void createComboSports()
    {
        combo_sports = ComboBox.NewText();
        sports       = SqliteSport.SelectAll();

        //first value has to be any
        sports[0] = Constants.SportUndefinedID + ":" +                                //no problem using the undefinedID
                    Constants.SportAny + ":" + Catalog.GetString(Constants.SportAny); //is "--Any" to be the first in sort

        //create sports translated, only with translated stuff
        sportsTranslated = new String[sports.Length];
        int i = 0;

        foreach (string row in sports)
        {
            string [] myStrFull = row.Split(new char[] { ':' });
            sportsTranslated[i++] = myStrFull[2];
        }

        //sort array (except second row)
        System.Array.Sort(sportsTranslated, 2, sportsTranslated.Length - 2);

        UtilGtk.ComboUpdate(combo_sports, sportsTranslated, "");
        combo_sports.Active = UtilGtk.ComboMakeActive(sportsTranslated,
                                                      Catalog.GetString(Constants.SportAny));

        combo_sports.Changed += new EventHandler(on_combo_sports_changed);

        UtilGtk.ComboPackShowAndSensitive(hbox_combo_sports, combo_sports);
    }
Beispiel #3
0
    /*
     * combos changed signals
     */

    private void on_combo_test_types_changed(object o, EventArgs args)
    {
        if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.UndefinedDefault))
        {
            tests     = new String[1];
            tests [0] = Catalog.GetString(Constants.UndefinedDefault);
            UtilGtk.ComboUpdate(combo_tests, tests, "");
            UtilGtk.ComboUpdate(combo_variables, tests, "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.JumpSimpleName))
        {
            UtilGtk.ComboUpdate(combo_tests,
                                SqliteJumpType.SelectJumpTypes(false, "", "", true), "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.JumpReactiveName))
        {
            UtilGtk.ComboUpdate(combo_tests,
                                SqliteJumpType.SelectJumpRjTypes("", true), "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.RunSimpleName))
        {
            UtilGtk.ComboUpdate(combo_tests,
                                SqliteRunType.SelectRunTypes("", true), "");
        }

        combo_tests.Active = 0;

        on_entries_required_changed(new object(), new EventArgs());
    }
Beispiel #4
0
    private void on_combo_continents_changed(object o, EventArgs args)
    {
        if (UtilGtk.ComboGetActive(combo_continents) == Catalog.GetString(Constants.ContinentUndefined))
        {
            countries [0]             = Constants.CountryUndefinedID + ":" + Constants.CountryUndefined + ":" + Catalog.GetString(Constants.CountryUndefined);
            countriesTranslated       = new String[1];
            countriesTranslated [0]   = Catalog.GetString(Constants.CountryUndefined);
            combo_countries.Sensitive = false;
        }
        else
        {
            //get the active continent
            string continentEnglish = Util.FindOnArray(':', 1, 0, UtilGtk.ComboGetActive(combo_continents), continents);
            countries = SqliteCountry.SelectCountriesOfAContinent(continentEnglish, true);             //put undefined first

            //create countries translated, only with translated stuff
            countriesTranslated = new String[countries.Length];
            int i = 0;
            foreach (string row in countries)
            {
                string [] myStrFull = row.Split(new char[] { ':' });
                countriesTranslated[i++] = myStrFull[2];
            }
        }
        //sort array (except first row)
        System.Array.Sort(countriesTranslated, 1, countriesTranslated.Length - 1);

        UtilGtk.ComboUpdate(combo_countries, countriesTranslated, "");
        combo_countries.Active = UtilGtk.ComboMakeActive(countriesTranslated,
                                                         Catalog.GetString(Constants.CountryUndefined));

        combo_countries.Sensitive = true;

        on_entries_required_changed(new object(), new EventArgs());
    }
Beispiel #5
0
    private void createComboSpeciallities(int sportID)
    {
        combo_speciallities = ComboBox.NewText();
        speciallities       = SqliteSpeciallity.SelectAll(true, sportID);   //show undefined, filter by sport

        //first value has to be any
        speciallities[0] = "-1:" + Constants.Any + ":" + Catalog.GetString(Constants.Any);

        //create speciallities translated, only with translated stuff
        speciallitiesTranslated = new String[speciallities.Length];
        int i = 0;

        foreach (string row in speciallities)
        {
            string [] myStrFull = row.Split(new char[] { ':' });
            speciallitiesTranslated[i++] = myStrFull[2];
        }

        //sort array (except first row)
        System.Array.Sort(speciallities, 1, speciallities.Length - 1);

        UtilGtk.ComboUpdate(combo_speciallities, speciallitiesTranslated, "");
        combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                             Catalog.GetString(Constants.Any));

        hbox_combo_speciallities.PackStart(combo_speciallities, true, true, 0);
        hbox_combo_speciallities.ShowAll();
        combo_speciallities.Sensitive = true;
        combo_speciallities.Changed  += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_speciallities, combo_speciallities);
    }
Beispiel #6
0
    private void createComboSelect()
    {
        combo_select = ComboBox.NewText();

        selectArray = new ArrayList(jumpTypes.Length);
        string [] jumpNamesToCombo = new String [jumpTypes.Length];
        int       i = 0;

        foreach (string jumpType in jumpTypes)
        {
            string [] j = jumpType.Split(new char[] { ':' });
            string    nameTranslated = Catalog.GetString(j[1]);

            jumpNamesToCombo[i] = nameTranslated;
            i++;

            ArrayList options = new ArrayList(3);
            options.Add("startIn:" + j[2]);                     //startIn
            options.Add("weight:" + j[3]);                      //weight
            options.Add("description:" + j[4]);                 //description
            TrCombo tc = new TrCombo(
                Convert.ToInt32(j[0]), j[1],                    //uniqueID, name
                nameTranslated, options);
            selectArray.Add(tc);
        }

        UtilGtk.ComboUpdate(combo_select, jumpNamesToCombo, "");
        combo_select.Active = 0;

        hbox_combo_select.PackStart(combo_select, true, true, 0);
        hbox_combo_select.ShowAll();
    }
Beispiel #7
0
 private void createComboSexes()
 {
     combo_sexes = ComboBox.NewText();
     UtilGtk.ComboUpdate(combo_sexes, sexes, "");
     combo_sexes.Active   = UtilGtk.ComboMakeActive(sexes, Catalog.GetString(Constants.Any));
     combo_sexes.Changed += new EventHandler(on_combo_other_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_sexes, combo_sexes);
 }
Beispiel #8
0
 private void createComboTestTypes()
 {
     combo_test_types = ComboBox.NewText();
     UtilGtk.ComboUpdate(combo_test_types, testTypes, "");
     combo_test_types.Active   = UtilGtk.ComboMakeActive(testTypes, Catalog.GetString(Constants.UndefinedDefault));
     combo_test_types.Changed += new EventHandler(on_combo_test_types_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_test_types, combo_test_types);
 }
Beispiel #9
0
 private void createComboVariables()
 {
     combo_variables = ComboBox.NewText();
     variables       = Util.StringToStringArray(Constants.UndefinedDefault);
     UtilGtk.ComboUpdate(combo_variables, variables, "");
     combo_variables.Active   = UtilGtk.ComboMakeActive(variables, Catalog.GetString(Constants.UndefinedDefault));
     combo_variables.Changed += new EventHandler(on_combo_other_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_variables, combo_variables);
 }
Beispiel #10
0
 private void createComboAges1()
 {
     combo_ages1 = ComboBox.NewText();
     UtilGtk.ComboUpdate(combo_ages1, ages1, "");
     combo_ages1.Active   = UtilGtk.ComboMakeActive(ages1, Catalog.GetString(Constants.Any));
     combo_ages1.Changed += new EventHandler(on_combo_ages1_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_ages1, combo_ages1);
     spin_ages1.Sensitive    = false;
     label_age_and.Sensitive = false;
 }
Beispiel #11
0
 private void createComboAges2()
 {
     combo_ages2 = ComboBox.NewText();
     string [] ages2 = Util.StringToStringArray(Constants.Any);
     UtilGtk.ComboUpdate(combo_ages2, ages2, "");
     combo_ages2.Active   = UtilGtk.ComboMakeActive(ages2, Catalog.GetString(Constants.Any));
     combo_ages2.Changed += new EventHandler(on_combo_ages2_changed);
     UtilGtk.ComboPackShowAndSensitive(hbox_combo_ages2, combo_ages2);
     combo_ages2.Sensitive = false;
     spin_ages2.Sensitive  = false;
 }
Beispiel #12
0
    protected void createComboEventType(Event myEvent)
    {
        combo_eventType = ComboBox.NewText();
        string [] myTypes = findTypes(myEvent);
        UtilGtk.ComboUpdate(combo_eventType, myTypes, "");
        combo_eventType.Active = UtilGtk.ComboMakeActive(myTypes, myEvent.Type);
        hbox_combo_eventType.PackStart(combo_eventType, true, true, 0);
        hbox_combo_eventType.ShowAll();

        createSignal();
    }
    public void SetComboValues(string [] values, string current)
    {
        combo = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo, values, "");

        hbox_combo.PackStart(combo, true, true, 0);
        hbox_combo.ShowAll();
        combo.Sensitive = true;

        combo.Active = UtilGtk.ComboMakeActive(values, current);
    }
    private void createComboEncoderAutomaticVariable()
    {
        combo_encoder_variable_automatic = ComboBox.NewText();
        string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, Constants.MaxForce, Constants.MeanPower, Constants.PeakPower };
        UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, "");
        combo_encoder_variable_automatic.Active = UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power");

        hbox_combo_encoder_variable_automatic.PackStart(combo_encoder_variable_automatic, false, false, 0);
        hbox_combo_encoder_variable_automatic.ShowAll();
        combo_encoder_variable_automatic.Sensitive = true;
    }
Beispiel #15
0
    private void createComboEvaluators()
    {
        combo_evaluators = ComboBox.NewText();

        //first value (any) should be translated
        evaluators[0] = Constants.AnyID.ToString() + ":" + Catalog.GetString(Constants.Any);

        UtilGtk.ComboUpdate(combo_evaluators, evaluators, "");
        combo_evaluators.Active   = UtilGtk.ComboMakeActive(combo_evaluators, Catalog.GetString(Constants.Any));
        combo_evaluators.Changed += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_evaluators, combo_evaluators);
    }
Beispiel #16
0
    //if we just need to update values, call only this method
    public void Fill()
    {
        select();

        string [] namesToCombo = new String [l_types.Count];
        int       i            = 0;

        foreach (SelectTypes type in l_types)
        {
            namesToCombo[i++] = type.NameTranslated;
        }

        UtilGtk.ComboUpdate(combo, namesToCombo, "");
        combo.Active = 0;
    }
Beispiel #17
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());
    }
Beispiel #18
0
    private void createComboCountries()
    {
        combo_countries = ComboBox.NewText();

        countries = new String[1];
        //record countries with id:english name:translatedName
        countries [0] = Constants.CountryUndefinedID + ":" + Constants.CountryUndefined + ":" + Catalog.GetString(Constants.CountryUndefined);

        string [] myCountries = new String[1];
        myCountries [0] = Catalog.GetString(Constants.CountryUndefined);
        UtilGtk.ComboUpdate(combo_countries, myCountries, "");
        combo_countries.Active = UtilGtk.ComboMakeActive(myCountries,
                                                         Catalog.GetString(Constants.CountryUndefined));

        combo_countries.Changed += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_countries, combo_countries);
    }
Beispiel #19
0
    private void createComboLevels()
    {
        combo_levels = ComboBox.NewText();
        levels       = Constants.Levels;

        //first value has to be any (but is ok to put the id value of the LevelUndefinedID)
        levels[0] = Constants.LevelUndefinedID.ToString() + ":" + Catalog.GetString(Constants.Any);

        UtilGtk.ComboUpdate(combo_levels, levels, "");
        combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                      Constants.LevelUndefinedID.ToString() + ":" +
                                                      Catalog.GetString(Constants.Any));

        hbox_combo_levels.PackStart(combo_levels, true, true, 0);
        hbox_combo_levels.ShowAll();
        combo_levels.Sensitive = false;         //level is shown when sport is not "undefined" and not "none"
        combo_levels.Changed  += new EventHandler(on_combo_other_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_levels, combo_levels);
    }
    public void CreateComboCheckBoxes()
    {
        if (hbox_combo_all_none_selected.Children.Length > 0)
        {
            hbox_combo_all_none_selected.Remove(combo_all_none_selected);
        }

        combo_all_none_selected = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo_all_none_selected, comboCheckBoxesOptions, "");

        //combo_all_none_selected.DisableActivate ();
        combo_all_none_selected.Changed += new EventHandler(on_combo_all_none_selected_changed);

        hbox_combo_all_none_selected.PackStart(combo_all_none_selected, true, true, 0);
        hbox_combo_all_none_selected.ShowAll();
        combo_all_none_selected.Sensitive = true;

        combo_all_none_selected.Active =
            UtilGtk.ComboMakeActive(comboCheckBoxesOptions, Catalog.GetString("Selected"));
    }
Beispiel #21
0
    private void createComboCamera(string [] devices, int current)
    {
        combo_camera = ComboBox.NewText();

        if (devices.Length == 0)
        {
            devices = Util.StringToStringArray(Constants.CameraNotFound);
            current = 0;
        }

        UtilGtk.ComboUpdate(combo_camera, devices, "");
        hbox_combo_camera.PackStart(combo_camera, true, true, 0);
        hbox_combo_camera.ShowAll();

        if (current >= devices.Length)
        {
            current = 0;
        }

        combo_camera.Active = UtilGtk.ComboMakeActive(devices, devices[current]);
    }
Beispiel #22
0
    private void createComboContinents()
    {
        combo_continents = ComboBox.NewText();
        continents       = Constants.Continents;
        //first value has to be any
        continents[0] = Constants.Any + ":" + Catalog.GetString(Constants.Any);

        //create continentsTranslated, only with translated stuff
        continentsTranslated = new String[Constants.Continents.Length];
        int i = 0;

        foreach (string continent in continents)
        {
            continentsTranslated[i++] = Util.FetchName(continent);
        }

        UtilGtk.ComboUpdate(combo_continents, continentsTranslated, "");
        combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated,
                                                          Catalog.GetString(Constants.Any));

        combo_continents.Changed += new EventHandler(on_combo_continents_changed);
        UtilGtk.ComboPackShowAndSensitive(hbox_combo_continents, combo_continents);
    }
Beispiel #23
0
    private void createComboContinents()
    {
        combo_continents = ComboBox.NewText();
        continents       = Constants.Continents;

        //create continentsTranslated, only with translated stuff
        continentsTranslated = new String[Constants.Continents.Length];
        int i = 0;

        foreach (string continent in continents)
        {
            continentsTranslated[i++] = Util.FetchName(continent);
        }

        UtilGtk.ComboUpdate(combo_continents, continentsTranslated, "");
        combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated,
                                                          Catalog.GetString(Constants.ContinentUndefined));

        combo_continents.Changed += new EventHandler(on_combo_continents_changed);

        hbox_combo_continents.PackStart(combo_continents, true, true, 0);
        hbox_combo_continents.ShowAll();
        combo_continents.Sensitive = true;
    }
Beispiel #24
0
    protected void fillDialog(Event myEvent)
    {
        fillWindowTitleAndLabelHeader();

        string id = myEvent.UniqueID.ToString();

        if (myEvent.Simulated == Constants.Simulated)
        {
            label_simulated.Show();
        }

        label_event_id_value.Text      = id;
        label_event_id_value.UseMarkup = true;

        if (showTv)
        {
            fillTv(myEvent);
        }
        else
        {
            label_tv_title.Hide();
            entry_tv_value.Hide();
            label_tv_units.Hide();
        }

        if (showTc)
        {
            fillTc(myEvent);
        }
        else
        {
            label_tc_title.Hide();
            entry_tc_value.Hide();
            label_tc_units.Hide();
        }

        if (showFall)
        {
            fillFall(myEvent);
        }
        else
        {
            label_fall_title.Hide();
            entry_fall_value.Hide();
            label_fall_units.Hide();
        }

        if (showDistance)
        {
            fillDistance(myEvent);
        }
        else
        {
            label_distance_title.Hide();
            entry_distance_value.Hide();
            label_distance_units.Hide();
        }

        if (showTime)
        {
            fillTime(myEvent);
        }
        else
        {
            label_time_title.Hide();
            entry_time_value.Hide();
            label_time_units.Hide();
        }

        if (showSpeed)
        {
            fillSpeed(myEvent);
        }
        else
        {
            label_speed_title.Hide();
            label_speed_value.Hide();
            label_speed_units.Hide();
        }

        if (showWeight)
        {
            fillWeight(myEvent);
        }
        else
        {
            label_weight_title.Hide();
            entry_weight_value.Hide();
            label_weight_units.Hide();
        }

        if (showLimited)
        {
            fillLimited(myEvent);
        }
        else
        {
            label_limited_title.Hide();
            label_limited_value.Hide();
        }

        if (showAngle)
        {
            fillAngle(myEvent);
        }
        else
        {
            label_angle_title.Hide();
            entry_angle_value.Hide();
            label_angle_units.Hide();
        }

        if (!showMistakes)
        {
            label_mistakes.Hide();
            spin_mistakes.Hide();
        }


        //also remove new line for old descriptions that used a textview
        string temp = Util.RemoveTildeAndColonAndDot(myEvent.Description);

        entry_description.Text = Util.RemoveNewLine(temp, true);

        createComboEventType(myEvent);

        if (!showType)
        {
            label_type_title.Hide();
            combo_eventType.Hide();
        }

        if (showRunStart)
        {
            fillRunStart(myEvent);
        }
        else
        {
            label_run_start_title.Hide();
            label_run_start_value.Hide();
        }

        ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(
            myEvent.SessionID,
            false);                     //means: do not returnPersonAndPSlist

        string [] personsStrings = new String[persons.Count];
        int       i = 0;

        foreach (Person person in persons)
        {
            personsStrings[i++] = person.IDAndName(":");
        }

        combo_persons = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo_persons, personsStrings, "");
        combo_persons.Active = UtilGtk.ComboMakeActive(personsStrings, myEvent.PersonID + ":" + myEvent.PersonName);

        oldPersonID = myEvent.PersonID;

        hbox_combo_person.PackStart(combo_persons, true, true, 0);
        hbox_combo_person.ShowAll();

        //show video if available
        videoFileName = Util.GetVideoFileName(myEvent.SessionID, typeOfTest, myEvent.UniqueID);
        if (File.Exists(videoFileName))
        {
            label_video_yes.Visible      = true;
            label_video_no.Visible       = false;
            button_video_watch.Sensitive = true;
            button_video_url.Sensitive   = true;
        }
        else
        {
            label_video_yes.Visible      = false;
            label_video_no.Visible       = true;
            button_video_watch.Sensitive = false;
            button_video_url.Sensitive   = false;
        }
    }
Beispiel #25
0
    private void createComboLinux()
    {
        //string [] serial = Directory.GetFiles("/dev/", "ttyS*");
        string [] usbSerial    = Directory.GetFiles("/dev/", "ttyUSB*");
        string [] usbSerialMac = Directory.GetFiles("/dev/", "tty.usbserial*");
        string [] all          = Util.AddArrayString(usbSerial, usbSerialMac);

        string [] def = Util.StringToStringArray(Constants.ChronopicDefaultPortLinux);

        string [] allWithDef = Util.AddArrayString(def, all);

        UtilGtk.ComboUpdate(combo_linux1, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux2, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux3, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux4, allWithDef, Constants.ChronopicDefaultPortLinux);

        foreach (ChronopicPortData a in cpd)
        {
            if (a.Num == 1)
            {
                combo_linux1.Active   = UtilGtk.ComboMakeActive(combo_linux1, a.Port);
                combo_linux1.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux2, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else if (a.Num == 2)
            {
                combo_linux2.Active   = UtilGtk.ComboMakeActive(combo_linux2, a.Port);
                combo_linux2.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else if (a.Num == 3)
            {
                combo_linux3.Active   = UtilGtk.ComboMakeActive(combo_linux3, a.Port);
                combo_linux3.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else                 //4
            {
                combo_linux4.Active   = UtilGtk.ComboMakeActive(combo_linux4, a.Port);
                combo_linux4.Changed += new EventHandler(on_combo_changed);
            }
        }

        //encoder
        //this reduces the callbacks of combo change
        combo_linux_encoder.Sensitive = false;

        UtilGtk.ComboUpdate(combo_linux_encoder, allWithDef, encoderPort);

        combo_linux_encoder.Changed += new EventHandler(on_combo_changed);

        combo_linux_encoder.Active = UtilGtk.ComboMakeActive(allWithDef, encoderPort);

        combo_linux_encoder.Sensitive = true;
    }
    private void comboEncoderMainVariableFill()
    {
        string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, Constants.MaxForce, Constants.MeanPower, Constants.PeakPower };

        UtilGtk.ComboUpdate(combo_encoder_main_variable, values, "");
    }
Beispiel #27
0
    //private void createComboWindows(string myPort, Gtk.ComboBox myCombo) {
    private void createComboWindows()
    {
        //combo port stuff
        comboWindowsOptions = new string[32];
        //for (int i=1; i <= 32; i ++)
        //comboWindowsOptions[i-1] = "COM" + i;
        comboWindowsOptions = SerialPort.GetPortNames();

        string [] def        = Util.StringToStringArray(Constants.ChronopicDefaultPortWindows);
        string [] allWithDef = Util.AddArrayString(def, comboWindowsOptions);

        UtilGtk.ComboUpdate(combo_windows1, allWithDef, Constants.ChronopicDefaultPortWindows);
        UtilGtk.ComboUpdate(combo_windows2, allWithDef, Constants.ChronopicDefaultPortWindows);
        UtilGtk.ComboUpdate(combo_windows3, allWithDef, Constants.ChronopicDefaultPortWindows);
        UtilGtk.ComboUpdate(combo_windows4, allWithDef, Constants.ChronopicDefaultPortWindows);

        foreach (ChronopicPortData a in cpd)
        {
            if (a.Num == 1)
            {
                combo_windows1.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows1.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_windows2, a.Port);
                    UtilGtk.ComboDelThisValue(combo_windows3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_windows4, a.Port);
                }
            }
            else if (a.Num == 2)
            {
                combo_windows2.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows2.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_windows3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_windows4, a.Port);
                }
            }
            else if (a.Num == 3)
            {
                combo_windows3.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows3.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_windows4, a.Port);
                }
            }
            else                 //4
            {
                combo_windows4.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows4.Changed += new EventHandler(on_combo_changed);
            }
        }

        //encoder
        //this reduces the callbacks of combo change
        combo_windows_encoder.Sensitive = false;

        UtilGtk.ComboUpdate(combo_windows_encoder, allWithDef, encoderPort);

        combo_windows_encoder.Changed += new EventHandler(on_combo_changed);

        combo_windows_encoder.Active = UtilGtk.ComboMakeActive(allWithDef, encoderPort);

        combo_windows_encoder.Sensitive = true;
    }