/// <summary> /// Sets up the Cancel command /// </summary> private void SetupCommands() { // Use an async lambda to carry out the command this.CancelCommand = new RelayCommand(async() => { // Give some time to the current context; allowing for handling/ending the UI interaction before initiating changes (via DataBinding) // (or more direct: give the UI-thread time to finish the selection in the list before driving the selection itself from here.) await TaskFunctions.Yield(); // Make sure we are removed from display SmartLinks = null; }); }
/// <summary> /// Select an element on the map /// </summary> private async void SelectElement(FeatureTargetGeometry element) { var map = CurrentMap; if (map != null) { // Allow the UI to finish its current action await TaskFunctions.Yield(); // Set the map selection directly (we could have done this via the messenger as well) // An example of a tighter coupling, using the API of the MapViewModel directly map.SelectedFeatureGeometry.Set(element); } }
/// <summary> /// Jump to the smart link /// </summary> /// <param name="value"></param> private async void JumpToSmartLink(SingleSmartLink value) { // Give some time to the current context; allowing for handling/ending the UI interaction before initiating changes (via DataBinding) // (or more direct: give the UI-thread time to finish the selection in the list before driving the selection itself from here.) await TaskFunctions.Yield(); // Make sure we are removed from display SmartLinks = null; if (value != null) { // And put the request on the databus HandleSingleSmartLinkActivation(_smartLinksSender, _smartLinksFeature, _smartLinksField, value); } }