private bool PrintCard()
 {
     this.PrintMabelCard(this.nextCard);
     if (Properties.Settings.Default.PrinterType.Equals("Magicard"))
     {
         try {
             MagiCardAPI.MagiCardReturnVal retPrint = magi_api.Wait();
             if (retPrint == MagiCardAPI.MagiCardReturnVal.ERROR_SUCCESS)
             {
                 // printed OK
                 mabel_api.SetCardPrinted(printer_id, this.nextCard);
                 mabel_api.SetCardStatus(printer_id, this.nextCard, "printed");
                 return(true);
             }
             else
             {
                 mabel_api.SetCardStatus(printer_id, this.nextCard, "failed");
                 OnDebug(new DebugEventArgs("", "Magicard failed to print: " + magi_api.GetLastError()));
                 return(false);
             }
         }
         catch (MagicardException ex)
         {
             OnDebug(new DebugEventArgs("", "Magicard Exception waiting for print: " + ex.Message + " - " + magi_api.GetLastError()));
             return(false);
         }
     }
     else
     {
         mabel_api.SetCardPrinted(printer_id, this.nextCard);
         mabel_api.SetCardStatus(printer_id, this.nextCard, "printed");
         return(true);
     }
 }
 private bool EjectCard()
 {
     OnEject(new PrinterEventArgs(this.nextCard, "Ejecting card", _printerInfo));
     magi_api.Eject();
     MagiCardAPI.MagiCardReturnVal retEject = magi_api.Wait();
     if (retEject == MagiCardAPI.MagiCardReturnVal.ERROR_SUCCESS)
     {
         // worked OK
         OnEjectSuccess(new PrinterEventArgs(this.nextCard, "Ejected OK", _printerInfo));
         return(true);
     }
     else
     {
         return(false);
     }
 }
 private bool EncodeCard()
 {
     try {
         magi_api.SendEncodeMag(this.nextCard.mag_token);
         MagiCardAPI.MagiCardReturnVal magWaitRet = magi_api.Wait();
         if (magWaitRet == MagiCardAPI.MagiCardReturnVal.ERROR_SUCCESS)
         {
             return(true);
         }
         return(false);
     } catch (MagicardException ex)
     {
         OnDebug(new DebugEventArgs("", "Magicard Exception Encoding: " + ex.Message + " " + magi_api.GetLastError()));
         return(false);
     }
 }
 public bool LoadCard()
 {
     try
     {
         magi_api.Feed();
         MagiCardAPI.MagiCardReturnVal ret = magi_api.Wait();
         if (ret == MagiCardAPI.MagiCardReturnVal.MAGICARD_ERROR)
         {
             return(false);
             // go to the fail/retry state?
         }
         return(true);
     }
     catch (MagicardException e)
     {
         OnDebug(new DebugEventArgs("", "Magicard Exception Feeding: " + e.Message + " - " + magi_api.GetLastError()));
         return(false);
     }
 }