Ejemplo n.º 1
0
        void RenderMruList()
        {
            if (MainMenu.MruList == null)
            {
                return;
            }

            List <MetaTreeNode> nodes = BuildMetaTreeNodeList(MainMenu.MruList);

            if (Qm?.Query != null && Lex.Ne(Qm.Query.Name, "RelatedStructures"))
            {             // allow current query if not defined and not from QuickSearch Cid "RelatedStrctures" query)
                MetaTreeNode ccn = new MetaTreeNode(MetaTreeNodeType.Query);
                ccn.Label = "Current Query";
                ccn.Name  = ccn.Target = "RelatedCompoundsSourceQuery";
                nodes.Insert(0, ccn);                 // put at start
            }

            MruListCtl.Items.Clear();

            for (int ni = 0; ni < nodes.Count; ni++)
            {
                MetaTreeNode     node = nodes[ni];
                ImageListBoxItem li   = new ImageListBoxItem();
                li.ImageIndex = node.GetImageIndex();
                li.Value      = (ni + 1).ToString() + ". " + node.Label;
                li.Tag        = node;
                MruListCtl.Items.Add(li);

                MruListCtl.SetSelected(ni, SelectedNodes.Contains(node.Target));
            }

            if (MruListCtl.SelectedItems.Count == 0 && MruListCtl.Items.Count > 0)
            {
                MruListCtl.SetSelected(0, true);                 // select first item if nothing selected
            }
            return;
        }