/// <summary> /// Handler for multi smart-links, should activate the possibility to choose one of the links from within a UI /// </summary> private void HandleMultiSmartLinkActivation(object sender, Feature feature, FeatureFieldDescriptor field, MultiSmartLink smartLink) { _smartLinksSender = sender; _smartLinksFeature = feature; _smartLinksField = field; // And set the smart links SmartLinks = smartLink.SmartLinks(); }
/// <summary> /// A feature value has been activated (ie, a hyperlinked value has been pressed). /// This information is sent on the messenger, to be dealt with by a FeatureValueActivation ViewModel /// that has been set up specifically for that purpose. /// </summary> protected override void OnFeatureValueActivated(Feature feature, FeatureFieldDescriptor field, object value) { // The base will raise the property changed notification base.OnFeatureValueActivated(feature, field, value); // Create a value activation request var request = new LiteActivateFeatureValueRequestMessage(this, feature, field, value); // Send the request on the messenger Messenger.Send(request); }
/// <summary> /// Activation of a Join - which is transformed into a new request for displaying the result feature/featureCollection /// </summary> private void HandleJoinActivation(object sender, Feature feature, FeatureFieldDescriptor featureFieldDescriptor, IJoinElement element) { if (element.ResultCardinality.IsMultiple) { // Multiple result, which is sent as a display featureCollection request Messenger.Send(new LiteDisplayFeatureCollectionRequestMessage(sender, element as IJoinToFeatureCollection)); } else { // Single result, which is sent as a display feature details request Messenger.Send(new LiteDisplayFeatureDetailsRequestMessage(sender, element as IJoinToFeature)); } }
/// <summary> /// Handle an activation request for geometry; actually transforming this into a new Go-To request on the databus /// </summary> private void HandleGeometryActivation(object sender, Feature feature, FeatureFieldDescriptor featureFieldDescriptor, IFeatureGeometry geometry) { if (geometry != null) { var geometryField = featureFieldDescriptor as FeatureGeometryFieldDescriptor; var envelope = geometry.Envelope; if (envelope != null && feature != null) { var request = new LiteGoToGeometryRequestMessage(sender, new FeatureTargetGeometry(feature, geometryField, geometry)) { DoHighlight = true, StoreInHistory = true }; Messenger.Send(request); } } }
/// <summary> /// Single smart-link activation, actually activating some bits dependent on the type of Smart Link /// </summary> private async void HandleSingleSmartLinkActivation(object sender, Feature feature, FeatureFieldDescriptor field, SingleSmartLink smartLink) { if (smartLink != null) { switch (smartLink.SmartLinkType.PhysicalType) { case FeaturePhysicalFieldType.SmartLinkToWebPage: if (smartLink.Url != null) { try { var location = smartLink.Url; if (!location.StartsWith("http")) { location = string.Concat("http://", location); } var uri = new Uri(location); string str = Guid.NewGuid().ToString("N"); //string features = "directories=no,location=no,menubar=no,status=no,toolbar=no"; HtmlPage.Window.Navigate(uri, str); } catch (InvalidOperationException) { } catch (UriFormatException) { } } break; case FeaturePhysicalFieldType.SmartLinkToMailAddress: if (smartLink.Url != null) { var location = new Uri(string.Format("mailto:{0}", smartLink.Url)); string str = Guid.NewGuid().ToString("N"); //string features = "directories=no,location=no,menubar=no,status=no,toolbar=no"; try { HtmlPage.Window.Navigate(location, str); } catch (InvalidOperationException) { //var uriActivator = new InternalHyperlinkButton(location); //uriActivator.Activate(); } } break; case FeaturePhysicalFieldType.SmartLinkToDocument: if (smartLink.Url != null && smartLink.ServiceProvider != null) { var serviceProvider = smartLink.ServiceProvider; var service = serviceProvider.GetService <IServerDocumentService>(); var document = await service.GetServerDocumentAsync(smartLink.Url); if (document != null) { var viewModel = new DocumentViewModel(document); // Open the document viewModel.View(); } } break; case FeaturePhysicalFieldType.SmartLinkToWorld: var smartLinkToWorld = smartLink as SmartLinkToWorld; var world = smartLinkToWorld.World; if (world != null) { Messenger.Send(new LiteGoToWorldRequestMessage(sender, world, feature)); } break; } } }
/// <summary> /// Constructor for the activate value request /// </summary> /// <param name="sender">The originator of the activation</param> /// <param name="feature">The feature the value belongs to</param> /// <param name="fieldDescriptor">The fielddescriptor corresponding with the value</param> /// <param name="value">The actual value being activate</param> public LiteActivateFeatureValueRequestMessage(Object sender, Feature feature, FeatureFieldDescriptor fieldDescriptor, object value) : base(sender) { this.Feature = feature; this.FieldDescriptor = fieldDescriptor; this.Value = value; }
/// <summary> /// Constructor for the activate value request /// </summary> /// <param name="sender">The originator of the activation</param> /// <param name="feature">The feature the value belongs to</param> /// <param name="fieldDescriptor">The fielddescriptor corresponding with the value</param> public LiteActivateFeatureValueRequestMessage(Object sender, Feature feature, FeatureFieldDescriptor fieldDescriptor) : this(sender, feature, fieldDescriptor, feature[fieldDescriptor.Name]) { }