Closed larrywelch closed 7 years ago
You probably have got a [ScriptName] attribute? Don't put any attributes on the class unless you need to. A common attribute is [PreserveCase] if you don't want method names to be output as camelCase.
Here's what I have for the class definition: namespace Microsoft.Maps {
public sealed class MapOptions {
public bool t;
public bool AllowHidingLabelsOfRoad;
public MapColor BackgroundColor;
public string Credentials;
public bool DisablePanning;
public bool DisableScrollWheelZoom;
public bool DisableStreetside;
public bool DisableStreetsideAutoCoverage;
public bool DisableZooming;
public bool EnableClickableLogo;
public bool EnableInertia;
public bool LiteMode;
public MapLocationRect maxBounds;
public int MaxZoom;
public int MinZoom;
// public NavigationBarMode NavigationBareMode;
// public NavigationBarOrientation NavigationBarOrientation;
public bool ShowBreadcrumb;
public bool ShowDashboard;
public bool ShoLocateMeButton;
public bool ShowMapTypeSelector;
public bool ShowScalebar;
public bool ShowTrafficButton;
public bool ShowTermsLink;
public bool ShowZoomButtons;
// public StreetsideOptions StreetSideOptions;
}
}
Here's the code that uses the class: Element e = Document.CreateElement("myMap"); MapOptions options = new MapOptions(); options.Credentials = ""; Map map = new Map(e, options);
This is what produced in the resulting JS: var e = document.createElement('myMap'); var options = new Microsoft.Maps.MapOptions(); options.credentials = ''; var map = new Microsoft.Maps.Map(e, options);
Any other ideas?
Right - got you! You need to add the following Attributes to the MapOptions Class
[Imported]
[IgnoreNamespace]
[ScriptName("Object")]
public sealed class MapOptions
That got it done! Thanks for the combination 👍
I've implemented the MapOptions class but it generates JS as Microsoft.Maps.MapOptions and it needs to generate var mapOptions = {};
I'm sure there is an attribute (or combination) that I should be using. Can you point me in the correct direction?