/// <summary> /// Attempt to claim the connected cash drawer. /// </summary> /// <returns>True if the cash drawer was successfully claimed, false otherwise.</returns> private async Task <bool> ClaimCashDrawer() { if (drawer == null) { return(false); } if (claimedDrawer == null) { claimedDrawer = await drawer.ClaimDrawerAsync(); if (claimedDrawer == null) { return(false); } } return(true); }
/// <summary> /// Attempt to claim the connected cash drawer. /// </summary> /// <param name="instance">Specifies the cash drawer instance that should be used.</param> /// <returns>True if the cash drawer was successfully claimed, false otherwise.</returns> private async Task <bool> ClaimCashDrawer(CashDrawerInstance instance) { bool claimAsyncStatus = false; switch (instance) { case CashDrawerInstance.Instance1: claimedCashDrawerInstance1 = await cashDrawerInstance1.ClaimDrawerAsync(); if (claimedCashDrawerInstance1 != null) { rootPage.NotifyUser("Successfully claimed instance 1.", NotifyType.StatusMessage); claimAsyncStatus = true; } else { rootPage.NotifyUser("Failed to claim instance 1.", NotifyType.ErrorMessage); } break; case CashDrawerInstance.Instance2: claimedCashDrawerInstance2 = await cashDrawerInstance2.ClaimDrawerAsync(); if (claimedCashDrawerInstance2 != null) { rootPage.NotifyUser("Successfully claimed instance 2.", NotifyType.StatusMessage); claimAsyncStatus = true; } else { rootPage.NotifyUser("Failed to claim instance 2.", NotifyType.ErrorMessage); } break; default: break; } return(claimAsyncStatus); }