private void buttonListOfObjects_Click(object sender, RoutedEventArgs e) { //тест------------------------- List <LandscapeObject> list = new List <LandscapeObject>(); int i = 0; foreach (var item in context.PlantVariety.Local) { Plant p = new Plant(item, 0); p.id = ++i; list.Add(p); p = new Plant(item, 0); p.id = ++i; list.Add(p); } OtherObject o1 = new OtherObject(); o1.description = "vbuuvbwv"; o1.height = 10; o1.width = 10; o1.length = 10; list.Add(o1); //---------------------------------- var listOfObjects = new Win_ListOfObjects(list); listOfObjects.Show(); }
private void buttonAddOtherObject_Click(object sender, RoutedEventArgs e) { if (textBoxLength.Text == "" || textBoxLength.Text == "0" || textBoxWidth.Text == "" || textBoxWidth.Text == "0" || textBoxHeight.Text == "" || textBoxHeight.Text == "0" || (textBoxAngle.Text == "" && rb2.IsChecked == true)) { MessageBox.Show("Неверно введены данные!"); return; } int length = int.Parse(textBoxLength.Text); if (rb1_1.IsChecked != true) { length *= 100; } int height = int.Parse(textBoxHeight.Text); if (rb3_1.IsChecked != true) { height *= 100; } int width = int.Parse(textBoxWidth.Text); if (rb2_1.IsChecked != true) { width *= 100; } string desc = textBoxDesc.Text; Polygon polygon; polygon.vertices = CreateNewPolygon(length, width); List <Point> points = area.SearchPlaceOtherObject(polygon); Point point = points[0]; points.RemoveAt(0); polygon.vertices = points; OtherObject obj = new OtherObject(point, polygon, height, length, width, desc); area.AddObject(obj); }