/// <summary> /// Добавление фигуры /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonAddFigure_Click(object sender, EventArgs e) { AddFigureForm newForm = new AddFigureForm(); const int masterSheetNumber = 3; if (newForm.ShowDialog() == DialogResult.OK) { FigureBase figure = newForm.Figure; _figureList.Add(figure); MessageBox.Show("Shape added!"); listViewType.Items[masterSheetNumber].Selected = true; ListViewType_SelectedIndexChanged(this, null); listViewType.Select(); } }
/// <summary> /// Добавление фигуры /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonAddFigure_Click(object sender, EventArgs e) { AddFigureForm newForm = new AddFigureForm(); if (newForm.ShowDialog() == DialogResult.OK) { FigureBase figure = newForm.Figure; _figureList.Add(figure); MessageBox.Show("Фигура добавлена!"); var itemNumber = _listViewFigure.FirstOrDefault( x => x.Value == figure.GetType()).Key; listViewType.Items[itemNumber].Selected = true; ListViewType_SelectedIndexChanged(this, null); listViewType.Select(); } }