|
Hi
For what I see in your code snippets, there is no problem in the way that you are using the Event Broker.
This kind of exception is usually thrown when the event handler throws an exception. You should check if the
ChangeTreeValue method is throwing an exception. You can do this by wrapping the contents of the method in a
try/catch statement like the following:
[EventSubscription(EventTopicNames.ChangeTreeValue, Thread =
ThreadOption.UserInterface)]
public
void ChangeTreeValue(object sender,
EventArgs e)
{
try
{
NavigationView vw = new
NavigationView();
vw.ChangeTreeValue();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
Or you can review the content of the
EventTopicException exception by clicking in the View Detail… button of the exception dialog, and check the content of the
Exceptions property. There you will find the root exception that causes the problem.
You are creating a new
NavigationView view every time you raise the ChangeTreeValue event and you are not using the
WorkItem to create it. Try to replace this line:
NavigationView vw =
new NavigationView();
With the following one:
NavigationView vw = ShowViewInWorkspace<NavigationView>(WorkspaceNames.LeftWorkspace);
Note: Perhaps a better approach could be putting the event handler of the
ChangeTreeValue event in the presenter of the NavigationView view to update its content instead of creating a new one every time.
Please, let me know if it helps.
Mariano Converti
http://blogs.southworks.net/mconverti
|