Exemplo n.º 1
0
        /// <summary>
        /// Select a single item from the filtered types from the contents tree
        /// </summary>
        /// <param name="title"></param>
        /// <param name="prompt"></param>
        /// <param name="typeFilter"></param>
        /// <param name="initialSelection"></param>
        /// <param name="numberItems"></param>
        /// <returns></returns>

        public static MetaTreeNode SelectSingleItem(
            string title,
            string prompt,
            MetaTreeNodeType typeFilter,
            MetaTreeNode initialSelection,
            bool numberItems)
        {
            if (Instance == null)
            {
                Instance = new SelectFromContents();
            }
            Instance.Text        = title;
            Instance.Prompt.Text = prompt;

            string selectedNodeTarget = (initialSelection != null ? initialSelection.Target : null);
            string expandNodeTarget   = ContentsTreeControl.GetPreferredProjectNodeTarget();

            Instance.ContentsTree.FillTree(
                "root",
                typeFilter,
                selectedNodeTarget,
                expandNodeTarget,
                null,
                false,
                false);

            Instance.ContentsTreeWithSearch.CommandLineControl.Text = "";

            Instance.SelectionName.Text   = (initialSelection != null ? initialSelection.Label : null);
            Instance.SelectionTarget.Text = (initialSelection != null ? initialSelection.Target : null);
            Instance.TypeFilter           = typeFilter;

            QbUtil.SetProcessTreeItemOperationMethod(TreeItemOperation);

            DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm);

            QbUtil.RestoreProcessTreeItemOperationMethod();

            if (dr == DialogResult.Cancel)
            {
                return(null);
            }

            MetaTreeNode mtn = Instance.ContentsTree.FocusedMetaTreeNode;

            return(mtn);
        }
Exemplo n.º 2
0
        private void SelectFromDatabaseContentsButton_Click(object sender, EventArgs e)
        {
            MetaTreeNode node = SelectFromContents.SelectSingleItem(
                "Retrieve Related Compound Data",
                "Select a Query or Data Table to use to retrieve related data",
                MetaTreeNodeType.DataTableTypes,
                null,
                false);

            if (node == null)
            {
                return;
            }

            UpdateAndRenderMruList(node);

            return;
        }
Exemplo n.º 3
0
        private void BrowseProjects_Click(object sender, EventArgs e)
        {
            MetaTreeNode mtn = new MetaTreeNode();

            mtn.Name = SS.I.PreferredProjectId;

            mtn = MetaTree.GetNode(SS.I.PreferredProjectId);
            mtn = SelectFromContents.SelectSingleItem(
                "Select Preferred Project",
                "Select your preferred project from the choices given below",
                MetaTreeNodeType.Project, // show project folders and above
                mtn,
                false);

            if (mtn == null)
            {
                return;
            }

            PreferredProject.Text   = mtn.Label;
            PreferredProjectId      = mtn.Target;
            PreferredProjectChanged = true;
        }