Exemplo n.º 1
0
        /// <summary>
        /// ContentsTreeItemSelected
        /// </summary>
        /// <param name="nodeTarget"></param>

        private void ContentsTreeItemSelected(string nodeTarget)
        {
            MetaTreeNode node = MetaTreeNodeCollection.GetNode(nodeTarget);

            if (node == null || (node.Type & TypeFilter) == 0)
            {
                SelectionName.Text = SelectionTarget.Text = "";
                return;
            }

            else if (node.IsDataTableType)
            {
                MetaTable mt = MetaTableCollection.Get(node.Target);
                if (mt == null)
                {
                    return;                             // shouldn't happen
                }
                if (mt.SummarizedExists)                // Prompt user for summarization-level choice
                {
                    FocusedMetaTable = mt;
                    Point p = Form.MousePosition;
                    p = ContentsTreeWithSearch.ContentsTreeCtl.PointToClient(p);
                    SummarizationLevelContextMenu.Show(ContentsTreeWithSearch.ContentsTreeCtl, p);
                    return;
                }
            }

            SelectionName.Text   = node.Label;
            SelectionTarget.Text = node.Target;

// If item is double clicked then we're done

            MouseEventArgs ma = ContentsTreeWithSearch.CurrentContentsTreeMouseDownEvent;

            if (ma != null && ma.Clicks >= 2)
            {
                DialogResult = DialogResult.OK;
            }

            return;
        }
Exemplo n.º 2
0
/// <summary>
/// ContentsTreeItemSelected
/// </summary>
/// <param name="nodeTarget"></param>

        private void ContentsTreeItemSelected(string nodeTarget)
        {
            //MetaTreeNode node = ContentsTreeWithSearch.ContentsTree.GetMetaTreeNodeAt(ContentsTreeWithSearch.ContentsTree.PointToClient(Cursor.Position));
            //if (node == null || !node.IsDataTableType) return;

            string    mtName = nodeTarget;
            MetaTable mt     = MetaTableCollection.Get(mtName);

            if (mt == null)
            {
                return;
            }

            if (mt.UseSummarizedData || !mt.SummarizedExists)
            {
                RenderTable(mt, null); // use table as selected
            }
            else                       // select table based on desired summarization level
            {
                if (mt.SummarizedExists && SelectSummarizedDataByDefault)
                {
                    string    mtName2 = mtName += MetaTable.SummarySuffix;
                    MetaTable mt2     = MetaTableCollection.Get(mtName2);
                    if (mt2 != null)
                    {
                        RenderTable(mt2, null);                         // use table as selected
                        return;
                    }
                }

// Prompt user for summarization-level choice

                FocusedMetaTable = mt;
                Point p = Form.MousePosition;
                p = ContentsTreeWithSearch.ContentsTreeCtl.PointToClient(p);
                SummarizationLevelContextMenu.Show(ContentsTreeWithSearch.ContentsTreeCtl, p);
            }
        }