Thursday, September 26, 2013

Map Collaboration with XSockets and ArcGIS for JavaScript Revisited

Made a blog post approximately two years ago on using XSockets.net and ArcGIS for JavaScript, a lot has happened since my blog post, so I thought it could be interesting to revisit the subject.

Creating a XSockets.net solution is done the same way. What's new is the possibility to create a windows service running the XSockets server using Chocolatey. I will not do this in this post, but I like the idea.

Create New Project. Is done the same way as before:
In VS2012 choose New Project

Create a new ASP.Net MVC 4 Web application
Choose empty web project:
Choose Empty template and Razor view engine


We use Nuget as we did before to import the XSockets.net package:

Install-Package XSockets

Successful installation

The project now have resources added for XSockets.Net


What strikes me is that the need for several projects has disappeared. Everything is neatly in the same project.

For the client side I used the same boilerplate show extent example but with newer ArcGIS for Javascript and XSocket Javascript API to make it easier to follow what changes I needed to do.

Add a new html page in the root of the project:
Add New Item

MapClient.html


Now it's time add the sample code:


Don't forget to set the new page to be the start page of the web application, right click the page in the solution explorer and choose start page.

So with the client side done it's time to setup the server side. Create custom Controller (Controller was called handler before):

We do that by scaffolding a new controller:
Scaffold XSocketController DemoController
 The code that gets created should look like this:
DemoController.cs
Add the following code:

Start the web page by choosing Chrome and start in Visual Studio:

Use the drop down in VS2012 to choose the right browser


This should start the web browser showing a map, start an other chrome instance and copy the adress into that browser. If you did all the steps correct, you will be able to pan the extent in one map and the other browser will follow:
Opened the MapClient.html in two browser windows



Wednesday, September 25, 2013

Visual Studio 2013 Preview - What's new?

A few personal thoughts when testing the Visual Studio 2013 Preview.

The first thing that I noticed was the login. This helps Visual Studio syncing between machines. Is this a good feature?
Well if you are like me having several developer machines at work and home then it might be a good idea. You can change what will be synchronized by changing the settings in Tools | Options.



Second thing is the color schemes, I would argue that is a good feature making it easy to switch between an brighter theme on day time and a darker to use in the evenings. This can also be changed under Tools | Options later on.

The notification in the upper right is good, discrete but let you notice that there are updates to download etc.