গ্র্যাবিজআইটির এএসপি.নেট এপিআই এছাড়াও ইভেন্টগুলি সমর্থন করে, নীচে হ্যান্ডলারের কার্যনির্বাহী করার উদাহরণ 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)); }
অবশেষে ওয়েবকনফিগটি কনফিগার করুন যাতে গ্র্যাবআইটি.এক্সএক্স পোintযাও যাও ক্রীড়াশিক্ষক এম্বেড করা গ্র্যাবজিট ডিএলএল। যদি এটি সঠিকভাবে না করা হয় ScreenShotComplete
ইভেন্ট বরখাস্ত করা হবে না।
এই মনে রাখবেন কলব্যাক আপনার অ্যাপ্লিকেশন লোকালহোস্টে অবস্থিত থাকলে কাজ করবে না।
<httpHandlers> <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" /> </httpHandlers>