Author Topic: WDE Customization with .NET for retrieve chat channel  (Read 3670 times)

Offline Daere

  • Newbie
  • *
  • Posts: 17
  • Karma: 0
WDE Customization with .NET for retrieve chat channel
« on: October 24, 2015, 08:37:41 AM »
Hello!

I have a little problem, I try to get the ChatChannel to be used to send a message from the agent to the customer with BasicChatProtocol, within the WDE, with this code:

[code]using Genesyslab.Desktop.Infrastructure.Commands;
using Genesyslab.Desktop.Infrastructure.DependencyInjection;
using Genesyslab.Desktop.Infrastructure.ViewManager;
using Genesyslab.Desktop.Infrastructure;
using Genesyslab.Desktop.Modules.Windows.Event;
using System.Windows;
using Genesyslab.Desktop.Modules.Core.Model.Interactions;
using System;
using System.Diagnostics;
using System.Net;
using Genesyslab.Desktop.Modules.OpenMedia.Model.Interactions.Chat;
using Genesyslab.Platform.Commons.Logging;
using Genesyslab.Platform.WebMedia.Protocols.BasicChat.Events;
using Genesyslab.Platform.WebMedia.Protocols.BasicChat;
using Genesyslab.Platform.WebMedia.Protocols.BasicChat.Requests;
using Genesyslab.Platform.WebMedia.Protocols;

namespace Genesyslab.Desktop.Modules.Module_Chat
{
    /// <summary>
    /// Questa classe è il modulo per la customizzazione degli eventi chat
    /// </summary>
    public class ModuleChat : IModule
{
  readonly IObjectContainer container;
        readonly ICommandManager commandManager;
  readonly IViewEventManager viewEventManager;
        ILogger log;
        string sessionID = "null";
        string userID = null;
     
        /// <summary>
        /// Inizializza una nuovs istanza di <see cref="Module"/> class.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="commandManager">The command manager.</param>
        public ExtensionModuleChat(IObjectContainer container, IViewManager viewManager, ICommandManager commandManager, IViewEventManager viewEventManager)
  {
  this.container = container;
            this.commandManager = commandManager;
  this.viewEventManager = viewEventManager;

            // Initialize the trace system
            this.log = container.Resolve<ILogger>();

            // Create a child trace section
            this.log = log.CreateChildLogger("Module ---> constructor");
        }


        /// <summary>
        /// Inizializza il modulo.
        /// </summary>
        public void Initialize()
  {
           
            var interactionManager = container.Resolve<IInteractionManager>();
            if (interactionManager != null)
            { 
                //receive interactione events
                interactionManager.InteractionEvent += new EventHandler<EventArgs<Core.Model.Interactions.IInteraction>>(EventHandler_InteractionEvent);
            }

        }

    }

        private void EventHandler_InteractionEvent(object sender, EventArgs<Core.Model.Interactions.IInteraction> e)
        {
            try
            {
                IInteraction interaction = e.Value;
 
                if (interaction != null)
                {
                    if (interaction is IInteractionChat)
                    {
                       
                        IInteractionChat interactionChat = (IInteractionChat)interaction;

                        Genesyslab.Enterprise.Model.Interaction.IInteraction enterpriseInteraction = interactionChat.EntrepriseInteractionCurrent;

                        Genesyslab.Enterprise.Model.Channel.IClientChannel channel = enterpriseInteraction.ActiveChannel;

      ........
                        // with channel I try to take de protocol for send a message in a chat....
   
                    }

                }
            }
           
            catch (Exception ex)
            {
              .....
            }
        }

    }
}[/code]

When this code goes in execution, the Message Box that I've set for debug not be showed and the flow goes wrong without exception, how if the module is not being loaded.
Can you help me to understand where i was wrong?

Thanks for the advices

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: WDE Customization with .NET for retrieve chat channel
« Reply #1 on: October 26, 2015, 05:44:13 PM »
Hi Daere,

I should start off by saying I am not familiar with chat.

In your message you noted, "When this code goes in execution, the Message Box that I've set for debug not be showed".  In the code sample you provided there was no MessageBox.Show call.

I am not clear if your question at this point is, "my customization does not seem to be executing at all" or are if you are asking for specific help around the chat functionality.  Are you able to clarify?

Additionally, assuming you are running a full version of Visual Studio, considering running in debug mode.  You will be able to insert breakpoints in the code rather than rely on things like message boxes popping up for debugging purposes.

If your customization doesn't seem to be loading/executing at all, my experience has told me to check IWS logs.  Often times there is some sort of load exception that will be written to those logs which may point you in the right direction.

Regards,
Andrew