public void RemoveFloor(object sender, EventArgs args) { if (floorIndex != -1) { SeeFloors.RemoveAt(floorIndex); } }
public void CreatingFloor(StackPanel stack) { TextBlock name = new TextBlock(); name.Foreground = Brushes.Lime; name.Text = "Название этажа:"; TextBox nameTB = new TextBox(); nameTB.MaxLength = 15; nameTB.Width = 280; nameTB.Margin = new Thickness(5); nameTB.Foreground = Brushes.Lime; nameTB.Background = Brushes.Black; nameTB.BorderBrush = Brushes.Lime; var save = GetStandartButton(); save.Content = "Сохранить"; save.Click += (x, y) => { if (nameTB.Text.TrimEnd() != "") { SeeFloors.Add(new Floor(nameTB.Text, HandleFloorsChange)); AddContainer.Visibility = Visibility.Collapsed; Draw(); } else { MessageBox.Show("Название не введено"); } }; stack.Children.Add(name); stack.Children.Add(nameTB); stack.Children.Add(save); }