ComponentOne controls

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

ComponentOne controls

Postby hamej » Mon Apr 11, 2016 7:34 am

I am not quite sure, if use of 3rd party dll's is already implenmented. If so: Have you got an example?

hamej

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: ComponentOne controls

Postby JS-Support @Userware » Mon Apr 11, 2016 8:45 am

Hi,

The new Extensibility features introduced in Beta 7.2 make it possible to add support for 3rd party components.

This is usually achieved by wrapping the JavaScript-based version of those 3rd party controls into a C#/XAML-based class that can be easily consumed in C#/XAML from a CSHTML5 project. Such a wrapper should mimic the WPF or SL version of the components, so that porting WPF or SL applications can become very easy (no code change required).

We are in the process of starting open source projects implementing such wrappers. You can see an example of wrapper around the ArcGIS mapping API at the following URL:
http://forums.cshtml5.com/viewtopic.php?f=7&t=272

You will also find other examples of JS/C# interop in the "Extensions" section of these forums.

Regards,
JS-Support

labbr01
Posts: 6
Joined: Fri Jul 17, 2015 10:20 am

Re: ComponentOne controls ArcGIS API V4.0

Postby labbr01 » Thu Apr 14, 2016 11:54 am

Esri is moving to API 4.0, actually in beta 3.
Esri recommand for new starting project to use immediatly 4.0, because there are a lot of breaking changes from previous version 3.15.

Since cshtml5 is also beta, would like use version 4.0 as soon as possible. I have begin to create a Esri.ArcGIS.Client wrapper around esri class (geometry, point, polygon, ArcGISDynamicMapServiceLayer, Map, SpatialReference, Field, FeatureSet, BufferParameter, Query, Relationship etc, etc).

I have around hundred of classes just to be able support 3 main things:
-add (or remove) layer on an existing map,
-turn on and off layer or label on the layer
-query feature on mouse click and get as result descriptive data of active layer, including related data (esri Relationship class)

Before going too far with 3.13, i want to move to Esri javascript Api 4.0 to avoid having to recode for breaking changes of Esri API.

With a standard html page, i am able to use the esri API 4.0 and view the map.
I have adapt the cshtml5 example (using cshtml5 beta 7.2 and esri 3.13 api) to convert code to the esri 4.0 beta 3. But, i cant't get any map displayed! have a message about «required» undefine, and if i try to run compile code in explorer, the console shows problem about css.

The «ArcGISMapControl» modified method for ArcGIS 4.0 api look like this:
async void ArcGISMapControl_Loaded(object sender, RoutedEventArgs e)
{
// Get a reference to the HTML DOM representation of the control (must be in the Visual Tree):
object div = Interop.GetDiv(this);

// Make sure that the Div has an ID, because the ArcGIS map controls requires an ID:
Interop.ExecuteJavaScript("if (!$0.id) { $0.id = $1 }", div, Guid.NewGuid().ToString());

// Version 4.0 of ArcGIS Javascript API
// Load the ArcGIS libraries and CSS files:
await Interop.LoadJavaScriptFile("https://js.arcgis.com/4.0beta3/esri/css/main.css");
await Interop.LoadCssFile("https://js.arcgis.com/4.0beta3/");

Interop.ExecuteJavaScript(@"
var divId = $0.id;
var methodToRememberJavaScriptMapObject = $1;
var zoom = $2;
require([
""esri/Map"",
""esri/views/MapView"",
""dojo/domReady!""
], function (Map, MapView) {
var map = new Map({
basemap: ""streets""
});
var view = new MapView({
container: divId, //reference to div section
map: map, //reference to the map object created before
zoom: zoom, //sets the zoom level based on level of detail (LOD)
center: [15, 65] //sets the center point of view in lon/lat
});
methodToRememberJavaScriptMapObject(view);
});
", div, (Action<object>)MethodToRememberJavaScriptMapObject, _zoom);
}


But the same map in a plain html page work!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Get started with MapView - Create a 2D map</title>
<style>
html, body {
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.0beta3/esri/css/main.css"></p>
<script src="https://js.arcgis.com/4.0beta3/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function (Map, MapView) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv", //reference to the scene div created in step 5
map: map, //reference to the map object created before the scene
zoom: 4, //sets the zoom level based on level of detail (LOD)
center: [15, 65] //sets the center point of view in lon/lat
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>

I am using VS 2013 and IE 11.0.

Bruno L


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 42 guests

 

 

cron