Пример #1
0
        /// <summary>
        /// Removes this control from the canvas. This includes removal of controls that are
        /// "attached" to this control, such as the comment sticky note controls.
        /// This is considered disposal of the control and it should not be used anymore
        /// after calling this method.
        /// </summary>
        public void RemoveSelfFromCanvas(UI.DrawingCanvas canvas)
        {
            // Unsubscribe from events (important)
            m_stream.PropertyChanged            -= this.Stream_PropertyChanged;
            m_stream.Comments.CollectionChanged -= this.Comments_CollectionChanged;
            if (null != m_sourceEventItem)
            {
                m_sourceEventItem.PropertyChanged -= this.SourceOrDest_PropertyChanged;
                m_sourceEventItem = null;
            }
            if (null != m_destEventItem)
            {
                m_destEventItem.PropertyChanged -= this.SourceOrDest_PropertyChanged;
                m_destEventItem = null;
            }
            if (null != m_table)
            {
                m_stream.PropertiesTable.PropertyChanged -= this.PropertiesTable_PropertyChanged;
            }

            canvas.RemoveChild(this);
            canvas.RemoveChild(m_sourceDragIcon);
            canvas.RemoveChild(m_dstDragIcon);
            canvas.RemoveChild(m_table);
            if (null != m_miniTable)
            {
                canvas.RemoveChild(m_miniTable);
            }
            if (null != m_square)
            {
                canvas.RemoveChild(m_square);
            }
            if (null != m_arrow)
            {
                canvas.RemoveChild(m_arrow);
            }

            // Remove all the lines
            foreach (Line line in m_lines)
            {
                canvas.RemoveChild(line);
            }
            m_lines.Clear();

            foreach (StickyNoteControl snc in m_stickyNotes)
            {
                snc.RemoveSelfFromCanvas(canvas);
            }
            m_stickyNotes.Clear();

            // Set the value to indiate that we've removed
            m_hasBeenRemoved = true;
        }
Пример #2
0
        /// <summary>
        /// Removes this control from the canvas. This includes removal of controls that are
        /// "attached" to this control, such as the comment sticky note controls.
        /// This is considered "disposing" the control and it should not be used after this call.
        /// </summary>
        public void RemoveSelfFromCanvas(UI.DrawingCanvas owner)
        {
            // Unsubscribe from events
            m_pu.Comments.CollectionChanged -= this.CommentCollectionChanged;
            m_pu.PropertyChanged            -= this.ProcessUnit_PropertyChanged;

            owner.RemoveChild(this);
            foreach (ChemProV.UI.StickyNoteControl snc in m_stickyNotes)
            {
                snc.RemoveSelfFromCanvas(owner);
            }

            // Set the process unit reference to null
            m_pu = null;
        }