Exemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var       interaction = value as IInteraction;
            MediaType curType     = CISpecification.cIInfoType(interaction);

            Logger.Logger.Log.Debug("MediaTypeToImageConverter: cIState: " + curType);
            var result = string.Empty;

            if (interaction != null)
            {
                switch (interaction.Type)
                {
                case MediaType.Voice:
                    if (curType == MediaType.Chat)
                    {
                        result = Resources.MediaTypeChatImageUri;
                    }
                    else if (curType == MediaType.Incident)
                    {
                        result = Resources.MediaTypeIncidentImageUri;
                    }
                    else
                    {
                        result = Resources.MediaTypeVoiceImageUri;
                    }
                    //result = Resources.MediaTypeVoiceImageUri;
                    break;

                case MediaType.Email:
                    result = Resources.MediaTypeEmailImageUri;
                    break;

                case MediaType.Fax:
                    break;

                case MediaType.Web:
                    result = Resources.MediaTypeWebImageUri;
                    break;

                case MediaType.Social:
                    break;

                case MediaType.Sms:
                    break;

                case MediaType.Generic:
                    break;

                default:
                    break;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            var result = string.Empty;

            if (value[0] is InteractionState)
            {
                var state = (InteractionState)value[0];
                if (state != InteractionState.Ringing)
                {
                    switch (state)
                    {
                    case InteractionState.Active:
                        result = Resources.InteractionStateActive;
                        break;

                    case InteractionState.Held:
                        result = Resources.InteractionStateHeld;
                        break;

                    case InteractionState.Disconnected:
                        result = Resources.InteractionStateDisconnected;
                        break;

                    case InteractionState.Dialing:
                        result = Resources.InteractionStateDialing;
                        break;

                    case InteractionState.Conferenced:
                        result = Resources.InteractionConferenced;
                        break;

                    case InteractionState.Consulting:
                        result = Resources.InteractionConsulting;
                        break;

                    default:
                        break;
                    }
                }
                else if (state == InteractionState.Ringing)
                {
                    var interaction = value[1] as IInteraction;
                    if (interaction != null)
                    {
                        MediaType curType = CISpecification.cIInfoType(interaction);
                        Logger.Logger.Log.Debug("InteractionStateToStringConverter: cIState: " + curType + "Interaction.State: " + interaction.State);

                        switch (interaction.State)
                        {
                        case InteractionState.Ringing:
                            if (curType == MediaType.Chat)
                            {
                                result = Resources.InteractionStateChat;
                            }
                            else if (curType == MediaType.Incident)
                            {
                                result = Resources.InteractionStateIncident;
                            }
                            else
                            {
                                result = Resources.InteractionStateRinging;
                            }
                            //result = Resources.InteractionStateRinging;
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        Logger.Logger.Log.Debug("InteractionStateToStringConverter: Interaction was null.");
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var       interaction = value as IInteraction;
            MediaType curType     = CISpecification.cIInfoType(interaction);

            Logger.Logger.Log.Debug("MediaTypeToStringConverter: cIState: " + curType);
            string result = Resources.MediaTypeUnknown;

            if (interaction != null)
            {
                switch (interaction.Type)
                {
                case MediaType.Voice:
                    if (curType == MediaType.Chat)
                    {
                        result = Resources.MediaTypeChat;
                    }
                    else if (curType == MediaType.Incident)
                    {
                        result = Resources.MediaTypeIncident;
                    }
                    else
                    {
                        result = Resources.MediaTypeVoice;
                    }
                    //result = Resources.MediaTypeVoice;
                    break;

                case MediaType.Email:
                    result = Resources.MediaTypeEmail;
                    break;

                case MediaType.Fax:
                    break;

                case MediaType.Chat:
                    result = Resources.MediaTypeChat;
                    break;

                case MediaType.Web:
                    result = Resources.MediaTypeWeb;
                    break;

                case MediaType.Social:
                    break;

                case MediaType.Sms:
                    break;

                case MediaType.Generic:
                    break;

                default:
                    break;
                }
            }
            else
            {
                Logger.Logger.Log.Debug("MediaTypeToStringConverter: Interaction was null. ");
            }

            return(result.ToLower());
        }
Exemplo n.º 4
0
        private void synchronizeButtonStates()
        {
            //Regex chatIncidentRegex = new Regex("^UUI[1-2]", RegexOptions.IgnoreCase);

            MediaType currentInteractionType = MediaType.Voice;

            if (CurrentInteraction != null)
            {
                currentInteractionType = CISpecification.cIInfoType(CurrentInteraction);
            }
            else
            {
                Logger.Logger.Log.Debug("CurrentInteraction is null.");
            }

            Logger.Logger.Log.Debug("CurrectInteraction MediaType: " + currentInteractionType.ToString());

            synchronizeAndInvoke(o =>
            {
                if (CurrentInteraction == null || CurrentInteraction.State == InteractionState.Disconnected)
                {
                    EnabledButtons = (int)MediaBarButtons.None;
                }
                else
                {
                    //switch (CurrentInteraction.Type)
                    switch (currentInteractionType)
                    {
                    case MediaType.Voice:
                        if (((ICall)CurrentInteraction).State == InteractionState.Ringing)
                        {
                            EnabledButtons = (int)MediaBarButtons.AnswerHangup;
                        }
                        else if (((ICall)CurrentInteraction).State == InteractionState.Held)
                        {
                            if (CurrentInteraction.CanCompleteTransfer == true)
                            {
                                //if(intera
                                EnabledButtons = (int)MediaBarButtons.ConsultConferenced;
                            }
                            else
                            {
                                EnabledButtons = (int)MediaBarButtons.HoldRetrieve;
                            }
                        }
                        //else if(((ICall)CurrentInteraction).State == InteractionState.Chat){
                        //    EnabledButtons = (int)MediaBarButtons.Chat;
                        //}
                        //else if (((ICall)CurrentInteraction).State == InteractionState.Incident) {
                        //    EnabledButtons = (int)MediaBarButtons.Incident;
                        //}
                        else if (((ICall)CurrentInteraction).State == InteractionState.RingingOut)
                        {
                            EnabledButtons = (int)MediaBarButtons.AnswerHangup;
                        }
                        else
                        if (CurrentInteraction.CanCompleteTransfer)
                        {
                            EnabledButtons = (int)MediaBarButtons.ConsultConferenced;
                        }
                        //else if (CurrentInteraction.ConferencedCall)
                        //{
                        //    EnabledButtons = (int)MediaBarButtons.ConferencedCall;
                        //}
                        else
                        {
                            EnabledButtons = (int)MediaBarButtons.Voice;
                        }
                        break;

                    case MediaType.Chat:
                        Logger.Logger.Log.Debug("Chat Interaction.");
                        if (((ICall)CurrentInteraction).State == InteractionState.Ringing)
                        {
                            EnabledButtons = (int)MediaBarButtons.AnswerHangup;
                        }
                        else
                        {
                            EnabledButtons = (int)MediaBarButtons.None;
                        }
                        break;

                    case MediaType.Incident:
                        Logger.Logger.Log.Debug("Incident Interaction.");
                        if (((ICall)CurrentInteraction).State == InteractionState.Ringing)
                        {
                            EnabledButtons = (int)MediaBarButtons.AnswerHangup;
                        }
                        else
                        {
                            EnabledButtons = (int)MediaBarButtons.None;
                        }
                        break;
                    }
                    ResetDropLastParty();
                }
            });
        }