public FeatureLayerChangeVersion()
{
InitializeComponent();
featureLayer = (MyMap.Layers["ServiceConnections"] as FeatureLayer);
Geoprocessor gp_ListVersions = new Geoprocessor("http://sampleserver6.arcgisonline.com/arcgis/rest/services/GDBVersions/GPServer/ListVersions");
gp_ListVersions.Failed += (s, a) =>
{
MessageBox.Show("Geoprocessing service failed: " + a.Error);
};
gp_ListVersions.ExecuteCompleted += (c, d) =>
{
VersionsCombo.DataContext = (d.Results.OutParameters[0] as GPRecordSet).FeatureSet;
foreach (Graphic g in (d.Results.OutParameters[0] as GPRecordSet).FeatureSet.Features)
{
if ((g.Attributes["name"] as string) == featureLayer.GdbVersion)
{
VersionsCombo.SelectedValue = g;
break;
}
}
};
List<GPParameter> gpparams = new List<GPParameter>();
gpparams.Add(new GPRecordSet("Versions", new FeatureSet()));
gp_ListVersions.ExecuteAsync(gpparams);
}