Exemple #1
0
        private void pbHelp_Click(object sender, EventArgs e)
        {
            if (tvNav.SelectedNode.Tag == null || !(tvNav.SelectedNode.Tag is ActionParent))
            {
                return;
            }
            ActionParent ap = (ActionParent)tvNav.SelectedNode.Tag;

            SushiHelp.ShowHelpLink(ap.HelpKey);
        }
Exemple #2
0
        internal static void SetTreeNodeTagToActionParentInstance(TreeNode tn)
        {
            Type         actionType = (Type)tn.Tag;
            ActionParent ap         = Activator.CreateInstance(actionType) as ActionParent;

            System.Reflection.FieldInfo defInstanceField = actionType.GetField("DefInstance");
            defInstanceField.SetValue(ap, ap); //singlton design pattern: only one instance ever exists of each of the user controls and it is stored in DefInstance

            tn.Tag = ap;
        }
Exemple #3
0
        private void tvNav_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                //--This is for "container" nodes so that when user pressess up arrow, the container node is skipped.
                if (e.Node.Tag == null && e.Node.Nodes.Count > 0)
                {
                    if (!_lastKeywasUpArrow || e.Node.PrevNode == null)
                    {
                        tvNav.SelectedNode = e.Node.Nodes[0];
                    }
                    else
                    {
                        tvNav.SelectedNode = e.Node.PrevNode.LastNode;
                    }
                    return;
                }

                //--using reflection here for performance reasons, this allows the application to delay-load the Action user control.
                if (e.Node.Tag.GetType().FullName == "System.RuntimeType")
                {
                    SetTreeNodeTagToActionParentInstance(e.Node);
                }

                ActionParent ucp = (ActionParent)e.Node.Tag;
                splitContainer1.Panel2.Controls.Clear();
                ucp.Dock = DockStyle.Fill;
                splitContainer1.Panel2.Controls.Add(ucp);
                ucp.ActionFormActivate();

                if (ucp.PictureboxImage != null)
                {
                    this.pictureBoxTop.Image = ucp.PictureboxImage;
                }

                rtbTitle.Text = "     " + e.Node.Text;
            }
            catch (Exception ex)
            {
                Eh.GlobalErrorHandler(ex);
            }
        }