GrabzItのASP.NET API イベントもサポートします。以下にハンドラを割り当てる例を示します ScreenShotComplete
スクリーンショットが呼び出される前のイベント。 次に、スクリーンショットが完了すると、内のコード grabzIt_ScreenShotComplete
メソッドが呼び出されます。
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)); }
最後にweb.configを設定して、GrabzIt.ashx pointに ハンドラ に埋め込まれた GrabzIt DLL。 これが適切に行われない場合 ScreenShotComplete
イベントは発生しません。
これを覚えて 折り返し電話 アプリケーションがローカルホストにある場合は機能しません。
<httpHandlers> <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" /> </httpHandlers>