/// <summary> /// Handles the Go-To envelope request, actually not doing any Go-To action, but just /// recording this ins our history for resending later upon request. /// </summary> private void HandleGoToEnvelopeRequest(LiteGoToGeometryRequestMessage request, bool force) { if (request.StoreInHistory && request != null && !String.IsNullOrEmpty(request.Description) && request.Envelope != null) { // In case of default behavior (not forcing), remove any previous references to the same description // This is very loose, but the description is all the user sees so there is no way of distinguishing // between two similar descriptions anyway. if (!force) { var description = request.Description; for (int nr = RecentlyVisitedItems.Count - 1; nr >= 0; nr--) { if (String.Compare(description, RecentlyVisitedItems[nr].Description, StringComparison.Ordinal) == 0) { RecentlyVisitedItems.RemoveAt(nr); } } } // Insert the request RecentlyVisitedItems.Insert(0, request); if (RecentlyVisitedItems.Count > MaxRecentlyVisitedItems) { // We have more than the allowed number of elements; get rid of the least // recently visited item RecentlyVisitedItems.RemoveAt(RecentlyVisitedItems.Count - 1); } } // Notify the world that our history has changed RaisePropertyChanged(HasRecentlyVisitedItemsPropertyName); }
/// <summary> /// Sends the GoTo envelope request on the messsenger /// </summary> private async void SendGoToEnvelopeRequest(LiteGoToGeometryRequestMessage request) { RecentlyVisitedItemsIsVisible = false; // Allow the UI some breathing time await TaskEx.Yield(); // Remove the request RecentlyVisitedItems.Remove(request); Messenger.Send(request); }