コード例 #1
0
        private void artistTable_BeginEditing(object sender, XPTable.Events.CellEditEventArgs e)
        {
            switch (e.Column)
            {
            case 2:
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).Items.Clear();
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).Items.AddRange(DataBase.GetAvailablePersonGroupTypes());
                break;

            case 3:
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).Items.Clear();
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).Items.AddRange(DataBase.GetAvailablePersonGroupSex());
                break;

            case 4:
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).Items.Clear();
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).DropDownStyle = XPTable.Editors.DropDownStyle.DropDown;
                List <String> countries = DataBase.GetAvailableCountries(personGroup.PersonGroup);
                ((XPTable.Editors.ComboBoxCellEditor)e.Editor).Items.AddRange(countries.ToArray());
                break;

            default:
                break;
            }

            PersonGroupDataSet.PersonGroupRow personGroupRow = (PersonGroupDataSet.PersonGroupRow)personGroupTable.TableModel.Rows[e.Row].Tag;
            personGroupRow.BeginEdit();
        }
コード例 #2
0
        public FormArtistProperties(DataBase db, PersonType persontype, PersonGroupDataSet.PersonGroupRow personGroupRow)
        {
            InitializeComponent();

            switch (persontype)
            {
            case PersonType.Composer:
                Text          = StringTable.Composer;
                groupBox.Text = StringTable.Composer;
                break;

            case PersonType.Artist:
                Text          = StringTable.Artist;
                groupBox.Text = StringTable.Artist;
                break;

            case PersonType.Unknown:
            default:
                Text          = StringTable.PersonOrGroup;
                groupBox.Text = StringTable.PersonOrGroup;
                break;
            }

            dataBase = db;

            originalArtistName = personGroupRow.Name;

            personType        = persontype;
            thePersonGroupRow = personGroupRow;
            thePersonGroupRow.BeginEdit();

            comboBoxArtistType.DataSource = DataBase.GetAvailablePersonGroupTypes();
            comboBoxSex.DataSource        = DataBase.GetAvailablePersonGroupSex();

            textBoxName.DataBindings.Add("Text", personGroupRow, "Name");
            textBoxSaveAs.DataBindings.Add("Text", personGroupRow, "SaveAs");
            textBoxComment.DataBindings.Add("Text", personGroupRow, "Comment");
            textBoxHomepage.DataBindings.Add("Text", personGroupRow, "URL");
            comboBoxArtistType.DataBindings.Add("SelectedIndex", personGroupRow, "Type", true);
            comboBoxSex.DataBindings.Add("SelectedIndex", personGroupRow, "Sex", true);
            comboBoxCountry.DataBindings.Add("Text", personGroupRow, "Country");

            // Vorhandene Länder ermitteln
            String[] distinctValues = dataBase.GetAvailableCountries();

            comboBoxCountry.DataSource = distinctValues;

            if (!personGroupRow.IsImageFilenameNull() && personGroupRow.ImageFilename.Length > 0)
            {
                choosePictureButton.ImageFilename = personGroupRow.ImageFilename;
            }

            if (!personGroupRow.IsBirthDayNull())
            {
                textBoxBirthday.Text = Misc.FormatDate(personGroupRow.BirthDay);
            }

            if (!personGroupRow.IsDayOfDeathNull())
            {
                textBoxDayOfDeath.Text = Misc.FormatDate(personGroupRow.DayOfDeath);
            }

            UpdateWindowState();

            choosePictureButton.CoverType   = CoverType.PersonGroup;
            choosePictureButton.PersonGroup = personGroupRow;
        }