Beispiel #1
0
        ProtoParser.Neuron      ProcessQuery(string _query)
        {
            _query = _query.Trim();

            ProtoParser.Neuron single = m_graph.FindNeuron(_query);
            return(single);
        }
Beispiel #2
0
//      void	SelectNeuronsAndHierarchy( ProtoParser.Neuron[] _neurons ) {
//          if ( _neurons == null ) {
//              Selection = null;
//          }
//
//          List<ProtoParser.Neuron>	neurons = new List<ProtoParser.Neuron>( _neurons );
//          foreach ( ProtoParser.Neuron N in _neurons ) {
//              ProtoParser.Neuron parent = N;
//              while ( parent.ParentsCount > 0 ) {
//                  parent = parent.Parents[0];
//                  neurons.Add( parent );
//              }
//          }
//
//          Selection = neurons.ToArray();
//      }

        private void textBoxSearch_TextChanged(object sender, EventArgs e)
        {
            try {
                ProtoParser.Neuron[] results = m_graph.FindNeurons(textBoxSearch.Text);

                if (results == null || results.Length == 0)
                {
                    ProtoParser.Neuron single = m_graph.FindNeuron(textBoxSearch.Text);
                    if (single != null)
                    {
                        results = new ProtoParser.Neuron[] { single };
                    }
                    else
                    {
                        results = new ProtoParser.Neuron[0];
                    }
                }

                if (results.Length > 0)
                {
                    labelSearchResults.Text = results.Length > 1 ? "Multiple results:\n" : "Single result:\n";
                    foreach (ProtoParser.Neuron result in results)
                    {
                        labelSearchResults.Text += "	"+ result.FullName + "\n";
                    }
                }
                else
                {
                    labelSearchResults.Text = "No result.\n";
                }

//				SelectNeuronsAndHierarchy( results );
                Selection = results;
            } catch (Exception _e) {
                labelSearchResults.Text = "Error during search: " + _e.Message;
//				SelectNeuronsAndHierarchy( new ProtoParser.Neuron[0] );
                Selection = new ProtoParser.Neuron[0];
            }
        }