Narzędzia do przechwytywania i konwertowania Internetu

Zdarzenia zrzutów ekranu w programie ASP.NET

Interfejs API ASP.NET

Interfejs API GrabzIt ASP.NET obsługuje również zdarzenia, poniżej znajduje się przykład przypisania modułu obsługi do ScreenShotComplete zdarzenie przed wywołaniem zrzutu ekranu. Następnie po zakończeniu zrzutu ekranu kod w grabzIt_ScreenShotComplete wywoływana jest metoda

private GrabzItClient grabzIt = GrabzItClient.Create("Sign in to view your Application Key", "Sign in to view your Application Secret")%>");

protected void btnSubmit_Click(object sender, EventArgs e)
{ 
    grabzIt.ScreenShotComplete += grabzIt_ScreenShotComplete;
    grabzIt.URLToImage("https://www.tesla.com"); 	

    //The below line specifies the GrabzIt.ashx handler inside the GrabzIt.dll
    grabzIt.Save(HttpContext.Current.Request.Url.Scheme + "://" + 
    HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath
    + "GrabzIt.ashx");
}

//The event method saves the screenshot
protected void grabzIt_ScreenShotComplete(object sender, ScreenShotEventArgs result)
{
    GrabzItFile file = grabzIt.GetResult(result.ID);
    file.Save(Server.MapPath("~/results/"+result.Filename));
}

Na koniec skonfiguruj plik web.config, aby GrabzIt.ashx points do treser osadzony w GrabzIt DLL. Jeśli nie zostanie to wykonane poprawnie, ScreenShotComplete wydarzenie nie zostanie uruchomione.

Pamiętaj to oddzwonić nie będzie działać, jeśli aplikacja znajduje się na localhost.

<httpHandlers>
        <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" />
</httpHandlers>