Hello everyone,
This is my first post. I'm really happy I found this forum. I think I have much to learn from this KB.
I have a question.
Let's say you want to create a new command ..let's call it "AfterMarkDone", and you want to put it here:
[img]http://s4.postimg.org/5ocivhq8t/de_urcat.png[/img]
well, this is the commandManager:
[code]
commandManager.InsertCommandToChainOfCommandBefore("InteractionOpenMediaClose", "Close", new List<CommandActivator>
{
new CommandActivator
{
CommandType = typeof(AfterMarkDone),
Name = "AfterMarkDone"
}
});
[/code]
And this is the Command:
[code]
public class AfterMarkDone : IElementOfCommand
{
private readonly IAgent agent;
private readonly IObjectContainer container;
private readonly ILogger logger;
public AfterMarkDone(IObjectContainer container) {
this.container = container;
this.logger = container.Resolve<ILogger>().CreateChildLogger("AfterMarkDoneCommand");
}
public bool Execute(IDictionary<string, object> parameters, IProgressUpdater progressUpdater) {
if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess()) {
object result = Application.Current.Dispatcher.Invoke(DispatcherPriority.Send,
new ExecuteDelegate(Execute), parameters, progressUpdater);
return (bool) result;
}
else {
logger.Info("Execute");
// Prompt the alert dialog
return MessageBox.Show("Do you really want to release this call?\r\nThe call",
"Release the call?", MessageBoxButton.YesNo) == MessageBoxResult.No;
//////This Location//////
//////This Location//////
//////This Location//////
//////This Location//////
}
}
delegate bool ExecuteDelegate(IDictionary<string, object> parameters, IProgressUpdater progressUpdater);
public string Name { get; set; }
}
[/code]
The problem is that I need to send some information via a REST WS HTTP POST, and that info is in the Case.
It's obvious that I'm on an interaction in that place. How can I get the case and put my hands on the main interaction?
I tried with dependency injection like this:
[code]
IAgent agent = ContainerAccessPoint.Container.Resolve<IAgent>();
ICase ccase = ContainerAccessPoint.Container.Resolve<ICase>();
void DoSomething() {
var x = agent.UserName; //this is great
var y = ccase.MainInteraction; //this is null
}
[/code]
Can you please, give me an idea on how to get the main interaction? It's obvious that I'm on the main interaction on that spot. I thought that I can resolve that with dependency injection. Clearly I was wrong...
Thank you very much,
Alex