public BasicShape AddShape(Point position, int id, int routeId, TemplateDot templateDot) { BasicShape shape = new BasicShape(templateDot, position, id, routeId); this.DiagramView.Children.Add(shape); return(shape); }
public ControlTemplate GetSimpleTemplate(TemplateDot dotStructure) { string ItemTemplate; ItemTemplate = "<ControlTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">" + "<Grid Height=\"" + dotStructure.DotRadius.ToString() + "\" Width=\"" + dotStructure.DotRadius.ToString() + "\">" + "<Ellipse Fill=\"#FFF5F515\" Stroke=\"#9924DE35\"/>" + "<Ellipse Fill=\"#9924DE35\" Stroke=\"Black\" HorizontalAlignment=\"Center\"" + " VerticalAlignment=\"Center\" Width=\"" + (dotStructure.DotRadius / 2).ToString() + "\" Height=\"" + (dotStructure.DotRadius / 2).ToString() + "\" StrokeThickness=\"0\"/>" + "</Grid>" + "</ControlTemplate>";; XmlReader xmlReader = XmlReader.Create(new StringReader(ItemTemplate)); return((ControlTemplate)XamlReader.Load(xmlReader)); }
public BasicShape(TemplateDot dotTemplate, Point position, int id, int routeId) { this.CanDrag = true; this.CanConnect = true; this.DragDelta += new DragDeltaEventHandler(BasicShape_DragDelta); //this.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(BasicShape_MouseRightButtonDown); this.DotTemplate = dotTemplate; this.DotPoint = position; this.DotId = id; this.RouteId = routeId; this._dotName = "Точка №" + id.ToString(); this.ToolTip = DotName; this.SetType("End"); Point centerDot = new Point(position.X - dotTemplate.DotRadius / 2, position.Y - dotTemplate.DotRadius / 2); this.SetPosition(centerDot); }