Exemplo n.º 1
0
        private void LoadFindMenus()
        {
            if (theNeuronArray == null)
            {
                return;
            }
            NeuronMenu.Items.Clear();

            List <string> neuronLabelList = theNeuronArray.GetValuesFromLabelCache();
            List <int>    neuronIdList    = theNeuronArray.GetKeysFromLabelCache();

            for (int i = 0; i < neuronLabelList.Count; i++)
            {
                string shortLabel = neuronLabelList[i];
                if (shortLabel.Length > 20)
                {
                    shortLabel = shortLabel.Substring(0, 20);
                }
                shortLabel        += " (" + neuronIdList[i] + ")";
                neuronLabelList[i] = shortLabel;
            }
            neuronLabelList.Sort();
            NeuronMenu.IsEnabled = (neuronLabelList.Count == 0) ? false : true;
            foreach (string s in neuronLabelList)
            {
                MenuItem mi = new MenuItem {
                    Header = s
                };
                mi.Click += NeuronMenu_Click;
                NeuronMenu.Items.Add(mi);
            }


            ModuleMenu.Items.Clear();
            List <string> moduleLabelList = new List <string>();

            for (int i = 0; i < theNeuronArray.Modules.Count; i++)
            {
                ModuleView theModule  = theNeuronArray.Modules[i];
                string     shortLabel = theModule.Label;
                if (shortLabel.Length > 10)
                {
                    shortLabel = shortLabel.Substring(0, 10);
                }
                shortLabel += " (" + theModule.FirstNeuron + ")";
                moduleLabelList.Add(shortLabel);
            }
            moduleLabelList.Sort();
            ModuleMenu.IsEnabled = (moduleLabelList.Count == 0) ? false : true;
            foreach (string s in moduleLabelList)
            {
                MenuItem mi = new MenuItem {
                    Header = s
                };
                mi.Click += NeuronMenu_Click;
                ModuleMenu.Items.Add(mi);
            }
        }