Пример #1
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());
    }
Пример #2
0
    private void fillDialog()
    {
        entry_name.Text  = eval.Name;
        entry_email.Text = eval.Email;

        Console.Write(creating.ToString());
        if (creating)
        {
            label_date.Text = Catalog.GetString(Constants.UndefinedDefault);
        }
        else
        {
            dateTime = eval.DateBorn;
            if (dateTime == DateTime.MinValue)
            {
                label_date.Text = Catalog.GetString(Constants.UndefinedDefault);
            }
            else
            {
                label_date.Text = dateTime.ToLongDateString();
            }
        }

        if (!creating)
        {
            //country stuff
            if (eval.CountryID != Constants.CountryUndefinedID)
            {
                string [] countryString = SqliteCountry.Select(eval.CountryID);
                combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated,
                                                                  Catalog.GetString(countryString[3]));
                combo_countries.Active = UtilGtk.ComboMakeActive(countriesTranslated,
                                                                 Catalog.GetString(countryString[1]));
            }

            label_confiable.Text = eval.Confiable.ToString();

            TextBuffer tb = new TextBuffer(new TextTagTable());
            tb.Text = eval.Comments;
            textview_comments.Buffer = tb;

            switch (eval.Chronometer)
            {
            case "":
            case Constants.UndefinedDefault:
                radio_cp_undef.Active = true;
                break;

            case Constants.ChronometerCp1:
                radio_cp1.Active = true;
                break;

            case Constants.ChronometerCp2:
                radio_cp2.Active = true;
                break;

            case Constants.ChronometerCp3:
                radio_cp3.Active = true;
                break;

            default:
                radio_cp_other.Active = true;
                entry_cp_other.Text   = eval.Chronometer;
                break;
            }

            switch (eval.Device)
            {
            case "":
            case Constants.UndefinedDefault:
                radio_device_undef.Active = true;
                break;

            case Constants.DeviceContactSteel:
                radio_contact_steel.Active = true;
                break;

            case Constants.DeviceContactCircuit:
                radio_contact_modular.Active = true;
                break;

            case Constants.DeviceInfrared:
                radio_infrared.Active = true;
                break;

            default:
                radio_device_other.Active = true;
                entry_device_other.Text   = eval.Device;
                break;
            }
        }

        //show or hide button_accept
        on_entries_required_changed(new object(), new EventArgs());
    }