Author Topic: WDE Customization | Activate Mark Done Button Programmatically  (Read 4920 times)

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
I need to activate the Mark Done Button in the ToolbarInteractionBarRegion after a given time. For example, if the agent doesn't click on it in 20 seconds, it must "click itself".

I already know how to handle the timer elapsed event but I can't find any solutions for the button activation.

Anyone have any ideas?

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 541
  • Karma: 30
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #1 on: August 22, 2019, 03:54:13 PM »
Try this (assuming you passed ICommandManager as argument, and assigned to commandManager):
[code]
commandManager.GetChainOfCommandByName("InteractionVoiceIfPossibleCloseInteraction").Execute();
[/code]

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #2 on: August 22, 2019, 07:34:04 PM »
[quote author=hsujdik link=topic=11418.msg52038#msg52038 date=1566489253]
Try this (assuming you passed ICommandManager as argument, and assigned to commandManager):
[code]
commandManager.GetChainOfCommandByName("InteractionVoiceIfPossibleCloseInteraction").Execute();
[/code]
[/quote]

Thank you, @hsujdik. It quite seems what I needed but it didn't really do the trick. When I run the command the interaction related views don't close the same way as when I push the MarkDone button manually.

I also tried :
[code]
commandManager.GetChainOfCommandByName("BundleClose").Execute();
[/code]
But it didn't work as well.

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #3 on: August 23, 2019, 02:04:05 PM »
So, in case someone is wondering, I was able to come up with a solution for the "click itself" thing. There is a keyboard shortcut for pressing the MarkDone button, it's CTRL + E.

I found this NuGet package called InputSimulator v1.0.4 by Michael Noonan ([url=https://archive.codeplex.com/?p=inputsimulator]https://archive.codeplex.com/?p=inputsimulator[/url]). Using it I managed to simulate this shortcut programmatically.

After installing the package, first you need to add these namespaces:
[code]
using WindowsInput.Native;
using WindowsInput;
[/code]

Then, where or when you want to activate the keyboard shortcut you must insert this:
[code]
InputSimulator inputSimulator = new InputSimulator();
inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_E);
[/code]

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #4 on: August 23, 2019, 04:08:13 PM »
Nice. Thanks for sharing. As long as it works is good. Just be care to keep that mapping at WDE options


Enviado de meu SM-G9650 usando o Tapatalk


Marked as best answer by vinicius.gaspar on October 23, 2019, 10:30:11 AM

Offline RobertH

  • Jr. Member
  • **
  • Posts: 69
  • Karma: 1
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #5 on: September 27, 2019, 07:55:13 AM »
Command chain must be working. you don't need to use workarounds and simulate click :-)

I did it like that:
private IInteractionManager ixnManager;

ixnManager = _container.Resolve<IInteractionManager>();

//if you are in interaction view just take current interaction from case
IInteraction ixn = ixnManager.GetInteractionByEntrepriseId(interactionId);

IDictionary<string, object> parameters = new Dictionary<string, object>();
//maybe bundle will be part of case depending from which view are you using
parameters.Add("CommandParameter", ixnManager.GetBundleById(ixn.BundleId));

//execute command chain with correct parameters and it will work
container.Resolve<ICommandManager>().GetChainOfCommandByName("BundleClose").Execute(parameters);

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #6 on: October 22, 2019, 09:32:00 PM »
[quote author=RobertH link=topic=11418.msg52157#msg52157 date=1569570913]
Command chain must be working. you don't need to use workarounds and simulate click :-)

I did it like that:
private IInteractionManager ixnManager;

ixnManager = _container.Resolve<IInteractionManager>();

//if you are in interaction view just take current interaction from case
IInteraction ixn = ixnManager.GetInteractionByEntrepriseId(interactionId);

IDictionary<string, object> parameters = new Dictionary<string, object>();
//maybe bundle will be part of case depending from which view are you using
parameters.Add("CommandParameter", ixnManager.GetBundleById(ixn.BundleId));

//execute command chain with correct parameters and it will work
container.Resolve<ICommandManager>().GetChainOfCommandByName("BundleClose").Execute(parameters);
[/quote]

Thanks for sharing! This method worked way better.  :)