示例#1
0
 private void btnCheck_ClickAnimationFinished(object sender)
 {
     if (btnCheck.Text == "Check")
     {
         MaterialRadioButton rb = null;
         foreach (Control c in Controls)
         {
             MaterialRadioButton r = c as MaterialRadioButton;
             if (r != null)
             {
                 if (r.Checked == true)
                 {
                     rb = r;
                 }
             }
         }
         if (rb == null)
         {
             return;
         }
         if (rb.Text == question.CorrectAns)
         {
             lblAnsResult.Text = "Correct";
             int boxOffset = rb.Height / 2;
             ChangePrimary(true, rb.Location + new Size(boxOffset, boxOffset));
             OnAnswered?.Invoke(this, true);
         }
         else
         {
             lblAnsResult.Text = "Wrong";
             foreach (Control c in Controls)
             {
                 MaterialRadioButton r = c as MaterialRadioButton;
                 if (r != null)
                 {
                     if (r.Text == question.CorrectAns)
                     {
                         r.Enabled = true;
                     }
                     else
                     {
                         r.Enabled = false;
                     }
                 }
             }
             OnAnswered?.Invoke(this, false);
         }
         btnCheck.Text = "Close";
     }
     else
     {
         Height = 0;
         OnClosed?.Invoke(this);
     }
 }
示例#2
0
        internal void StateChangeHandler(CallingEventParams eventParams, CallingEventParams.StateParams stateParams)
        {
            PreviousState = State;
            State         = stateParams.CallState;

            OnStateChange?.Invoke(mAPI, this, eventParams, stateParams);

            switch (stateParams.CallState)
            {
            case CallState.ringing:
                OnRinging?.Invoke(mAPI, this, eventParams, stateParams);
                break;

            case CallState.answered:
                OnAnswered?.Invoke(mAPI, this, eventParams, stateParams);
                break;

            case CallState.ending:
                OnEnding?.Invoke(mAPI, this, eventParams, stateParams);
                break;

            case CallState.ended:
                mAPI.RemoveCall(stateParams.CallID);
                if (stateParams.Peer != null && Peer != null && Peer.ID == stateParams.Peer.CallID)
                {
                    // Detach peer from this ended call
                    Peer.Peer = null;
                    Peer      = null;
                }
                if (stateParams.EndReason == DisconnectReason.busy)
                {
                    mBusy = true;
                }
                OnEnded?.Invoke(mAPI, this, eventParams, stateParams);
                break;
            }
        }
示例#3
0
        internal void StateChangeHandler(CallEventParams.StateParams stateParams)
        {
            CallState oldState = State;

            State = stateParams.CallState;

            OnStateChange?.Invoke(mAPI, this, oldState, stateParams);

            switch (stateParams.CallState)
            {
            case CallState.ringing:
                OnRinging?.Invoke(mAPI, this, oldState, stateParams);
                break;

            case CallState.answered:
                OnAnswered?.Invoke(mAPI, this, oldState, stateParams);
                break;

            case CallState.ending:
                OnEnding?.Invoke(mAPI, this, oldState, stateParams);
                break;

            case CallState.ended:
                mAPI.RemoveCall(stateParams.CallID);
                if (stateParams.Peer != null && Peer != null && Peer.CallID == stateParams.Peer.CallID)
                {
                    // Detach peer from this ended call
                    Peer.Peer = null;
                    Peer      = null;
                }
                OnEnded?.Invoke(mAPI, this, oldState, stateParams);
                break;

            default: break;
            }
        }
示例#4
0
 private void OnAnswer()
 {
     CurrentAnswered = CurrentAnswered + 1;
     OnAnswered.Invoke();
 }