Ejemplo n.º 1
0
        public void RemoveSelfFromCanvas(ChemProV.UI.DrawingCanvas owner)
        {
            // Start by unsubscribing from events on the parent process unit or stream
            if (m_commentParent is ProcessUnitControl)
            {
                (m_commentParent as ProcessUnitControl).ProcessUnit.PropertyChanged -=
                    this.ProcessUnitParentPropertyChanged;
            }
            else if (m_commentParent is StreamControl)
            {
                (m_commentParent as StreamControl).Stream.PropertyChanged -=
                    this.StreamParentPropertyChanged;
            }
            m_commentParent = null;

            // Now unsubscribe from events on the sticky note object
            m_note.PropertyChanged -= this.MemNote_PropertyChanged;
            m_note = null;

            // Now do the actual removal of controls from the drawing canvas
            if (null != m_lineToParent)
            {
                owner.RemoveChild(m_lineToParent);
                m_lineToParent = null;
            }
            owner.RemoveChild(this);
        }