Hi Abudwill, thank you a lot for your response.
I have the following code, to print the commands I have available:
for (int i=0;i< commandManager.CommandsByName.Keys.Count;i++)
{
MessageBox.Show(commandManager.CommandsByName.Keys.ToArray()[i], "Custom Extension", MessageBoxButton.OK);
}
Here I printed all the command chains available, and I donīt have anything related to Outbound. I tried the code you wrote:
commandManager.InsertCommandToChainOfCommandBefore("CampaignGetPreviewRecord ", "GetOutboundPreviewRecord ",
new List<CommandActivator>() { new CommandActivator() {
CommandType = typeof(AfterGetRecordCommand), Name = "AfterGetRecordCommand"
}});
But no effect, I attach my custom commando for you to see it:
class AfterGetRecordCommand : IElementOfCommand
{
public bool Execute(IDictionary<string, object> parameters, IProgressUpdater progressUpdater)
{
if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess())
{
MessageBox.Show("You got a record!", "Custom Command", MessageBoxButton.OK);
object result = Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, new ExecuteDelegate(Execute), parameters, progressUpdater);
return (bool)result;
}
else
{
MessageBox.Show("You got a record!", "Custom Command", MessageBoxButton.OK);
return true;
}
}
public string Name
{
get;
set;
}
/// <summary>
/// This delegate allows to go to the main thread.
/// </summary>
delegate bool ExecuteDelegate(IDictionary<string, object> parameters, IProgressUpdater progressUpdater);