private static void handler(object sender, EventArgs e) { if (isDrawSelected) { switch (((MenuItem)sender).Text) { case "Изменить название": RoomCreator cr = new RoomCreator(); if (cr.ShowDialog() == DialogResult.OK) { movable.labels[localSheet] = cr.roomName; } break; case "Добавить выноску": break; case "Копировать": break; case "Удалить": foreach (var i in Schemes_Editor.wires) { if (i.firstEquip.localID == ((drawer)movable).localID) { var t = ((Wire)movable); if (t.firstEquip is inboxes) { ((inboxes)t.firstEquip).seized[Schemes_Editor.mainList.Find(x => x.id == ((inboxes)t.firstEquip).globalId).compatibilities.FindIndex(x => x.interfaceType.id == t.OtherFirst.interfaceType.id)]--; } if (t.secondEquip is inboxes) { ((inboxes)t.secondEquip).seized[Schemes_Editor.mainList.Find(x => x.id == ((inboxes)t.secondEquip).globalId).compatibilities.FindIndex(x => x.interfaceType.id == t.OtherSecond.interfaceType.id)]--; } Schemes_Editor.wires.RemoveAll(x => x.localID == t.localID); } if (i.secondEquip.localID == ((drawer)movable).localID) { var t = ((Wire)movable); if (t.firstEquip is inboxes) { ((inboxes)t.firstEquip).seized[Schemes_Editor.mainList.Find(x => x.id == ((inboxes)t.firstEquip).globalId).compatibilities.FindIndex(x => x.interfaceType.id == t.OtherFirst.interfaceType.id)]--; } if (t.secondEquip is inboxes) { ((inboxes)t.secondEquip).seized[Schemes_Editor.mainList.Find(x => x.id == ((inboxes)t.secondEquip).globalId).compatibilities.FindIndex(x => x.interfaceType.id == t.OtherSecond.interfaceType.id)]--; } Schemes_Editor.wires.RemoveAll(x => x.localID == t.localID); } Schemes_Editor.mainWorkList.RemoveAll(x => x.localID == ((drawer)movable).localID); } break; } } if (isRoomSelected) { } if (isWireSelected) { switch (((MenuItem)sender).Text) { case "Изменить название": RoomCreator cr = new RoomCreator(); if (cr.ShowDialog() == DialogResult.OK) { movable.labels[localSheet] = cr.roomName; } break; case "Добавить выноску": Schemes_Editor.wires[SelectedWireIndex].createVinosku(Schemes_Editor.wires[SelectedWireIndex].inside(localSheet, mousePosition).vertex, localSheet); movable = Schemes_Editor.wires[SelectedWireIndex]; Mode = modeStruct.moveVinosku; break; case "Удалить": var t = ((Wire)movable); if (t.firstEquip is inboxes) { ((inboxes)t.firstEquip).seized[Schemes_Editor.mainList.Find(x => x.id == ((inboxes)t.firstEquip).globalId).compatibilities.FindIndex(x => x.interfaceType.id == t.OtherFirst.interfaceType.id)]--; } if (t.secondEquip is inboxes) { ((inboxes)t.secondEquip).seized[Schemes_Editor.mainList.Find(x => x.id == ((inboxes)t.secondEquip).globalId).compatibilities.FindIndex(x => x.interfaceType.id == t.OtherSecond.interfaceType.id)]--; } Schemes_Editor.wires.RemoveAll(x => x.localID == t.localID); break; case "Удалить узел": var tt = ((Wire)movable).inside(localSheet, mousePosition); if (tt.vertex.X != -1 && tt.isExists) { ((Wire)movable).points[localSheet].RemoveAll(x => x.X == tt.vertex.X && x.Y == tt.vertex.Y); } break; } } }