public void JoinFigure(int figureIndex, int targetFigureIndex) { PathFigureEditor pathFigureEditor = this.CreatePathFigureEditor(figureIndex); PathFigure figure = this.PathGeometry.Figures[targetFigureIndex]; int count1 = pathFigureEditor.PathFigure.Segments.Count; int num1 = figureIndex < targetFigureIndex ? 0 : -1; int count2 = this.changeList.Changes.Count; pathFigureEditor.Join(figure); while (this.changeList.Changes.Count > count2) { this.changeList.Changes.RemoveAt(this.changeList.Changes.Count - 1); } PathAction pathAction = new PathAction(); pathAction.Action = PathActionType.Join; pathAction.Figure = figureIndex; pathAction.PointIndex = targetFigureIndex; pathAction.PathStructureChanges.Add(new PathStructureChange(count1 - 1, count1, figureIndex, figureIndex + num1, (DependencyProperty)null, BezierSegment.Point1Property, PathChangeType.Copy)); pathAction.PathStructureChanges.Add(new PathStructureChange(PathStructureChange.StartPointIndex, count1, targetFigureIndex, figureIndex + num1, PathFigure.StartPointProperty, BezierSegment.Point2Property, PathChangeType.Copy)); pathAction.PathStructureChanges.Add(new PathStructureChange(PathStructureChange.StartPointIndex, count1, targetFigureIndex, figureIndex + num1, PathFigure.StartPointProperty, BezierSegment.Point3Property, PathChangeType.Move)); int num2 = count1 + 1; for (int oldIndex = 0; oldIndex < this.path.Figures[targetFigureIndex].Segments.Count; ++oldIndex) { pathAction.PathStructureChanges.Add(new PathStructureChange(oldIndex, num2 + oldIndex, targetFigureIndex, figureIndex + num1)); } this.path.Figures.RemoveAt(targetFigureIndex); for (int newFigure = targetFigureIndex; newFigure < this.path.Figures.Count; ++newFigure) { pathAction.PathStructureChanges.Add(new PathStructureChange(PathStructureChange.StartPointIndex, PathStructureChange.StartPointIndex, newFigure + 1, newFigure)); int num3 = this.path.Figures[newFigure].Segments.Count; if (newFigure + 1 == figureIndex) { num3 = count1; } for (int index = 0; index < num3; ++index) { pathAction.PathStructureChanges.Add(new PathStructureChange(index, index, newFigure + 1, newFigure)); } } this.changeList.Changes.Add(pathAction); }