I want to create a custom event. What's the best way to do that?
Using the Pro SDK classes (like CompositePresentationEvent) or create a 'regular' .NET event?
If it's the best way to use the Pro SDK classes, could you provide me an example?
Thanks.
Kind regards,
Collin Kleiboer
GisSense BV
I found it (thanks to the IlSpy disassembler!), see files below as an example of an event and eventarg class.
Event-class
public class GetJsonSelectionFinishedEvent : CompositePresentationEvent<GetJsonSelectionFinishedEventArgs>
{
public static SubscriptionToken Subscribe(Action<GetJsonSelectionFinishedEventArgs> action, bool keepSubscriberAlive = false)
{
return FrameworkApplication.EventAggregator.GetEvent<GetJsonSelectionFinishedEvent>().Register(action, keepSubscriberAlive);
}
public static void Unsubscribe(Action<GetJsonSelectionFinishedEventArgs> action)
{
FrameworkApplication.EventAggregator.GetEvent<GetJsonSelectionFinishedEvent>().Unregister(action);
}public static void Unsubscribe(SubscriptionToken token)
{
FrameworkApplication.EventAggregator.GetEvent<GetJsonSelectionFinishedEvent>().Unregister(token);
}internal static void Publish(GetJsonSelectionFinishedEventArgs activeMapViewEventArgs)
{
FrameworkApplication.EventAggregator.GetEvent<GetJsonSelectionFinishedEvent>().Broadcast(activeMapViewEventArgs);
}
}
EventArg-class
public class GetJsonSelectionFinishedEventArgs : System.EventArgs
{
public BasicFeatureLayer BasicFL
{
get;
private set;
}public GetJsonSelectionFinishedEventArgs(BasicFeatureLayer bfl)
{
this.BasicFL = bfl;
}
}
And then you can use it just like the other available events.
Collin.
Nice job Collin.