/// <summary> /// Adds <see cref="Models.Pentagon"/>. /// </summary> public void Execute() { if (arrSortedIndices == null) { arrUnsortedVertices = canvas.Shapes.OfType <Models.Vertex>().ToArray(); SortIndicesForVertices(arrUnsortedVertices); } System.Windows.Point[] arrPoints = arrUnsortedVertices.Select(vertex => vertex.Location).ToArray(); System.Array.Sort(arrSortedIndices, arrPoints); pentagon = new Models.Pentagon { Points = arrPoints }; canvas.RemoveAll(shape => shape is Models.Vertex); canvas.Add(pentagon); }
// METHODS /// <summary> /// Method that execute command /// </summary> public void Execute() { baseCanvas.Add(target); if (baseCanvas.CountIf((shape) => shape is Models.Vertex) == Models.Pentagon.NUM_OF_EDGE_IN_PENTAGON) { workCommandManger.PopUndo(); workCommandManger.Execute(new Pentagon.AddPentagon(baseCanvas)); } }