Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get a notification from each tab that the page is loaded #59

Open
it19862 opened this issue Jul 19, 2022 · 0 comments
Open

Get a notification from each tab that the page is loaded #59

it19862 opened this issue Jul 19, 2022 · 0 comments

Comments

@it19862
Copy link

it19862 commented Jul 19, 2022

How do I get a notification from each tab that a page is loaded?

I created a form to control the browser.
Logic:

    • open the browser;
  • open multiple links in a separate tab;

Question.

  1. How do I get a notification from each tab that the download is finished and the page is fully loaded?

Form1.cs
`namespace CefSharpWinFormsAndSharpBrowser
{
public partial class Form1 : Form
{
BrowserService browserService = new BrowserService();

    public Form1()
    {
        InitializeComponent();
        // Form1Tests form1Tests = new Form1Tests(this);
        // form1Tests.Owner = this;
    }

   
    /// <summary>
    /// Open browser
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void button1_Click(object sender, EventArgs e)
    {
        browserService.OpenBrowser();
    }
   
    /// <summary>
    /// Goto URL
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void button10_Click(object sender, EventArgs e)
    {
        List<string> urls = new List<string>()
        {
            "github.com",
            "stackoverflow.com",
            "habr.com"
        };

        foreach (string url in urls)
        {
            browserService.AddNewBrowser(url);
            // browserService.LoadURL(url);
        }
    }
}

}
`

BrowserService.cs
`using SharpBrowser;
using SharpBrowser.BrowserTabStrip;

using System.IO;

namespace CefSharpWinFormsAndSharpBrowser.Services
{
public class BrowserService
{
// Form _formBrowser;

    MainForm mainForm = new MainForm();

    SharpTab SharpTab = new SharpTab();

    FileService fileService = new FileService();        

    private SharpBrowser.BrowserTabStrip.BrowserTabStrip TabPages = new SharpBrowser.BrowserTabStrip.BrowserTabStrip();

    public BrowserService()
    {
        

    }

    public void OpenBrowser()
    {
        mainForm.Show();

    }
    

    public void AddNewBrowser(string url)
    {
        mainForm.AddNewBrowserTab(url);
    }       


    public void LoadURL(string url)
    {
        mainForm.LoadURLPublic(url);
    }
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant