示例#1
0
        /// <summary>
        /// Redeems the ticket.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public RedeemResult RedeemTicket(int id)
        {
            RedeemResult result = new RedeemResult(TicketSource.RedeemTicket(id));

            AsyncHelper.FireAsync(TicketRedeemed, this, new TicketEventArgs(id, TicketSource, Client.Address)
            {
                Result = result
            });

            return(result);
        }
示例#2
0
        /// <summary>
        /// Gets the ticket with the specific code.
        /// </summary>
        /// <param name="code">The code.</param>
        /// <returns></returns>
        public Ticket GetTicket(string code)
        {
            Trace.WriteLine("Ticket requested: " + code);

            ITicket sourceTicket = TicketSource.GetTicket(code);

            if (sourceTicket == null)
            {
                return(null);
            }

            Ticket ticket = new Ticket(sourceTicket);

            AsyncHelper.FireAsync(TicketRequested, this, new TicketEventArgs(sourceTicket, Client.Address));

            return(ticket);
        }
示例#3
0
        /// <summary>
        ///   This method starts the presentation and recording for
        ///   the current tracker.
        /// </summary>
        public void StartRecording()
        {
            // Cancel if button is not available
            if (!this.recordButton.Enabled)
            {
                return;
            }

            // Cancel presentation and recording if record button is
            // clicked again.
            if (this.recordButton.BackColor == Color.Red)
            {
                if (this.recordModule.Presenter != null)
                {
                    AsyncHelper.FireAsync(new MethodInvoker(this.ClosePresentation));
                }

                this.recordButton.BackColor = Color.Transparent;
                return;
            }

            // Check for unique subject name
            if (!Queries.CheckDatabaseForExistingSubject(this.subjectNameTextBox.Text))
            {
                this.PrepareRecording();

                if (this.recordModule.StartRecording())
                {
                    // This avoids having trouble when the mouse focus switches to the record
                    // module from the presentation module and the user presses
                    // space or enter which would raise a record button click again, which
                    // is not allowed during recording.
                    this.subjectNameTextBox.Focus();

                    // Disable buttons
                    this.recordButton.BackColor = Color.Red;
                    this.subjectButton.Enabled  = false;
                    if (this.calibrateButton != null)
                    {
                        this.calibrateButton.Enabled = false;
                    }
                }
            }
        }