Ejemplo n.º 1
0
 private void CustomCrawlerCluster_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.F2)
     {
         if (locking)
         {
             F2.Text = "F2: Lock";
             locking = false;
         }
         else
         {
             F2.Text = "F2: UnLock";
             locking = true;
         }
     }
     else if (e.Key == Key.F3)
     {
         depth--;
         if (depth < 0)
         {
             depth = 0;
         }
         Depth.Text = $"Depth={depth}";
         cbccw.adjust();
     }
     else if (e.Key == Key.F4)
     {
         depth++;
         Depth.Text = $"Depth={depth}";
         cbccw.adjust();
     }
     else if (e.Key == Key.F5)
     {
         new CustomCrawlerTree(cbccw.selected_node, new List <HtmlNode> {
             cbccw.selected_node
         }, this).Show();
     }
     else if (e.Key == Key.F6)
     {
         if (cbccw.selected_node != null)
         {
             AppendCapture(cbccw.selected_node.XPath);
         }
     }
     else if (e.Key == Key.F7)
     {
         if (cbccw.selected_node != null)
         {
             var locking = this.locking;
             this.locking = true;
             (new CustomCrawlerClusterCapture()
             {
                 Owner = this
             }).ShowDialog();
             this.locking = locking;
         }
     }
     else if (e.Key == Key.Add)
     {
         if (browser.ZoomLevel <= 3.0)
         {
             browser.ZoomInCommand.Execute(null);
         }
     }
     else if (e.Key == Key.Subtract)
     {
         if (browser.ZoomLevel >= -3.0)
         {
             browser.ZoomOutCommand.Execute(null);
         }
     }
     else if (e.Key == Key.F8)
     {
         if (cbccw.selected_node != null)
         {
             var tar = cbccw.selected_node.GetAttributeValue("ccw_tag", "");
             if (Marking.Contains(tar))
             {
                 Marking.Remove(tar);
                 cbccw.before_border = "";
                 browser.EvaluateScriptAsync($"document.querySelector('[ccw_tag={tar}]').style.border = '';").Wait();
             }
             else
             {
                 Marking.Add(cbccw.selected_node.GetAttributeValue("ccw_tag", ""));
                 refresh_marking();
             }
         }
     }
     else if (e.Key == Key.F12)
     {
         connect_devtools();
     }
 }