Beispiel #1
0
 public async Task OnLabelChange(ChangeEventArgs e)
 {
     if (e.Value.ToString().Contains(Filter))
     {
         for (int i = FilterNodes.Count - 1; i >= 0; i--)
         {
             if ((MatchCase.Active && !FilterNodes[i].Label.Contains(e.Value.ToString())) ||
                 (!MatchCase.Active && !FilterNodes[i].Label.ToLower().Contains(e.Value.ToString().ToLower())) ||
                 (MatchExact.Active && FilterNodes[i].Label.ToLower() != e.Value.ToString().ToLower()))
             {
                 FilterNodes.RemoveAt(i);
             }
         }
     }
     else
     {
         FilterNodes.Clear();
         foreach (Node node in Nodes)
         {
             if (MatchCase.Active)
             {
                 if (node.Label.Contains(e.Value.ToString()))
                 {
                     FilterNodes.Add(node);
                 }
             }
             else
             {
                 if (node.Label.ToLower().Contains(e.Value.ToString().ToLower()))
                 {
                     FilterNodes.Add(node);
                 }
             }
         }
         if (MatchExact.Active)
         {
             for (int i = FilterNodes.Count - 1; i >= 0; i--)
             {
                 if (FilterNodes[i].Label.ToLower() != e.Value.ToString().ToLower())
                 {
                     FilterNodes.RemoveAt(i);
                 }
             }
         }
     }
     Filter = e.Value.ToString();
     if (FilterNodes.Any())
     {
         if (ActiveGraph.Nodes.Count == 1 && FilterNodes.Contains(ActiveGraph.Nodes[0]))
         {
             Counter = FilterNodes.IndexOf(ActiveGraph.Nodes[0]);
         }
         else
         {
             Counter = 0;
         }
         await IterateNodes(0);
     }
 }
Beispiel #2
0
 public async Task MatchExactClicked()
 {
     MatchExact.Active = !MatchExact.Active;
     if (MatchExact.Active)
     {
         for (int i = FilterNodes.Count - 1; i >= 0; i--)
         {
             if (FilterNodes[i].Label.ToLower() != Filter.ToLower())
             {
                 FilterNodes.RemoveAt(i);
             }
         }
     }
     else
     {
         FilterNodes.Clear();
         foreach (Node node in Nodes)
         {
             if (node.Label.ToLower().Contains(Filter.ToLower()))
             {
                 FilterNodes.Add(node);
             }
         }
     }
     if (FilterNodes.Any())
     {
         if (ActiveGraph.Nodes.Count == 1 && FilterNodes.Contains(ActiveGraph.Nodes[0]))
         {
             Counter = FilterNodes.IndexOf(ActiveGraph.Nodes[0]);
         }
         else
         {
             Counter = 0;
         }
         await IterateNodes(0);
     }
 }