Example #1
0
        void NodeSelected(Base control)
        {
            Alt.GUI.Temporary.Gwen.Control.TreeNode node = control as Alt.GUI.Temporary.Gwen.Control.TreeNode;

            if (node != null &&
                node.UserData != null)
            {
                ExampleNode example = node.UserData as ExampleNode;
                if (example != null)
                {
                    if (m_LastControl != null)
                    {
                        if (m_LastControl != null)
                        {
                            if (m_ExamplePanel != null)
                            {
                                m_ExamplePanel.RemoveChild(m_LastControl, false);
                            }

                            try
                            {
                                m_LastControl.Dispose();
                                m_LastControl = null;
                            }
                            catch
                            {
                            }
                        }
                    }

                    m_LastControl  = example.CreateExample(m_ExamplePanel);
                    m_Caption.Text = TitlePrefix + (string.IsNullOrEmpty(example.m_Description) ? node.Text : example.m_Description);
                }
            }
        }
Example #2
0
        public void Shutdown()
        {
            foreach (Base b in m_ExamplesList.Children)
            {
                CollapsibleCategory cat = b as CollapsibleCategory;

                foreach (Base button in cat.Children)
                {
                    ExampleNode node = button.UserData as ExampleNode;

                    if (node != null &&
                        node.m_Example != null)
                    {
                        if (node.m_Example == m_LastControl)
                        {
                            node.m_Example = null;
                            continue;
                        }

                        try
                        {
                            node.m_Example.Dispose();
                            node.m_Example = null;
                        }
                        catch
                        {
                        }
                    }
                }
            }

            if (m_LastControl != null)
            {
                if (m_Center != null)
                {
                    m_Center.RemoveChild(m_LastControl, false);
                }

                try
                {
                    m_LastControl.Dispose();
                    m_LastControl = null;
                }
                catch
                {
                }
            }

            m_Center.Children.Clear();
        }