public ProcedurePropertiesViewModel(ElementProcedure element, ProceduresViewModel proceduresViewModel, CommonDesignerCanvas designerCanvas) : base(element, designerCanvas) { Procedures = proceduresViewModel.Procedures; _element = element; ElementBaseRectangle = element as ElementBaseRectangle; Title = "Свойства фигуры: Процедура"; if (element.ProcedureUID != Guid.Empty) SelectedProcedure = Procedures.FirstOrDefault(x => x.Procedure.Uid == element.ProcedureUID); }
protected override ElementBaseRectangle CreateElement(double left, double top) { var element = new ElementProcedure() { Left = left, Top = top }; var propertiesViewModel = new ProcedurePropertiesViewModel(element, _proceduresViewModel, DesignerCanvas); return DialogService.ShowModalWindow(propertiesViewModel) ? element : null; }
/// <summary> /// Создает SVG-группу из ElementProcedure /// </summary> /// <param name="elem">ElementProcedure</param> /// <returns></returns> public static PlanElement FromProcedure(ElementProcedure elem) { // Получаем элемент текста var planElementText = FromTextElement( elem, new System.Windows.Size(elem.Width, elem.Height), elem.Left, elem.Top, true); // Получаем элемент прямоугольника, в который вписан текст var planElementRect = FromRectangleSimple(elem, false); // Очищаем элементы от групповой информации planElementText.Hint = null; planElementText.HasOverlay = false; planElementRect.Hint = null; planElementRect.HasOverlay = false; // Задаем групповой элемент var planElement = new PlanElement { ChildElements = new[] { planElementRect, planElementText }, Id = planElementText.Id, Hint = GetElementHint(elem), Type = ShapeTypes.Group.ToString(), Width = elem.Width, Height = elem.Height, Name = elem.PresentationName, HasOverlay = true, BorderMouseOver = InternalConverter.ConvertColor(Colors.Orange), X = elem.Left, Y = elem.Top }; return planElement; }