示例#1
0
        public void Apply()
        {
            bool b = _host.DisableUndo;

            _host.DisableUndo = true;
            List <IComponent> icList = new List <IComponent>();

            foreach (IComponent c in _designer.Container.Components)
            {
                IActiveDrawing a = c as IActiveDrawing;
                if (a != null)
                {
                    if (_idList.Contains(a.ActiveDrawingID))
                    {
                        icList.Add(c);
                    }
                }
            }
            if (icList.Count > 0)
            {
                foreach (IComponent ic in icList)
                {
                    _designer.DestroyComponent(ic);
                }
            }
            _host.DisableUndo = b;
        }
示例#2
0
        void componentChangeService_ComponentChanged(object sender, ComponentChangedEventArgs e)
        {
            if (!_disableUndo)
            {
                if (e.OldValue != null)
                {
                    Point pOld = (Point)e.OldValue;

                    if (e.NewValue != null)
                    {
                        Point          pNew = (Point)e.NewValue;
                        IActiveDrawing c    = e.Component as IActiveDrawing;
                        if (c != null)
                        {
                            UInt32     key    = c.ActiveDrawingID;
                            UndoEntity entity = new UndoEntity(new PositionUndo(this, key, pOld), new PositionUndo(this, key, pNew));
                            AddUndoEntity(entity);
                        }
                    }
                }
            }
        }