/// <summary> /// Redeems the current ticket. /// </summary> private bool RedeemCurrentTicket() { StopAutoRedeemTimer(); if (currentTicket == null) { return(false); } ResetUI(); if (currentTicket.IsRedeemed) { currentTicket = null; return(true); } try { RedeemResult result = service.RedeemTicket(currentTicket.Id); currentTicket = null; if (result.Type == RedeemResultType.Redeemed) { scanner.Beep(BeepType.TicketRedeemed); return(true); } else if (result.Type == RedeemResultType.AlreadyRedeemed) { labelCodeInfo.Invoke((Action) delegate() { labelCodeInfo.Text = Resources.AlreadyRedeemed; }); } else { labelCodeInfo.Invoke((Action) delegate() { labelCodeInfo.Text = result.Error; }); } } catch (WebException exp) { MessageBox.Show(Resources.ConnectionLost_Content + exp.Status.ToString(), Resources.ConnectionLost_Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (SelectService()) { return(RedeemCurrentTicket()); } Close(); } scanner.Beep(BeepType.Error); return(false); }
public RedeemMessage(RedeemResult result, int itemType, int itemId) : base(MessageType.RedeemMessage) { Result = result; ItemType = itemType; ItemId = itemId; }
private void buttonRedeemTicket_Click(object sender, RoutedEventArgs e) { RedeemResult result = service.RedeemTicket(Convert.ToInt32(textBoxId.Text)); textBoxStatus.Text = "Redeem: " + result.Type.ToString() + Environment.NewLine + textBoxStatus.Text; }