コード例 #1
0
/// <summary>
/// Save immediately on double click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void SaveDialogContentsTree_DoubleClick(object sender, EventArgs e)
        {
            ContentsTreeControl ctc = sender as ContentsTreeControl;
            MetaTreeNode        mtn = SaveDialogContentsTree.FocusedMetaTreeNode;

            if (mtn == null)
            {
                return;
            }
            if (SaveDialogContentsTree.GetMetaTreeNodeChildren(mtn).Count == 0 &&             // terminal node?
                (!mtn.IsFolderType || mtn.IsUserObjectType))
            {
                ObjectName.Text   = mtn.Label;
                ObjectTarget.Text = mtn.Target;
                SaveButton_Click(null, null);
            }
        }
コード例 #2
0
/// <summary>
/// User has clicked node, copy selection to text controls
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void SaveDialogContentsTree_FocusedNodeChanged(object sender, EventArgs e)
        {
            MetaTreeNode mtn = SaveDialogContentsTree.FocusedMetaTreeNode;

            if (mtn == null)
            {
                return;
            }

            if (SaveDialogContentsTree.GetMetaTreeNodeChildren(mtn).Count == 0 &&             // terminal node?
                (!mtn.IsFolderType || mtn.IsUserObjectType))
            {
                ObjectName.Text   = mtn.Label;
                ObjectTarget.Text = mtn.Target;
            }

            while (mtn != null)             // look from here on up for a project or a user folder node
            {
                if (mtn.Type == MetaTreeNodeType.Project || mtn.Type == MetaTreeNodeType.UserFolder)
                {
                    ProjectName.Text = mtn.Label;

                    while (mtn != null)                          // look from here on up for a project or a user folder node
                    {
                        if (Lex.StartsWith(mtn.Name, "MERGED_")) // continue up to a real node
                        {
                            mtn = mtn.Parent;
                        }
                        else
                        {
                            break;
                        }
                    }

                    if (mtn != null)
                    {
                        ProjectTarget.Text = mtn.Target;
                    }
                    break;
                }
                mtn = mtn.Parent;
            }

            return;
        }