|
POST
|
There are ways to do that but I'm not sure if those are any cleaner solutions. Another solution that you might want to think is to abstract the interaction with a map into MapService class that encapsulates behavior from the map that it is bound. This way you can also quite easily manage the click events from the view models and provide same action executed in several handlers. This is an approach that I have used when I have had to support both mouse and touch actions. Basically the MapService class manages the event handler jungle and makes sure that only one action is enabled at one time when user interacts with a map. This solution also works when you have modular application that doesn't have direct reference to the module where map is run. It also enables you to mock the behavior of the map if you are using automated tests. If you make sure that the reference is not published from the MapService and it is for example inject as a IMapService through Dependency Injection, you can retour your actions without working directly with map. Another way to hook your Map to MapService is to provide binding extension as a attached property. If the description wasn't good enough, I blame the beer.
... View more
09-30-2013
06:49 AM
|
0
|
0
|
991
|
|
POST
|
Interesting, Have you tested that in isolated environment? If yes, any change that you can give a sample of the code? I would love to go that through since I would like to see some socket implementations.
... View more
09-30-2013
02:51 AM
|
0
|
0
|
522
|
|
POST
|
Hi, This is an interesting topic. Lately I haven't bound any commands directly to map. I have created normal event handler to code-behind and then directed map point or other intended parameters for methods that are published from ViewModel. I don't want to have any mouse event args etc in my ViewModels so taking the actual point / points is better solution in this case. When I work with MVVM style, I have an interface that exposes needed methods from the ViewModel and I use that as contract from View. so idea is something like this:
<esri:Map MapGesture="OnGesture" /> <-- your event handler
private void OnGesture(object sender, Map.MapGestureEventArgs e)
{
if (e.Gesture == GestureType.Tap)
{
var vm = DataContext as IMyContractThatIsImplementedInViewModel;
if (vm == null) // Check if current datacontext supports it.
throw new UnsupportedDataContextException();
vm.DoMyViewModelStuff(e.MapPoint); // Call your VM without any external information.
}
}
For me this is ok solution. I know that some of the people wants to leave CodeBehind empty, but I don't think that its needed. To follow the idea of the MVVM, keep logic that is related on the View (ie. mouse events) in the View and implement ViewModel so that you can easily test those without any reference to the View or it's behavior. If you want to bind whole method to ViewModel, then there are ways but I won't go to that now. If you really want to know how to do that, let me know and I will go through couple ways to do it.
... View more
09-30-2013
02:48 AM
|
0
|
0
|
991
|
|
POST
|
There is no out of the box implementation for that kind of behavior. You need to create Graphics dynamically from your data and put those to GraphicsLayers.
... View more
09-27-2013
05:26 AM
|
0
|
0
|
876
|
|
POST
|
Check if this helps : http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Map~SnapToLevels.html
... View more
09-24-2013
01:47 AM
|
0
|
0
|
594
|
|
POST
|
If I understood your case correctly, you need to have another polygon (outside of the state) and color that by using fill symbol. If you have one large polygon that has the outlines of the whole area, you can draw the outlined state on top of that. Hope this helps.
... View more
09-19-2013
11:07 PM
|
0
|
0
|
679
|
|
POST
|
As far as I know, there are no solutions at the moment that would enable Runtime SDK to work directly with SQLite. One thing that might be worth to check is that could you create one mpk with needed Feature Services and then use that as a mediator between the SQLite and Map. You could manage the content of the layers in the map package by hand and then use Runtime SDK to work directly with those local services. Ofc, you need to move changes to the SQLite db from map package too. Let me know if you need help to test the concept. If using Map Package is not an option then I think you need to handle all the querying by yourself using directly SQLite stuff.
... View more
09-16-2013
10:18 PM
|
0
|
0
|
1027
|
|
POST
|
Check this http://www.arcgis.com/home/item.html...1a8bcadaac692a to get started with OAuth logins.
... View more
09-14-2013
03:04 PM
|
0
|
0
|
1402
|
|
POST
|
Hi, I have noticed that it is hard to find references that is build with ArcGIS Runtime for WPF. I would love to hear what you have pulled together and how was it. Ofc, we would like to have references also from sales perspective but also from technological side ie. solutions with ûber offline capabilities or some ninja-integrated software with other products. So if you have any good sites/products/companies that we should look at, please let us know! (ps. Esri folks too!)
... View more
09-11-2013
05:24 AM
|
0
|
2
|
981
|
|
POST
|
Atleast when working with mpk's this is how you can do it: (snipped from old test, not guaranteed 😃
<Window.Resources>
<esri:LocalFeatureService x:Key="FeatureService" Path="Data\\stuff.mpk" MaxRecords="3000" EnableDynamicLayers="True"/>
<esri:SimpleRenderer x:Key="MySimpleRenderer">
<esri:SimpleRenderer.Symbol>
<esri:SimpleFillSymbol BorderBrush="Blue" BorderThickness="4" Fill="Red"/>
</esri:SimpleRenderer.Symbol>
</esri:SimpleRenderer>
</Window.Resources>
<Grid>
<esri:Map x:Name="_map" UseAcceleratedDisplay="True" IsEnabled="false" >
<esri:ArcGISTiledMapServiceLayer ID="World Topo Map"
Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
<esri:ArcGISLocalDynamicMapServiceLayer Service="{StaticResource FeatureService}"/>
</esri:Map>
</Grid>
</Window>
or from code:
private const string PATH = "Data\\stuff.mpk";
private LocalMapService _mapService;
LocalMapService.GetServiceAsync(PATH, localMapService =>
{
_mapService = localMapService;
_map.IsEnabled = true;
});
... View more
09-11-2013
04:27 AM
|
0
|
0
|
485
|
|
POST
|
See following operations: Create service Edit service And capabilities parameters [TABLE="class: table, width: 1255"][TD="colspan: 1"]capabilities[/TD] [TD="colspan: 1"]The capabilities of the service. The domains of these values are specific to each service type. [/TD] [/TABLE]
... View more
09-10-2013
09:02 PM
|
0
|
0
|
739
|
|
POST
|
Hi, You can work with FeatureLayer without map but you need to define mode to Snapshot.
this.targetService = new FeatureLayer{
Url = @"http://services.arcgis.com/4PuGhqdWG1FwH2Yk/ArcGIS/rest/services/DemoCyclingRoutesFinland/FeatureServer/0",
Mode = FeatureLayer.QueryMode.Snapshot
};
... View more
09-10-2013
08:54 PM
|
0
|
0
|
570
|
|
POST
|
Hi, Unfortunately there isn't Task's for doing those in the SDK but you can use ArcGISWebClient, thou it is quite a messy. I think I will write some extension Tasks to upload and download stuff to/from ArcGIS Online, I already working with other REST based Tasks so might to implement this as well. If you want to use ArcGISWebClient here is a demo about it, not a pretty one but seems to work (tested with .mpk / .tpk files) thou there is a small delay when you can see added item in ArcGIS Online:
namespace ArcGISWpfApplication11
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
using System.Windows;
using ESRI.ArcGIS.Client;
using Microsoft.Win32;
public partial class MainWindow
{
private readonly JavaScriptSerializer serializer = new JavaScriptSerializer();
private string AddItemToUrlTemplate = @"http://www.arcgis.com/sharing/rest/content/users/{0}/addItem";
private string AddPartUrlTemplate = @"http://www.arcgis.com/sharing/rest/content/users/{0}/items/{1}/addPart";
private string CommitAddItemUrlTemplate =
@"http://www.arcgis.com/sharing/rest/content/users/{0}/items/{1}/commit";
private string _fileName = string.Empty;
private string _filePath = string.Empty;
private string _itemId = string.Empty;
private Dictionary<string, string> _parameters;
private string _token = "";
private string password = "";
private string userName = "kajanus_dev";
public MainWindow()
{
// License setting and ArcGIS Runtime initialization is done in Application.xaml.cs.
InitializeComponent();
IdentityManager.Current.GenerateCredentialAsync(
"http://www.arcgis.com/sharing/rest/",
userName,
// here should be your username
password,
// here should be your password
(credential, ex) =>
{
if (ex != null)
{
MessageBox.Show(ex.ToString());
return;
}
var dlg = new OpenFileDialog();
//Open the Pop-Up Window to select the file
if (dlg.ShowDialog() == true)
{
try
{
_token = credential.Token;
_filePath = dlg.FileName;
_fileName = dlg.SafeFileName;
_parameters = new Dictionary<string, string>
{
{ "f", "pjson" },
{ "token", _token },
{ "multipart", "true" },
{ "filename", _fileName },
};
var initializationClient = new ArcGISWebClient();
initializationClient.DownloadStringCompleted +=
InitializationClientOnDownloadStringCompleted;
initializationClient.DownloadStringAsync(
new Uri(string.Format(AddItemToUrlTemplate, userName)), _parameters);
}
catch (Exception exception)
{
return;
}
}
});
}
private void InitializationClientOnDownloadStringCompleted(
object sender, ArcGISWebClient.DownloadStringCompletedEventArgs downloadStringCompletedEventArgs)
{
var results =
serializer.DeserializeObject(downloadStringCompletedEventArgs.Result) as IDictionary<string, object>;
if (results.ContainsKey("id"))
{
_itemId = results["id"].ToString();
}
var uploadClient = new ArcGISWebClient();
_parameters = new Dictionary<string, string> { { "f", "json" }, { "token", _token }, { "partNum", "1" } };
//// Upload the content
//// Create url
string addItemPartfullUrl = string.Format(AddPartUrlTemplate, userName, _itemId);
uploadClient.PostMultipartCompleted += UploadClientOnPostMultipartCompleted;
var contentStreams = new List<ArcGISWebClient.StreamContent>
{
new ArcGISWebClient.StreamContent
{
ContentType = "File",
Filename = _fileName,
Name = "file",
Stream = File.OpenRead(_filePath)
}
};
uploadClient.PostMultipartAsync(new Uri(addItemPartfullUrl), _parameters, contentStreams);
}
private void UploadClientOnPostMultipartCompleted(
object sender, ArcGISWebClient.PostMultipartCompletedEventArgs postMultipartCompletedEventArgs)
{
string streamText = new StreamReader(postMultipartCompletedEventArgs.Result).ReadToEnd();
var addItemResult = serializer.DeserializeObject(streamText) as IDictionary<string, object>;
string success = string.Empty;
if (addItemResult.ContainsKey("success"))
{
success = addItemResult["success"].ToString();
}
// Commit
var commitClient = new ArcGISWebClient();
_parameters = new Dictionary<string, string> { { "f", "json" }, { "token", _token }, };
if (success.ToLowerInvariant() == "true")
{
// Create url for commit
string fullCommitUrl = string.Format(CommitAddItemUrlTemplate, userName, _itemId);
commitClient.DownloadStringCompleted += CommitClientOnDownloadStringCompleted;
commitClient.DownloadStringAsync(new Uri(fullCommitUrl), _parameters, ArcGISWebClient.HttpMethods.Post);
}
}
private void CommitClientOnDownloadStringCompleted(
object sender, ArcGISWebClient.DownloadStringCompletedEventArgs downloadStringCompletedEventArgs)
{
MessageBox.Show(downloadStringCompletedEventArgs.Result);
}
}
}
Edit: And please note that this example doesn't take advantage on multipart post capability.
... View more
09-10-2013
04:55 AM
|
0
|
0
|
610
|
|
POST
|
This might to be part of the issue that you get when generating the token. (http://forums.arcgis.com/threads/92072-invalid-token-error-with-ArcGIS-online-secure-services) Token is the same in both endpoints.
... View more
09-06-2013
01:12 AM
|
0
|
0
|
428
|
|
POST
|
Hi, I can get my private services from http://resources.arcgis.com/en/help/rest/apiref/catalog.html Here is my test code:
IdentityManager.Current.GenerateCredentialAsync(
"http://www.arcgis.com/sharing/rest/",
"", // here should be your username
"", // here should be your password
(credential, ex) =>
{
if (ex != null)
{
MessageBox.Show(ex.ToString());
return;
}
var webClient = new ArcGISWebClient();
var parameters = new Dictionary<string, string>
{
{ "f", "json" },
{ "token", credential.Token}
};
webClient.DownloadStringCompleted += (sender, args) =>
{
MessageBox.Show(args.Result.ToString());
};
webClient.DownloadStringAsync(new Uri("http://services.arcgis.com/AddYourIdentity/ArcGIS/rest/services"), parameters);
});
If you share your request and code, I might be track it down.
... View more
09-06-2013
01:08 AM
|
0
|
0
|
1173
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-12-2014 03:52 AM | |
| 1 | 08-27-2015 03:47 AM | |
| 1 | 12-08-2014 09:58 AM | |
| 1 | 05-05-2015 10:19 AM | |
| 1 | 07-30-2015 08:43 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|