/// <summary> /// Configure the online item result /// </summary> /// <param name="portal"></param> /// <param name="id"></param> /// <param name="thumbnail"></param> /// <param name="snippet"></param> /// <param name="portalItemType"></param> /// <param name="access"></param> public void Configure(string portal, string id, string thumbnail, string snippet, PortalItemType portalItemType, string access) { //Note: private item thumbnails cannot be retrieved via URL reference if (string.IsNullOrEmpty(ThumbnailUrl)) { ThumbnailUrl = @"http://static.arcgis.com/images/desktopapp.png"; } if (portalItemType == PortalItemType.ProjectPackage) { _snippet = snippet + "\r\nArcGIS Pro Project Package"; _linkText = $"Open {portalItemType}"; } else if (portalItemType == PortalItemType.ProjectTemplate) { _snippet = snippet ?? "Project Template"; _linkText = $"Create Project"; } else if (portalItemType == PortalItemType.WebMap || portalItemType == PortalItemType.WebScene) { _snippet = snippet ?? this.Name; _linkText = $"Open {portalItemType}"; } else if (portalItemType == PortalItemType.MapPackage) { _snippet = snippet ?? this.Name; _linkText = $"Open Map Package"; } else if (portalItemType == PortalItemType.FeatureService || portalItemType == PortalItemType.MapService || portalItemType == PortalItemType.LayerPackage) { _snippet = snippet ?? this.Name; _linkText = $"Open {portalItemType}"; } else if (portalItemType == PortalItemType.RulePackage) { _snippet = snippet ?? this.Name; _linkText = $"Open {portalItemType}"; } }
private void Initialize() { if (_isInitialized) { return; } _isInitialized = true; _selResultOption = _resultOptions[0]; OnlineUriFactory.CreateOnlineUris(); foreach (var uri in OnlineUriFactory.OnlineUris) { //create a query OnlineQuery query = new OnlineQuery() { OnlineUri = uri }; _browseQueries.Add(query); } //init timer _timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(25d), IsEnabled = false }; _timer.Tick += (o, e) => { //update the progress bar _progressValue += 1.0; if (_progressValue > _maxProgressValue) { _progressValue = 1.0; } FrameworkApplication.Current.Dispatcher.Invoke(() => OnPropertyChanged("ProgressValue")); }; }
/// <summary> /// Gets the PortalItemType of an Item object that has been uploaded /// </summary> /// <param name="item"></param> /// <returns></returns> private PortalItemType GetProtalItemTypeFromItem(Item item) { PortalItemType portalItemType = PortalItemType.WebMap; //default var itemExtension = System.IO.Path.GetExtension(item.Name); //Get the PortalItemType based on the file extension switch (itemExtension) { case ".lyr": portalItemType = PortalItemType.Layer; break; case ".xlsx": portalItemType = PortalItemType.MicrosoftExcel; break; case ".kml": portalItemType = PortalItemType.KML; break; case ".lpk": portalItemType = PortalItemType.LayerPackage; break; case ".mxd": portalItemType = PortalItemType.MapDocument; break; case ".mpk": portalItemType = PortalItemType.MapPackage; break; case ".tpk": portalItemType = PortalItemType.TilePackage; break; case ".gpk": portalItemType = PortalItemType.GeoprocessingPackage; break; case ".gcpk": portalItemType = PortalItemType.LocatorPackage; break; case ".bpk": portalItemType = PortalItemType.BasemapPackage; break; case ".mmpk": portalItemType = PortalItemType.MobileMapPackage; break; case ".vtpk": portalItemType = PortalItemType.VectorTilePackage; break; case ".rpk": portalItemType = PortalItemType.RulePackage; break; } return(portalItemType); }