ਗਰੈਬਜ਼ਿਟ ਦਾ ਏਐਸਪੀ.ਨੇਟ API ਹੇਠ ਲਿਖਿਆਂ ਨੂੰ ਇੱਕ ਹੈਂਡਲਰ ਨਿਰਧਾਰਤ ਕਰਨ ਦੀ ਇੱਕ ਉਦਾਹਰਣ ਹੈ ScreenShotComplete ਸਕ੍ਰੀਨਸ਼ਾਟ ਬੁਲਾਉਣ ਤੋਂ ਪਹਿਲਾਂ ਦਾ ਪ੍ਰੋਗਰਾਮ. ਫਿਰ ਇਕ ਵਾਰ ਸਕਰੀਨ ਸ਼ਾਟ ਦੇ ਅੰਦਰ ਕੋਡ ਪੂਰਾ ਹੋ ਗਿਆ grabzIt_ScreenShotComplete methodੰਗ ਨੂੰ ਕਿਹਾ ਜਾਂਦਾ ਹੈ.
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ਨੂੰ ਹੈਂਡਲਰ ਵਿੱਚ ਸ਼ਾਮਲ ਗਰੈਬਜ਼ਿਟ ਡੀ.ਐਲ.ਐਲ.. ਜੇ ਇਹ ਸਹੀ doneੰਗ ਨਾਲ ਨਹੀਂ ਕੀਤਾ ਜਾਂਦਾ ScreenShotComplete ਘਟਨਾ ਨੂੰ ਬਰਖਾਸਤ ਨਹੀਂ ਕੀਤਾ ਜਾਵੇਗਾ.
ਇਹ ਯਾਦ ਰੱਖੋ ਵਾਪਸ ਫੋਨ ਮਲਾਓ ਜੇ ਤੁਹਾਡੀ ਅਰਜ਼ੀ ਲੋਕਲਹੋਸਟ ਤੇ ਸਥਿਤ ਹੈ ਤਾਂ ਕੰਮ ਨਹੀਂ ਕਰੇਗੀ.
<httpHandlers> <add verb="*" path="GrabzIt.ashx" type="GrabzIt.Handler, GrabzIt" /> </httpHandlers>