Beispiel #1
0
            public Example__Base CreateExample(Base parent)
            {
                if (m_ExampleType != null)
                {
                    if (m_ExampleType.IsSubclassOf(typeof(Example__Base)))
                    {
                        Example__Base example = null;
                        try
                        {
                            example = (Example__Base)Activator.CreateInstance(m_ExampleType, new object[] { parent });
                        }
                        catch
                        {
                            try
                            {
                                example = (Example__Base)Activator.CreateInstance(m_ExampleType);
                            }
                            catch
                            {
                                example = null;
                            }
                        }

                        if (example != null)
                        {
                            example.Parent = parent;
                            example.Dock   = Pos.Fill;

                            return(example);
                        }
                    }
                }

                return(null);
            }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
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();
        }
Beispiel #4
0
            public ExampleNode(Type type, Example__Base example, Base parent, ExamplesHolder holder)
            {
                m_ExampleType   = type;
                m_Example       = example;
                m_ExampleParent = parent;
                m_Holder        = holder;

                if (m_Example != null)
                {
                    m_Example.Parent = m_ExampleParent;
                    m_Example.Dock   = Pos.Fill;
                    m_Example.Hide();
                    m_Example.Holder = m_Holder;
                }
            }
Beispiel #5
0
        void OnExampleSelect(Base control)
        {
            if (control == null)
            {
                return;
            }

            if (m_LastControl != null)
            {
                m_LastControl.OnDeactivate();
                m_LastControl.Hide();
            }

            Example__Base example = (control.UserData as ExampleNode).Example;

            if (example != null)
            {
                example.Show();
                example.OnActivate();
            }
            m_LastControl = example;
        }
Beispiel #6
0
        Alt.GUI.Temporary.Gwen.Control.Button RegisterDemo(string name, CollapsibleCategory cat, Type exampleType, Example__Base example)
        {
            Alt.GUI.Temporary.Gwen.Control.Button btn = cat.Add(name);
            btn.UserData = new ExampleNode(exampleType, example, m_Center, this);
            btn.Clicked += OnExampleSelect;

            return(btn);
        }
Beispiel #7
0
        Alt.GUI.Temporary.Gwen.Control.Button RegisterDemo(string name, CollapsibleCategory cat, Type exampleType, Example__Base example, Color textColor)
        {
            Alt.GUI.Temporary.Gwen.Control.Button btn = RegisterDemo(name, cat, exampleType, example);
            btn.TextColor = textColor;
            btn.UseCurrentColorAsNormal = true;

            return(btn);
        }