Example #1
0
 private void ChangeUI(AgentEvent state)
 {
     try
     {
         new ComMethods.SwitchOnType <AgentEvent>(state)
         .Case <AgentInitiate>(initiate =>
         {
             UiState.InInitiateState();
         })
         .Case <AgentIdle>(i =>
         {
             UiState.InAgentIdleState(null);
         })
         .Case <AgentBusy>(b =>
         {
             UiState.InAgentBusy(CallDirection);
         })
         .Case <AgentAcw>(b =>
         {
             UiState.InAgentAcwState();
         })
         .Case <AgentBreak>(b =>
         {
             UiState.InBreakState();
         })
         .Case <AgentOffline>(b => UiState.InOfflineState(StatusText, ErrorMsg, StatusCode))
         .Default <AgentEvent>(t => UiState.InOfflineState(StatusText, ErrorMsg, StatusCode));
     }
     catch (Exception exception)
     {
         Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "Agent ChangeUI", exception, Logger.LogLevel.Error);
     }
 }
Example #2
0
        private void InitializeArdsEvent()
        {
            try
            {
                ardsHandler.OnStatusUpdatedMessage += (s) =>
                {
                    try
                    {
                    }
                    catch (Exception exception)
                    {
                        Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnStatusUpdatedMessage", exception, Logger.LogLevel.Error);
                    }
                };



                #region Breake

                ardsHandler.OnSendResourceChangeBreakCompleted += (s) =>
                {
                    try
                    {
                        AgentCurrentState = new AgentBreak();
                    }
                    catch (Exception exception)
                    {
                        Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnSendResourceChangeBreakCompleted", exception, Logger.LogLevel.Error);
                    }
                };


                ardsHandler.OnSendStatusChangeRequestBreakCompleted += (s) =>
                {
                    try
                    {
                        if (s.Command == WorkflowResultCode.ACDS301 || s.Command == WorkflowResultCode.ACDS4032)
                        {
                            AgentCurrentState = new AgentBreak();
                            ardsHandler.ResourceStatusChangeBreak(Auth, CallSessionId);
                        }
                        UiState.ShowNotifications(s);
                    }
                    catch (Exception exception)
                    {
                        Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnSendStatusChangeRequestBreakCompleted", exception, Logger.LogLevel.Error);
                    }
                };

                ardsHandler.OnCancelBreakRequestCompleted += (s) =>
                {
                    try
                    {
                        UiState.CancelBreakRequest(s);
                    }
                    catch (Exception exception)
                    {
                        Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnCancelBreakRequestCompleted", exception, Logger.LogLevel.Error);
                    }
                };

                #endregion Breake

                #region Reregistor

                ardsHandler.OnResourceRegistrationCompleted += (s) =>
                {
                    Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnResourceRegistrationCompleted", Logger.LogLevel.Debug);
                };

                #endregion Reregistor



                #region StatusChangeRequestIdel

                ardsHandler.OnSendStatusChangeRequestIdelCompleted += (s) =>
                {
                    try
                    {
                        switch (s.Command)
                        {
                        case WorkflowResultCode.ACDS4033:
                        {
                            ardsHandler.ResourceModeChange(Auth, CallSessionId);
                        }
                        break;

                        case WorkflowResultCode.ACDS403:
                        {
                            UiState.InAgentIdleState(_agentPvState);
                        }
                        break;

                        case WorkflowResultCode.ACDS301:
                        case WorkflowResultCode.ACDS4032:
                        {
                            AgentCurrentState = new AgentBreak();
                            ardsHandler.ResourceStatusChangeBreak(Auth, CallSessionId);
                        }
                        break;
                        }
                    }
                    catch (Exception exception)
                    {
                        Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnSendStatusChangeRequestIdelCompleted", exception, Logger.LogLevel.Error);
                    }
                };

                #endregion StatusChangeRequestIdel

                #region Mode

                ardsHandler.OnSendModeChangeRequestOutboundCompleted += (s) =>
                {
                    if (s.Command == WorkflowResultCode.ACDS501)
                    {
                        ardsHandler.ResourceModeChange(Auth, CallSessionId);
                    }
                    else
                    {
                        UiState.OnSendModeChangeRequestOutbound(s);
                    }
                };

                ardsHandler.OnSendModeChangeRequestInboundCompleted += (s) =>
                {
                    if (s.Command == WorkflowResultCode.ACDS501)
                    {
                        ardsHandler.ResourceModeChange(Auth, CallSessionId);
                    }
                    else
                    {
                        UiState.OnSendModeChangeRequestInbound(s);
                    }
                };

                ardsHandler.OnResourceModeChanged += (r) =>
                {
                    try
                    {
                        AgentMode = AgentReqMode;
                    }
                    catch (Exception exception)
                    {
                        Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "OnResourceModeChanged", exception, Logger.LogLevel.Error);
                    }
                };
                #endregion
            }
            catch (Exception exception)
            {
                Logger.Instance.LogMessage(Logger.LogAppender.DuoLogger2, "InitializeArdsEvent", exception, Logger.LogLevel.Error);
            }
        }