Esempio n. 1
0
        /// <summary>
        /// Add object again
        /// </summary>
        public override void Redo(DrawingCanvas drawingCanvas)
        {
            HelperFunctions.UnselectAll(drawingCanvas);

            // Create full object from the clone and add it to list
            drawingCanvas.GraphicsList.Add(newObjectClone.CreateGraphics());

            // Object created from the clone doesn't contain clip information,
            // refresh it.
            drawingCanvas.RefreshClip();
        }
Esempio n. 2
0
        // Replace objects in graphicsList with objects from clone list
        private static void ReplaceObjects(VisualCollection graphicsList, List <PropertiesGraphicsBase> list)
        {
            for (int i = 0; i < graphicsList.Count; i++)
            {
                PropertiesGraphicsBase replacement = null;

                foreach (PropertiesGraphicsBase o in list)
                {
                    if (o.ID == ((GraphicsBase)graphicsList[i]).Id)
                    {
                        replacement = o;
                        break;
                    }
                }

                if (replacement != null)
                {
                    // Replace object with its clone
                    graphicsList.RemoveAt(i);
                    graphicsList.Insert(i, replacement.CreateGraphics());
                }
            }
        }