private void buttonAdd_Click_Goat(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { button3.Enabled = resetButton.Enabled = false; foreach (string url in openFileDialog.FileNames) { progressBar.Value = 0; Goat goat = Goat.load(url); animals.Add(goat); progressBar.PerformStep(); listBox1.Items.Add("id= " + goat.getId().ToString()); progressBar.PerformStep(); loadGoat(goat); } MessageBox.Show("load complete"); button3.Enabled = resetButton.Enabled = true; this.ActiveControl = this.enterDataControl; txtButton.Enabled = wordButton.Enabled = excelButton.Enabled = true; } }
private void loadGoat(Goat goat) { goat.changeLengthUnit(this.lengthUnit); goat.changeWeightUnit(this.weightUnit); progressBar.PerformStep(); dataControls[0].addData(goat.getId().ToString()); progressBar.PerformStep(); dataControls[1].addData("goat"); progressBar.PerformStep(); dataControls[2].addData(goat.year.ToString() + "/" + goat.month.ToString() + "/" + goat.day.ToString()); progressBar.PerformStep(); dataControls[3].addData(goat.species); progressBar.PerformStep(); dataControls[4].addData(goatForm.countryComboBox.Items[goat.country].ToString()); progressBar.PerformStep(); dataControls[5].addData(goat.region); progressBar.PerformStep(); dataControls[6].addData(goat.latitudeDegree.ToString() + "°" + goat.latitudeMinute + "'" + goat.latitudeSecond + "\""); progressBar.PerformStep(); dataControls[7].addData(goat.longitudeDegree.ToString() + "°" + goat.longitudeMinute + "'" + goat.longitudeSecond + "\""); progressBar.PerformStep(); dataControls[8].addData(goatForm.genderComboBox.Items[goat.sex].ToString()); progressBar.PerformStep(); dataControls[9].addData(goat.age.ToString()); progressBar.PerformStep(); dataControls[10].addData(goat.createNum.ToString()); progressBar.PerformStep(); dataControls[11].addData(goatForm.cavelComboBox.Items[goat.cavel].ToString()); progressBar.PerformStep(); dataControls[12].addData(goatForm.foreheadComboBox.Items[goat.foreheadType].ToString()); progressBar.PerformStep(); dataControls[13].addData(goatForm.headComboBox.Items[goat.headType].ToString()); progressBar.PerformStep(); dataControls[14].addData(goat.headLength.ToString()); progressBar.PerformStep(); dataControls[15].addData(goat.headWidth.ToString()); progressBar.PerformStep(); dataControls[16].addData(goatForm.earComboBox.Items[goat.earType].ToString()); progressBar.PerformStep(); dataControls[17].addData(goat.earLength.ToString()); progressBar.PerformStep(); dataControls[18].addData(goat.earWidth.ToString()); progressBar.PerformStep(); dataControls[19].addData(goatForm.noseComboBox.Items[goat.nose].ToString()); progressBar.PerformStep(); dataControls[20].addData(goatForm.neckComboBox.Items[goat.neck].ToString()); progressBar.PerformStep(); dataControls[21].addData(goat.isMeat.ToString()); progressBar.PerformStep(); dataControls[22].addData(goat.isWrinkle.ToString()); progressBar.PerformStep(); dataControls[23].addData(goat.isBeard.ToString()); progressBar.PerformStep(); dataControls[24].addData(goatForm.tailComboBox.Items[goat.tailType].ToString()); progressBar.PerformStep(); dataControls[25].addData(goat.tailLength.ToString()); progressBar.PerformStep(); dataControls[26].addData(goat.tailWidth.ToString()); progressBar.PerformStep(); dataControls[27].addData(goatForm.limbsComboBox.Items[goat.limbs].ToString()); progressBar.PerformStep(); dataControls[28].addData(goat.bodyLength.ToString()); progressBar.PerformStep(); dataControls[29].addData(goat.bodyHeight.ToString()); progressBar.PerformStep(); dataControls[30].addData(goat.bodyObliqueLength.ToString()); progressBar.PerformStep(); dataControls[31].addData(goat.weight.ToString()); progressBar.PerformStep(); dataControls[32].addData(goat.chestCircumference.ToString()); progressBar.PerformStep(); dataControls[33].addData(goat.bustDepth.ToString()); progressBar.PerformStep(); dataControls[34].addData(goat.bustWidth.ToString()); progressBar.PerformStep(); dataControls[35].addData(goat.coatColor); progressBar.PerformStep(); dataControls[36].addData(goat.skinColor); progressBar.PerformStep(); dataControls[37].addData(goat.comment); progressBar.PerformStep(); dataPanel.Controls.Clear(); foreach (DataShowControl control in dataControlsCopy) { dataPanel.Controls.Add(control); } this.dataPanel.Height += 40; this.Height += 40; }