コード例 #1
0
        private void btnNewTarget_Click(object sender, EventArgs e)
        {
            SimpleInputForm newTargetForm = new SimpleInputForm("New Target");

            newTargetForm.Location = ((Button)sender).Location;
            newTargetForm.ShowDialog();
            if (newTargetForm.DialogResult == DialogResult.OK)
            {
                if (newTargetForm.title != "")
                {
                    Main_Instance.Instance.Workspace.Targets.Add(new Target(newTargetForm.title));
                    populateCmbTargets();
                }
                //Main_Instance.Instance.Workspace.
            }
        }
コード例 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (browser.Text == null)
     {
         MessageBox.Show("Invalid URL");
     }
     else
     {
         SimpleInputForm newTargetForm = new SimpleInputForm(labelURLTitle.Text, txtURL.Text /*webBrowser1.Document.Title, webBrowser1.Url.ToString()*/);
         newTargetForm.Location = selectedLocation;
         newTargetForm.ShowDialog();
         if (newTargetForm.DialogResult == DialogResult.OK)
         {
             if (newTargetForm.title != "")
             {
             }
             //Main_Instance.Instance.Workspace.
         }
     }
 }
コード例 #3
0
        private void InteractEventTriggered(object sender, EventArgs e)
        {
            InteractEventArgs interactEventArgs = e as InteractEventArgs;

            if (interactEventArgs.Operation.Equals(InteractEventArgs.Operation_Type.INSERT))
            {
                SimpleInputForm simpleInputForm = new SimpleInputForm(interactEventArgs.SelectedObjects);
                var             result          = simpleInputForm.ShowDialog();
                if (result == DialogResult.OK)
                {
                }
                else
                {
                }
            }
            else if (interactEventArgs.Operation.Equals(InteractEventArgs.Operation_Type.OPEN_URL))
            {
                HashSet <TreeNode> selectedObjects = interactEventArgs.SelectedObjects;
                Open_Url_Form      open_Url_Form   = new Open_Url_Form(selectedObjects.FirstOrDefault().Text);
                open_Url_Form.Show();
            }
        }
コード例 #4
0
        public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
        {
            // React to the first ID (add to target method)

            if (commandId > (CefMenuCommand)initial_command)
            {
                if (commandId == ((CefMenuCommand)initial_command + 1))
                {
                    SimpleInputForm newTargetForm = new SimpleInputForm("New Target");
                    //newTargetForm.ShowDialog(resultsForm);
                    resultsForm.Invoke((MethodInvoker) delegate
                    {
                        // Running on the UI thread
                        newTargetForm.ShowDialog();
                    });
                    if (newTargetForm.DialogResult == DialogResult.OK)
                    {
                        if (newTargetForm.title != "")
                        {
                            TreeNode target   = new TreeNode(newTargetForm.title);
                            TreeNode treeNode = new TreeNode("From Browser");
                            treeNode.Nodes.Add(new TreeNode(parameters.SelectionText));
                            target.Nodes.Add(treeNode);
                            Main_Instance.Instance.Workspace.TargetTreeView.Nodes.Add(target);
                        }
                        //Main_Instance.Instance.Workspace.
                    }
                }
                else
                {
                    int index = (int)commandId - initial_command - 2;
                    if (Main_Instance.Instance.Workspace.TargetTreeView.Nodes[index].Nodes.ContainsKey("From Browser"))
                    {
                        resultsForm.Invoke((MethodInvoker) delegate
                        {
                            Main_Instance.Instance.Workspace.TargetTreeView.Nodes[index].Nodes["From Browser"].Nodes.Add(new TreeNode(parameters.SelectionText));
                            Main_Instance.Instance.Workspace.ReloadTargetsFromTreeView();
                        });
                    }
                    else
                    {
                        TreeNode treeNode = new TreeNode("From Browser");
                        treeNode.Nodes.Add(new TreeNode(parameters.SelectionText));
                        resultsForm.Invoke((MethodInvoker) delegate
                        {
                            // Running on the UI thread
                            Main_Instance.Instance.Workspace.TargetTreeView.Nodes[index].Nodes.Add(treeNode);
                            Main_Instance.Instance.Workspace.ReloadTargetsFromTreeView();
                        });
                    }
                }
                //browser.GetHost().ShowDevTools();
                return(true);
            }

            // Any new item should be handled through a new if statement


            // Return false should ignore the selected option of the user !
            return(false);
        }
コード例 #5
0
 private void myMenuItem_Click(object sender, EventArgs e)
 {
     if (((MenuItem)sender).Text == "Remove" && selectedNode != null)
     {
         treeViewResults.Nodes.Remove(selectedNode);
     }
     else if (((MenuItem)sender).Text == "New Target" && selectedNode != null)
     {
         SimpleInputForm newTargetForm = new SimpleInputForm("New Target");
         newTargetForm.Location = selectedLocation;
         newTargetForm.ShowDialog();
         if (newTargetForm.DialogResult == DialogResult.OK)
         {
             if (newTargetForm.title != "")
             {
                 Main_Instance.Instance.Workspace.Targets.Add(new Target(newTargetForm.title, selectedNode));
             }
             Main_Instance.Instance.Workspace.ReloadTreeViewFromTargets();
             Main_Instance.Instance.MainForm_Instance.ReloadWorkspace(true);
             //Main_Instance.Instance.Workspace.
         }
     }
     else if (((MenuItem)sender).Text == "Process Module" && selectedNode != null)
     {
         Show_Modules process_Modules = new Show_Modules(General_Config.Module_Type.Process);
         var          result          = process_Modules.ShowDialog();
         if (result == DialogResult.OK)
         {
             IProcessing_Module process_Module = (IProcessing_Module)process_Modules.selected_module;
             treeViewResults.Nodes.Add(process_Module.Process(selectedNode));
         }
         else
         {
             process_Modules.Hide();
         }
     }
     else if (((MenuItem)sender).Text == "Predefined Browser" && selectedNode != null)
     {
         if (selectedNode.Text.Contains("http:") || selectedNode.Text.Contains("https:"))
         {
             //webBrowser1.Url = new Uri(selectedNode.Text);
             //txtURL.Text = selectedNode.Text;
             OpenUrl(selectedNode.Text);
             //MessageBox.Show(e.Node.Nodes.Count + "");
         }
         else
         {
             string url = dig_node_for_url(selectedNode);
             if (url != null)
             {
                 OpenUrl(url);
             }
         }
     }
     else if (((MenuItem)sender).Text == "Chromium" && selectedNode != null)
     {
         if (selectedNode.Text.Contains("http:") || selectedNode.Text.Contains("https:"))
         {
             browser.Load(selectedNode.Text);
         }
         else
         {
             string url = dig_node_for_url(selectedNode);
             if (url != null)
             {
                 browser.Load(url);
             }
         }
     }
     else
     {
         if (!Main_Instance.Instance.Workspace.FindTarget(((MenuItem)sender).Text).AddNode(selectedNode))
         {
             MessageBox.Show("Current node already exists!");
         }
         Main_Instance.Instance.Workspace.ReloadTreeViewFromTargets();
         Main_Instance.Instance.MainForm_Instance.ReloadWorkspace(true);
     }
 }