Пример #1
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged
        /// resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// -----------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                if (ExistingClerk != null && !m_haveActiveClerk)
                {
                    ExistingClerk.BecomeInactive();
                }
                if (m_mediator != null && !m_mediator.IsDisposed)
                {
                    m_mediator.RemoveColleague(this);
                }
                if (m_mpParent != null)
                {
                    m_mpParent.ShowFirstPaneChanged -= mp_ShowFirstPaneChanged;
                }
            }
            m_mediator       = null;
            m_informationBar = null;             // Should be disposed automatically, since it is in the Controls collection.
            m_mpParent       = null;

            base.Dispose(disposing);
        }
Пример #2
0
        /// <summary>
        /// When our parent changes, we may need to re-evaluate whether to show our info bar.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnParentChanged(EventArgs e)
        {
            base.OnParentChanged(e);

            if (Parent == null)
            {
                return;
            }

            var mp = Parent as MultiPane ?? Parent.Parent as MultiPane;

            if (mp == null)
            {
                return;
            }

            string suppress = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "suppressInfoBar", "false");

            if (suppress == "ifNotFirst")
            {
                mp.ShowFirstPaneChanged += mp_ShowFirstPaneChanged;
                m_mpParent = mp;
                mp_ShowFirstPaneChanged(mp, new EventArgs());
            }
        }
Пример #3
0
        private void mp_ShowFirstPaneChanged(object sender, EventArgs e)
        {
            MultiPane mpSender = sender as MultiPane;

            bool fWantInfoBar = (this == mpSender.FirstVisibleControl);

            if (fWantInfoBar && m_informationBar == null)
            {
                AddPaneBar();
                if (m_informationBar != null)
                {
                    SetInfoBarText();
                }
            }
            else if (m_informationBar != null && !fWantInfoBar)
            {
                Controls.Remove((UserControl)m_informationBar);
                m_informationBar.Dispose();
                m_informationBar = null;
            }
        }