Genesys Engage on-premises

 View Only
Discussion Thread View
  • 1.  WDE - Add Button to a Region

    Posted 08-16-2019 11:49
    Hello

    I have trying to add a button into a region of WDE (v85).
    These are the issues I have come across so far:
    • The button I want to add is the 'Instant Call Transfer', but instead the 'Start a Consultation' button is shown.
    • I want to add/insert this button into the consultation window toolbar only.  I have tried a few regions but the only one to generate the button is 'BundleCustomButtonRegion'- and even then it shows under the case window.  To achieve this I tried to use code from a sample which does the same thing (add button into region), and tried to modify so it fits our requirement.

    This is my build so far. 
    I think I the problem is within my xaml or xaml class - or both.

    //VoiceButtonView.xaml
    <Button x:Class="Genesyslab.Desktop.Modules.InteractionExtensionSample.CustomViews.IxnControl.VoiceButtonView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:common="clr-namespace:Genesyslab.Desktop.WPFCommon;assembly=Genesyslab.Desktop.WPFCommon"
                 xmlns:commonControls="clr-namespace:Genesyslab.Desktop.WPFCommon.Controls;assembly=Genesyslab.Desktop.WPFCommon"
                 xmlns:localization="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization">
        <Button.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <common:DesignTimeResourceDictionary Source="/Genesyslab.Desktop.WPFCommon;component/themes/generic.xaml" />
                </ResourceDictionary.MergedDictionaries>
                <common:MultiEqualConverter x:Key="visibilityBooleanORConverter" />
                <common:VisibilityConverter x:Key="visibilityConverter"/>
            </ResourceDictionary>
        </Button.Resources>
        <commonControls:InteractionToolBarButton localization:Translate.Uid="Windows.VoiceView.ButtonSingleStepTransfer" ButtonStyle="{Binding ButtonStyle}"
    Name="buttonSingleStepTransfer"
    Click="SingleStepTransferCommand_Click"
    ToolTip="{Binding Path=ToolTipButtonSingleStepTransfer, ElementName=callView}"
    AutomationProperties.Name="{Binding Path=PropertiesNameButtonSingleStepTransfer, ElementName=callView}">
            <commonControls:InteractionToolBarButton.Visibility>
                <MultiBinding Converter="{StaticResource visibilityBooleanORConverter}" Mode="OneWay" FallbackValue="Collapsed">
                    <Binding Path="Interaction.IsItPossibleToOneStepTransfer" FallbackValue="Visible" Mode="OneWay" Converter="{StaticResource visibilityConverter}"/>
                    <Binding Path="Interaction.IsItPossibleToCompleteTransferActiveConsultation" FallbackValue="Visible" Mode="OneWay"
    Converter="{StaticResource visibilityConverter}" />
                </MultiBinding>
            </commonControls:InteractionToolBarButton.Visibility>
            <StackPanel Orientation="Horizontal">
                <commonControls:MagicImage localization:Translate.Uid="Common.Images.Interaction.Voice.Transfer" Source="{localization:Translate}"
    ResourceKey="{localization:Translate}" Width="24" Height="24" RenderOptions.BitmapScalingMode="NearestNeighbor" />
                <Path VerticalAlignment="Center" Margin="3" Data="M0,0L3,3 6,0z" Width="{Binding Source=8, Converter={StaticResource relativeSizeConverter}}"
    Height="{Binding Source=4, Converter={StaticResource relativeSizeConverter}}"
    Fill="{Binding Foreground, ElementName=buttonSingleStepTransfer}">
                </Path>
            </StackPanel>
        </commonControls:InteractionToolBarButton>
    </Button>

    //VoiceButtonView.xaml.cs
    using Genesyslab.Desktop.Infrastructure.DependencyInjection;
    using Genesyslab.Desktop.Modules.Core.Model.Agents;
    using Genesyslab.Desktop.Modules.Core.Model.Interactions;
    using Genesyslab.Desktop.Modules.Voice.Model.Interactions;
    using Genesyslab.Desktop.Modules.Windows.Views.Interactions.Container;
    using Genesyslab.Platform.Commons.Logging;
    using System;
    using System.Collections.Generic;
    using System.Windows.Controls;
    namespace Genesyslab.Desktop.Modules.InteractionExtensionSample.CustomViews.IxnControl
    {
        /// <summary>
        /// Interaction logic for VoiceButtonView.xaml
        /// </summary>
        public partial class VoiceButtonView : Button, IVoiceButtonView
        {
            private readonly ILogger log;
            private readonly IObjectContainer container;
            private readonly IAgent agent;

            public VoiceButtonView(ILogger log, IObjectContainer container, IAgent agent)
            {
                this.log = log.CreateChildLogger("CustomViews.IxnControl.VoiceButton");
                this.container = container;
                this.agent = agent;
                InitializeComponent();
                Width = Double.NaN;
                Height = Double.NaN;
            }
            #region IView Members
            public object Context { get; set; }
            /// <summary>
            /// Initialize this control
            /// </summary>
            public void Create()
            {
                try
                {
                    log.Info("Create(): START");
                    IDictionary<string, object> context = Context as IDictionary<string, object>;
                    if (context != null)
                    {
                        //ICase @case = context["Case"] as ICase;
                        //if (@case != null && @case.MainInteraction != null)
                        //{
                        //}
                        if (context.ContainsKey("InteractionContainerType"))
                        {
                            InteractionContainerType ict = (InteractionContainerType)context["InteractionContainerType"];
                            buttonSingleStepTransfer.ToolTip = ict == InteractionContainerType.Popup ? "Popup" : "MainToolBar";
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Create(): Exception", ex);
                }
                log.Info("Create(): END");
            }
            /// <summary>
            /// Perform the clean-up on this control
            /// </summary>
            public void Destroy()
            {
                try
                {
                    log.Info("Destroy(): START");
                }
                catch (Exception ex)
                {
                    log.Error("Destroy(): Exception", ex);
                }
                log.Info("Destroy(): END");
            }
            #endregion
            /// <summary>
            /// The click handler for the voice control button
            /// </summary>
            private void SingleStepTransferCommand_Click(object sender, System.Windows.RoutedEventArgs args)
            {
            }
           
            /// <summary>
            /// Determine if the voice control is to be shown
            /// </summary>
            /// <param name="context"></param>
            /// <returns></returns>
            public static bool VoiceButtonCondition(ref object context)
            {
                ILogger myLog = ContainerAccessPoint.Container.Resolve<ILogger>();
                try
                {
                    myLog = myLog.CreateChildLogger("CustomViews.IxnControl.VoiceButtonCondition");
                    myLog.Info("VoiceButtonCondition(): START");
                    IDictionary<string, object> contextObj = context as IDictionary<string, object>;
                    if (contextObj != null)
                    {
                        ICase @case = contextObj["Case"] as ICase;
                        if (@case != null && @case.MainInteraction != null && @case.MainInteraction is IInteractionVoice)
                        {
                            IInteractionVoice interactionVoice = @case.MainInteraction as IInteractionVoice;
                            if (InteractionExtensions.IsConsultCall(interactionVoice.EntrepriseInteractionCurrent))
                            {
                                myLog.Debug("VoiceButtonCondition(): all conditions met, return true");
                                return true;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    myLog.Error("VoiceButtonCondition(): Exception", ex);
                }
                myLog.Debug("VoiceButtonCondition(): Returning false.");
                myLog.Info("VoiceButtonCondition(): END");
                return false;
            }
            }
        }

    //IVoiceButtonView.cs
    using Genesyslab.Desktop.Infrastructure;
    namespace Genesyslab.Desktop.Modules.InteractionExtensionSample.CustomViews.IxnControl
    {
        public interface IVoiceButtonView : IView
        {
            //
        }
    }

    //(module class)
    using Genesyslab.Desktop.Infrastructure.Commands;
    using Genesyslab.Desktop.Infrastructure.DependencyInjection;
    using Genesyslab.Desktop.Infrastructure.ViewManager;
    using Genesyslab.Desktop.Infrastructure;
    using Genesyslab.Desktop.Modules.Core.Model.Interactions;
    using Genesyslab.Platform.Voice.Protocols.TServer.Events;
    using System;
    using Genesyslab.Desktop.Modules.Windows.IWMessageBox;
    using System.Windows.Controls;
    using Genesyslab.Desktop.Modules.InteractionExtensionSample.CustomViews.IxnControl;
    //using Microsoft.Practices.Composite.Modularity;
    namespace Genesyslab.Desktop.Modules.InteractionExtensionSample
    {
     /// <summary>
     /// This class is a sample module which shows several ways of customization
     /// </summary>
     public class InteractionExtensionSampleModule_TransferinConsult : IModule
     {
      readonly IObjectContainer container;
      readonly IViewManager viewManager;
      readonly ICommandManager commandManager;
            readonly IInteractionManager interactionManager;
      /// <summary>
      /// Initializes a new instance of the <see cref="InteractionExtensionSampleModule_TransferinConsult"/> class.
      /// </summary>
      /// <param name="container">The container.</param>
      /// <param name="viewManager">The view manager.</param>
      /// <param name="commandManager">The command manager.</param>
      public InteractionExtensionSampleModule_TransferinConsult(IObjectContainer container, IViewManager viewManager, ICommandManager commandManager,IInteractionManager interactionManager)
      {
       this.container = container;
       this.viewManager = viewManager;
       this.commandManager = commandManager;
                this.interactionManager = interactionManager;
      }

            /// <summary>
            /// Initializes the module.
            /// </summary>
            public void Initialize()
            {
               
                container.RegisterType<IVoiceButtonView, VoiceButtonView>();
                viewManager.ViewsByRegionName["InteractionVoiceCustomButtonRegion"].Add(new ViewActivator()
                {
                    ViewType = typeof(IVoiceButtonView),
                    ViewName = "VoiceButtonView",
                    ActivateView = true,
                    Condition = VoiceButtonView.VoiceButtonCondition
                });

    thanks.

    #Omni-ChannelDesktop/UserInterface

    ------------------------------
    WA
    ------------------------------


  • 2.  RE: WDE - Add Button to a Region

    Posted 08-23-2019 10:14
    Hi!

    I recommend you, only put a button in the BundleCustomButtonRegion. For example, I put an "extra button" for make an Online Survey (in my case, I transfer the call)
    1) make a Button form (model / xml /button code)
    2) in the button onlick, make the transfer, inserting a new chain or by the SDK, making a transfer of the Active VoiceCall
    This look like..
    log.Info("Automatic Transfer-> Try transfer to [" + strSurveyDestinyDN + "]");

    ICommandManager ICM = container.Resolve<ICommandManager>();
    IDictionary<string, object> Params = new Dictionary<string, object>();
    Params.Add("CommandParameter", interactionVoice);

    Params.Add("Destination", strSurveyDestinyDN);
    Params.Add("Location", null);
    Params.Add("UserData", null);
    Params.Add("Reasons", null);
    Params.Add("Extensions", null);
    Params.Add("SingleStepUserData", null);
    ICM.GetChainOfCommandByName("InteractionVoiceSingleStepTransfer").Execute(Params);

    3) register this button in the container. For my proyects, this works including this in the BundleCustomButtonRegion
    This looks like..

    container.RegisterType<ISurveyBTRelView, SurveyBTRelView>();
    viewManager.ViewsByRegionName["BundleCustomButtonRegion"].Add(
    new ViewActivator() { ViewType = typeof(ISurveyBTRelView), ViewName = "SPButtonRelView",
    ActivateView = true
    }
    );

    enjoy!



    ------------------------------
    Rodrigo Hernandez
    ECONTACT SOLUTION CORP.
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources