public override void SessionCompleted(Session ssn, SessionCompleted cmp)
        {
            RangeSet ranges = cmp.GetCommands();
            RangeSet known  = null;

            if (cmp.GetTimelyReply())
            {
                known = new RangeSet();
            }

            if (ranges != null)
            {
                foreach (Range range in ranges)
                {
                    bool advanced = ssn.Complete(range.Lower, range.Upper);
                    if (advanced && known != null)
                    {
                        known.Add(range);
                    }
                }
            }

            if (known != null)
            {
                ssn.SessionKnownCompleted(known);
            }
        }
Exemple #2
0
        public void RegisterKeyPress(string text)
        {
            foreach (var c in text)
            {
                RegisterKeyPressForChar(c);
            }

            void RegisterKeyPressForChar(char c)
            {
                if (StartTime is null)
                {
                    StartTime = DateTime.UtcNow;
                }
                if (Position < CharactersToType.Count)
                {
                    CharactersToType[Position].RegisterEntry(c);
                    if (CharactersToType[Position].WasCharacterMistyped)
                    {
                        Mistypes++;
                    }
                    Position++;

                    if (Position == CharactersToType.Count)
                    {
                        EndTime = DateTime.UtcNow;
                        SessionCompleted?.Invoke(this, EventArgs.Empty);
                    }
                }
            }
        }
Exemple #3
0
        public void InputSequence(bool b)
        {
            PlaySound(b);

            if (sequence[playIndex] == b)
            {
                if (playIndex >= sequence.Count - 1)
                {
                    score++;
                    StartPlayBack();
                    return;
                }

                playIndex++;
            }
            else
            {
                soundPlayer.Stop();
                buttonOne.Visible = buttonZero.Visible = false;
                CheckHighScore();
                SessionCompleted?.Invoke(this, SequenceString);
            }
        }
Exemple #4
0
 /// <summary>
 /// Raises the SessionCompleted Event.
 /// </summary>
 /// <param name="args">The event data.</param>
 protected internal virtual void OnSessionCompleted(SessionEventArgs args)
 {
     SessionCompleted?.Invoke(this, args);
 }
Exemple #5
0
 private void Server_OnSessionCompleted(object sender, SessionEventArgs e)
 {
     // Trigger the Session Created event for the Listener
     SessionCompleted?.Invoke(sender, e);
 }
Exemple #6
0
 public void OnSessionCompleted(IConnection connection, ISession session)
 {
     SessionCompleted?.Invoke(this, new SessionEventArgs(session));
 }
Exemple #7
0
 public virtual void SessionCompleted(C context, SessionCompleted mystruct)
 {
 }
 protected virtual void OnSessionCompleted(CtpNetStream token)
 {
     SessionCompleted?.Invoke(token);
 }