GrabzIt'ın ASP.NET API'si ayrıca olayları desteklemektedir, aşağıda bir işleyiciye atama örneği ScreenShotComplete
Ekran görüntüsü çağrılmadan önceki olay. Sonra ekran görüntüsü bir kez grabzIt_ScreenShotComplete
yöntem denir.
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)); }
Sonunda web.config dosyasını GrabzIt.ashx po olacak şekilde yapılandırınints işleyicisi gömülü GrabzIt DLL. Bu düzgün yapılmazsa ScreenShotComplete
olay kovulmayacak.
Hatırla bunu geri aramak Uygulamanız localhost'ta bulunuyorsa çalışmaz.
<httpHandlers> <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" /> </httpHandlers>