static public void UP(object sender, MouseEventArgs e) { switch (Mode) { case modeShkaf.dragShkaf: Mode = modeShkaf.doNothing_NOSCALEMODE; break; case modeShkaf.dragShkafnoe: if (hasRect) { boxForInser.equipInside.Add(movable); boxForInser.positions.Add(indexToInsertInBox); boxForInser.unitsSeized.Add(movable.numberOfUnits); ((inboxes)movable).inbox = true; movable.createVinosku(localSheet); // movable.labels[localSheet] = (indexToInsertInBox + 1).ToString(); element = movable; Mode = modeShkaf.moveVinosku; } else { ((inboxes)movable).inbox = false; Mode = modeShkaf.doNothing_NOSCALEMODE; } hasRect = false; break; case modeShkaf.scaleSomething: Mode = modeShkaf.doNothing_SCALEMODE; break; } }
public void copy(int globalID, drawer elem = null) { int id = -1; if (elem != null) { var target = mainList.Find(x => x.id == elem.globalId); id = RevitProvider.copy(target); if (target.isBox) { mainWorkList.Add(new boxes() { localID = id, globalId = elem.globalId, locations = new Point[] { new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0) }, scales = new List <Point>(elem.scales).ToArray() }); } else if (target.isInBox) { mainWorkList.Add(new inboxes() { numberOfUnits = Convert.ToInt32(target.properties["Занимаемых юнитов (шт)"]), localID = id, globalId = elem.globalId, locations = new Point[] { new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0) }, scales = new List <Point>(elem.scales).ToArray() }); } else { mainWorkList.Add(new free() { localID = id, globalId = elem.globalId, locations = new Point[] { new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0) }, scales = new List <Point>(elem.scales).ToArray() }); } } else { var target = mainList.Find(x => x.id == globalID); int current = -1; foreach (var i in mainWorkList) { if (i.localID > current) { current = i.localID; } } current++; if (target.compatibilities.Count == 1) { wires.Add(new Wire() { MyOwnFirst = target.compatibilities[0], MyOwnSecond = target.compatibilities[0] }); } else { wires.Add(new Wire() { MyOwnFirst = target.compatibilities[0], MyOwnSecond = target.compatibilities[1] }); } tabControl1.SelectedIndex = 1; // MessageBox.Show("выберите начальное оборудование"); ConnectionController.targetWire = wires[wires.Count - 1]; ConnectionController.Mode = modeConnection.buildConnection; } }
// public static void DOWN(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Right: switch (Mode) { case modeShkaf.doNothing_NOSCALEMODE: for (int i = Schemes_Editor.mainWorkList.Count - 1; i > -1; i--) { if (Schemes_Editor.mainWorkList[i].inside(e.Location, 2)) { if (Schemes_Editor.mainWorkList[i] is inboxes) { } if (Schemes_Editor.mainWorkList[i] is boxes) { } element = Schemes_Editor.mainWorkList[i]; break; } } ContextMenu menushka = new ContextMenu(new MenuItem[] { new MenuItem("Добавить выноску", handler), new MenuItem("Копировать", handler), new MenuItem("Удалить", handler), new MenuItem("Изменить название", handler) }); menushka.Show(father.pictureBox1, e.Location); break; } break; case MouseButtons.Left: switch (Mode) { case modeShkaf.moveVinosku: Mode = modeShkaf.doNothing_NOSCALEMODE; break; case modeShkaf.doNothing_NOSCALEMODE: // movable = null; for (int i = Schemes_Editor.mainWorkList.Count - 1; i > -1; i--) { if (Schemes_Editor.mainWorkList[i].inside(e.Location, 2)) { if (Schemes_Editor.mainWorkList[i] is inboxes) { Prev = new Point(e.Location.X - ((inboxes)Schemes_Editor.mainWorkList[i]).locations[2].X, e.Location.Y - ((inboxes)Schemes_Editor.mainWorkList[i]).locations[2].Y); Mode = modeShkaf.dragShkafnoe; hasRect = false; movable = Schemes_Editor.mainWorkList[i]; foreach (boxes j in Schemes_Editor.mainWorkList.FindAll(x => x is boxes)) { int pos = j.equipInside.IndexOf(j.equipInside.Find(x => x.localID == movable.localID)); if (pos != -1) { j.equipInside.RemoveAt(pos); j.positions.RemoveAt(pos); j.unitsSeized.RemoveAt(pos); } } ((inboxes)Schemes_Editor.mainWorkList[i]).inbox = false; } if (Schemes_Editor.mainWorkList[i] is boxes) { movable = Schemes_Editor.mainWorkList[i]; Prev = new Point(e.Location.X - ((boxes)Schemes_Editor.mainWorkList[i]).locations[2].X, e.Location.Y - ((boxes)Schemes_Editor.mainWorkList[i]).locations[2].Y); Mode = modeShkaf.dragShkaf; } break; } } break; case modeShkaf.doNothing_SCALEMODE: moveTargetIndex = -1; for (int i = 0; i < Schemes_Editor.mainWorkList.Count; i++) { //if (Schemes_Editor.mainWorkList[i] is wire_s) // continue; if (Schemes_Editor.mainWorkList[i] is inboxes && ((inboxes)Schemes_Editor.mainWorkList[i]).inbox) { continue; } int a = Schemes_Editor.mainWorkList[i].locations[2].X, b = Schemes_Editor.mainWorkList[i].locations[2].Y, c = Schemes_Editor.mainWorkList[i].locations[2].X + Schemes_Editor.mainWorkList[i].scales[2].X, d = Schemes_Editor.mainWorkList[i].locations[2].Y + Schemes_Editor.mainWorkList[i].scales[2].Y; if (Schemes_Editor.distance(new Point(a, b), e.Location) < 20) { scalePoint = new Point(a, b); moveTargetIndex = i; pointNum = 0; Mode = modeShkaf.scaleSomething; break; } if (Schemes_Editor.distance(new Point(a, d), e.Location) < 20) { scalePoint = new Point(a, d); moveTargetIndex = i; pointNum = 3; Mode = modeShkaf.scaleSomething; break; } if (Schemes_Editor.distance(new Point(c, b), e.Location) < 20) { scalePoint = new Point(c, b); moveTargetIndex = i; pointNum = 1; Mode = modeShkaf.scaleSomething; break; } if (Schemes_Editor.distance(new Point(c, d), e.Location) < 20) { scalePoint = new Point(c, d); moveTargetIndex = i; pointNum = 2; Mode = modeShkaf.scaleSomething; break; } } break; } break; } }