Map Reference within custom Activity
I'm creating a custom activity in Visual Studio.
I would like to know how to reference the Site object within my activity?
I was able to build a "Hello World" Activity with InArgument and OutArgument and it works fine withing workflow and my site. I want to get a reference to the Site object so that I can drill down into layers and get a list of the graphic layers that have been uploaded by the user.
-
This code make a list off visible layers in the current viewer
<--
[Import]
public ViewerWorkflowActivityDispatcher Dispatcher { get; set; }
[Import]
public Site Site { get; set; }
protected override void Initialize(ModuleConfiguration moduleConfiguration)
{
base.Initialize(moduleConfiguration);Dispatcher.RegisterExternalIdHandler("ListVisibleLayers", new Action<ActivityContext>(HandleListVisibleLayers));
}
public void HandleListVisibleLayers(ActivityContext activityContext)
{
if (activityContext == null)
{
throw new ArgumentNullException("context");
}
string displayname = "empty";
var visibleLayers = new Dictionary<string, string>();
displayname = Site.EssentialsMap.LayerThemesInfo.ActiveThemeDisplayName;
foreach (MapService mapservice in Site.EssentialsMap.MapServicesFilteredView)
{
if (mapservice.IsVisible)
{
foreach (Geocortex.Essentials.Client.Layer layer in mapservice.LayersFilteredView)
{
Boolean ParentVisible = false;
if (string.IsNullOrEmpty(layer.ParentLayerId))
{
ParentVisible = true;
}
else
{
if (layer.ParentLayer.IsVisible)
{
ParentVisible = true;
}
}
if (layer.IsVisible & ParentVisible & layer.SubLayerIds.Length == 0)
{
visibleLayers.Add(layer.DisplayName,layer.FullyQualifiedName);
}
}
}}
activityContext.SetValue("LayerTheme", displayname);
activityContext.SetValue("VisibleLayers", visibleLayers);
activityContext.CompleteActivity();
}-->
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar