private void LoadDataToForms(Models.Figure MyFigure) { CenterXTextBox.Text = MyFigure.Position.X.ToString(); CenterYTextBox.Text = MyFigure.Position.Y.ToString(); CenterZTextBox.Text = MyFigure.Position.Z.ToString(); BigRadiusTextBox.Text = MyFigure.Radius.ToString(); if (MyFigure is CuttedCone) { SmallRadiusTextBox.Text = ((CuttedCone)MyFigure).SmallRadius.ToString(); } if (MyFigure is Cone) { HeightTextBox.Text = ((Cone)MyFigure).Height.ToString(); } if (MyFigure is EmptyCircle) { ResolutionTextBox.Text = ((EmptyCircle)MyFigure).Resolution.ToString(); } if (MyFigure is EmptyCircle) { LineWidthTextBox.Text = ((EmptyCircle)MyFigure).LineWidth.ToString(); } ColorsComboBox.SelectedItem = MyFigure.Color; FiguresComboBox.SelectedItem = MyFigure.Name; }
private void FiguresListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { Models.Figure MyFigure = (Models.Figure)FiguresListBox.SelectedItem; LoadDataToForms(MyFigure); } catch (NullReferenceException nullex) { } }