nikhilk / scriptsharp

Script# Project - a C# to JavaScript compiler, to power your HTML5 and Node.js web development.
http://scriptsharp.com
Other
658 stars 182 forks source link

MapEvents.AddHandler MapEventArg vs MapMouseEventArgs #445

Open larrywelch opened 7 years ago

larrywelch commented 7 years ago

I'm implementing a control that will display pushpins on a bing map. When the user hovers or clicks on the pushpin I'd like to display an info box. I've been able to successfully register for and handle the event. However, the MapEventArg object doesn't contain enough data. Using the debugger I discovered that the object passed to the event handler was actually a MapMouseEventArg. Simple solution then, just cast the object to a MapMouseEventArg and finish up my code. Unfortunately that didn't work. Following is the js code that was produced: IGT.AG.ClientUI.View.ContractsWithinRadiusView.mapPinClickEventHandler = function IGT_AG_ClientUI_View_ContractsWithinRadiusView$mapPinClickEventHandler(args) { var m = Type.safeCast(args, MapEventArgs); var mArgs = Type.safeCast(args, MapMouseEventArgs); if (mArgs != null) { if (mArgs.targetType === 'pushpin') { ...

The debugger reports that MapEventArgs is undefined. I can manually alter the resulting code to get it to work but I'd rather understand what I'm doing wrong, or fix something if it's broken.

Any help will be greatly appreciated!