/// <summary> /// Gets the ticket and shows the received information. /// </summary> /// <param name="code">The code.</param> private void GetTicket(string code) { if (currentTicket != null) { if (!RedeemCurrentTicket()) { return; } } labelCodeInfo.Invoke((Action) delegate() { labelCodeInfo.Text = Resources.Code + ": " + code + Environment.NewLine; }); RequestTicket(code); if (currentTicket == null) { scanner.Beep(BeepType.Error); labelCodeInfo.Invoke((Action) delegate() { labelCodeInfo.Text = Resources.TicketNotFound; labelCodeInfo.ForeColor = Color.Red; buttonCancel.Enabled = true; }); return; } string type = string.Empty; switch (currentTicket.Type) { case TicketType.Free: type = Resources.CardType_Free; break; case TicketType.Normal: type = Resources.CardType_Normal; break; case TicketType.Special: type = Resources.CardType_Special; break; default: type = Resources.CardType_Unknown; break; } type += " " + (currentTicket.IsOnlineTicket ? Resources.CardVersion_Online : Resources.CardVersion_Offline); labelCodeInfo.Invoke((Action) delegate() { labelCodeInfo.Text += Resources.Type + ": " + type + Environment.NewLine; labelCodeInfo.Text += currentTicket.Name + Environment.NewLine; labelCodeInfo.Text += currentTicket.Street + Environment.NewLine; labelCodeInfo.Text += currentTicket.Zip + " " + currentTicket.City + Environment.NewLine; labelCodeInfo.Text += currentTicket.Phone + Environment.NewLine; labelCodeInfo.Text += currentTicket.EMail + Environment.NewLine; buttonCancel.Enabled = true; if (currentTicket.IsRedeemed) { labelCodeInfo.Text += Resources.Redeemed + ": " + currentTicket.RedeemDate.Value.ToString("T"); labelCodeInfo.ForeColor = Color.Red; scanner.Beep(BeepType.Error); } else if (currentTicket.Type == TicketType.Special) { buttonRedeem.Enabled = true; scanner.Beep(BeepType.Attention); } else { buttonRedeem.Enabled = true; StartAutoRedeemTimer(); } }); }