static void testGetHandle() { EnablePlugin obj = new EnablePlugin(); IntPtr handle; /*The actual algorithm is here.*/ #if (!TEST) { handle = obj.getHandle(); /*This is to log if we get handle zero even after all the checks are done*/ //Console.WriteLine("The handle is : " + handle); if (handle == IntPtr.Zero) { #if (EXCEPTION) { Exception ex = new Exception("The Handle is zero in main program"); throw ex; } #else { Console.WriteLine("The Handle is zero in main program"); } #endif } else { Console.WriteLine("Found Handle for Firefox"); Console.WriteLine("Done"); } AccessibleCode acobj = new AccessibleCode(handle); //acobj.checkHandle(); acobj.doAccessibleHandle(); # if (TEST) //For testing whether we got the right handle //SetWindowText(handle, "Found it "); //obj.closeWindow(handle); #endif } #endif #if (TEST) //TEST CASES: //1. One instance of Firefox Open - so gets 1 handle //2. 2 instance open - so we need to get the right thing //3. No instance of FF open, so we need to open FF #endif //Console.ReadLine(); obj.closeWindow(handle); }
public async Task <ActionResult> DeleteConfirmed(byte id) { AccessibleCode accessibleCode = await db.AccessibleCodes.FindAsync(id); db.AccessibleCodes.Remove(accessibleCode); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "id,label,description")] AccessibleCode accessibleCode) { if (ModelState.IsValid) { db.Entry(accessibleCode).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(accessibleCode)); }
public async Task <ActionResult> Create([Bind(Include = "id,label,description")] AccessibleCode accessibleCode) { if (ModelState.IsValid) { db.AccessibleCodes.Add(accessibleCode); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(accessibleCode)); }
// GET: AccessibleCodes/Delete/5 public async Task <ActionResult> Delete(byte?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AccessibleCode accessibleCode = await db.AccessibleCodes.FindAsync(id); if (accessibleCode == null) { return(HttpNotFound()); } return(View(accessibleCode)); }