public override string ToString() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(Id)) { query.Add("id", Id); } if (!string.IsNullOrEmpty(Md5)) { query.Add("md5", Md5); } if (Bucket.HasValue) { foreach (var bucket in Bucket.Value.GetBucketDescriptions()) { query.Add("bucket", bucket); } } return query.ToString(); }
public override string ToString() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(Id)) { query.Add("id", Id); } if (!string.IsNullOrEmpty(Md5)) { query.Add("md5", Md5); } if (Bucket.HasValue) { foreach (var bucket in Bucket.Value.GetBucketDescriptions()) { query.Add("bucket", bucket); } } return(query.ToString()); }
/// <summary> /// Shows the popup. /// </summary> /// <param name="viewName">Name of the view.</param> /// <param name="commandName">Name of the command.</param> /// <param name="title">The title.</param> /// <param name="parameters">The parameters.</param> /// <param name="maximize">If set to <c>true</c> [maximize].</param> /// <param name="completedAction">The completed action.</param> /// <param name="isModal">If set to <c>true</c> [is modal].</param> public void ShowPopup( string viewName, string commandName = null, string title = null, KeyValuePair <string, string>[] parameters = null, bool maximize = false, Action completedAction = null, bool isModal = true) { var uriQuery = new UriQuery(); if (commandName != null) { uriQuery.Add("CommandName", commandName); } if (parameters != null) { foreach (var parameter in parameters) { uriQuery.Add(parameter.Key, parameter.Value); } } ShowPopup(viewName, new Uri(viewName + uriQuery, UriKind.Relative), title, completedAction ?? (() => { }), maximize, isModal); }
public override string ToString() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(Name)) { query.Add("name", Name); } if (Bucket.HasValue) { foreach (var bucket in Bucket.Value.GetBucketDescriptions()) { query.Add("bucket", bucket); } } if (Limit.HasValue) { query.Add("limit", Limit.Value.ToString().ToLower()); } return(query.ToString()); }
public void FlattensQueryWithMultipleElements() { var query = new UriQuery(); query.Add("a", "b"); query.Add("b", "c"); Assert.AreEqual("?a=b&b=c", query.ToString()); }
private void ExecuteGoToAlbum(Track track) { UriQuery q = new UriQuery(); q.Add("artistName", track.Artist); q.Add("albumName", track.Album); RegionManager.RequestNavigate(AppRegions.ViewRegion, typeof(AlbumView).FullName + q); }
private void ExecuteSearchForSimilarArtist(SimilarArtistModel artist) { UriQuery q = new UriQuery(); q.Add(SearchBar.IsFromSearchBarParameter, "true"); q.Add(SearchBar.ValueParameter, artist.Name); RegionManager.RequestNavigate(AppRegions.ViewRegion, typeof(MainStationView).FullName + q); }
public override string ToString() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(Text)) { query.Add("text", Text); } if (Bucket.HasValue) { foreach (var bucket in Bucket.Value.GetBucketDescriptions()) { query.Add("bucket", bucket); } } if (Limit.HasValue) { query.Add("limit", Limit.Value); } if (MaxFamiliarity.HasValue) { query.Add("max_familiarity", MaxFamiliarity.Value); } if (MinFamiliarity.HasValue) { query.Add("min_familiarity", MinFamiliarity.Value); } if (MaxHotttnesss.HasValue) { query.Add("max_hotttnesss", MaxHotttnesss.Value); } if (MinHotttnesss.HasValue) { query.Add("min_hotttnesss", MinHotttnesss.Value); } if (Results.HasValue) { query.Add("results", Results.Value); } if (Sort.HasValue) { query.Add("sort", EnumHelpers.GetDescription(Sort.Value)); } return query.ToString(); }
public override void OpenRecord(string recordType, string fieldMatch, string fieldValue, Type maintainViewModelType) { var uriQuery = new UriQuery(); uriQuery.Add(NavigationParameters.RecordType, recordType); uriQuery.Add(NavigationParameters.RecordIdName, fieldMatch); uriQuery.Add(NavigationParameters.RecordId, fieldValue); RequestNavigate(RegionNames.MainTabRegion, maintainViewModelType, uriQuery); }
private void ExecuteBrowseForAlbum(Tuple<string, string> parameter) { if (!string.IsNullOrEmpty(parameter.Item1) && !string.IsNullOrEmpty(parameter.Item2)) { UriQuery query = new UriQuery(); query.Add("artistName", parameter.Item1); query.Add("albumName", parameter.Item2); _regionManager.RequestNavigate(AppRegions.ViewRegion, typeof(AlbumView).FullName + query); } }
private void ExecuteBrowseForAlbum(Tuple <string, string> parameter) { if (!string.IsNullOrEmpty(parameter.Item1) && !string.IsNullOrEmpty(parameter.Item2)) { UriQuery query = new UriQuery(); query.Add("artistName", parameter.Item1); query.Add("albumName", parameter.Item2); _regionManager.RequestNavigate(AppRegions.ViewRegion, typeof(AlbumView).FullName + query); } }
private void ExecuteBrowseForSimilarArtists(string artistName) { if (!string.IsNullOrEmpty(artistName)) { UriQuery query = new UriQuery(); query.Add(SearchBar.IsFromSearchBarParameter, "true"); query.Add(SearchBar.ValueParameter, artistName); _regionManager.RequestNavigate(AppRegions.ViewRegion, typeof(MainStationView).FullName + query); } }
private void ExecuteStartArtistRadio(string artistName) { if (!string.IsNullOrEmpty(artistName)) { UriQuery query = new UriQuery(); query.Add(SearchBar.IsFromSearchBarParameter, "true"); query.Add(SearchBar.ValueParameter, artistName); _regionManager.RequestNavigate(AppRegions.ViewRegion, typeof(LoveHateView).FullName + query); } }
protected UriQuery GetUriQuery() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(SessionId)) { query.Add("session_id", SessionId); } return query; }
private void ExecuteSearch(string phrase) { var searchBar = SearchBarService.Current; if (searchBar != null) { UriQuery query = new UriQuery(searchBar.Parameters.ToString()); query.Add(SearchBar.ValueParameter, phrase); query.Add(SearchBar.IsFromSearchBarParameter, "true"); IRegion viewRegion = RegionManager.Regions[AppRegions.ViewRegion]; IRegionNavigationService navigation = viewRegion.NavigationService; if (navigation.Journal.CurrentEntry != null) { if (navigation.Journal.CurrentEntry.Uri.OriginalString.StartsWith(searchBar.NavigationUri.OriginalString)) { INavigationAware navAware = null; var activeView = viewRegion.ActiveViews.FirstOrDefault(); if (activeView is INavigationAware) { navAware = activeView as INavigationAware; } else { FrameworkElement element = activeView as FrameworkElement; if (element != null && element.DataContext is INavigationAware) { navAware = element.DataContext as INavigationAware; } } if (navAware != null) { navAware.OnNavigatedFrom(new NavigationContext(navigation, navigation.Journal.CurrentEntry.Uri)); navAware.OnNavigatedTo(new NavigationContext(navigation, new Uri( searchBar.NavigationUri.ToString() + query, UriKind.RelativeOrAbsolute))); return; } } } RegionManager.RequestNavigate(AppRegions.ViewRegion, searchBar.NavigationUri.ToString() + query); } }
protected UriQuery GetUriQuery() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(SessionId)) { query.Add("session_id", SessionId); } return(query); }
/// <summary> /// Navigates to active view. /// </summary> /// <param name="regionManager">The region manager.</param> /// <param name="regionName">Name of the region.</param> /// <param name="commandName">Name of the command.</param> /// <param name="parameters">The parameters.</param> public void NavigateToActiveView( IRegionManager regionManager, string regionName, string commandName = null, params KeyValuePair <string, string>[] parameters) { var uriQuery = new UriQuery(); if (commandName != null) { uriQuery.Add("CommandName", commandName); } foreach (var parameter in parameters) { uriQuery.Add(parameter.Key, parameter.Value); } regionManager.NavigateToActiveView(regionName, uriQuery, NavigationCallBack); }
public void FlattensQueryWithSingleElement() { var query = new UriQuery(); query.Add("a", "b"); Assert.AreEqual("?a=b", query.ToString()); }
public void WhenAcceptingConfirmationToNavigateAway_ThenInvokesRequestCallbackWithTrue() { var emailServiceMock = new Mock <IEmailService>(); var viewModel = new ComposeEmailViewModel(emailServiceMock.Object); var uriQuery = new UriQuery(); uriQuery.Add("To", "*****@*****.**"); ((INavigationAware)viewModel).OnNavigatedTo(new NavigationContext(new Mock <IRegionNavigationService>().Object, new Uri("" + uriQuery.ToString(), UriKind.Relative))); InteractionRequestedEventArgs args = null; viewModel.ConfirmExitInteractionRequest.Raised += (s, e) => args = e; bool?callbackResult = null; ((IConfirmNavigationRequest)viewModel).ConfirmNavigationRequest( new NavigationContext(new Mock <IRegionNavigationService>().Object, new Uri("some uri", UriKind.Relative)), b => callbackResult = b); var confirmation = args.Context as Confirmation; confirmation.Confirmed = true; args.Callback(); Assert.IsTrue(callbackResult.Value); }
public static void RunWizardSettingsEntry(XrmPackageSettings packageSettings, VsixApplicationController applicationController, string solutionName) { //ensure the package settings resolves when the app settings dialog runs var resolvePackageSettings = applicationController.ResolveType(typeof(XrmPackageSettings)); if (resolvePackageSettings == null) { applicationController.RegisterInstance(typeof(XrmPackageSettings), new XrmPackageSettings()); } if (solutionName != null && string.IsNullOrWhiteSpace(packageSettings.SolutionObjectPrefix)) { packageSettings.SolutionObjectPrefix = solutionName.Split('.').First(); } var serviceFactory = applicationController.ResolveType <IOrganizationConnectionFactory>(); var recordService = new XrmRecordService(new XrmRecordConfiguration(), serviceFactory, formService: new XrmFormService()); var settingsDialog = new XrmPackageSettingsDialog(new DialogController(applicationController), packageSettings, null, recordService, saveButtonLabel: "Next"); settingsDialog.SaveSettings = false; var uriQuery = new UriQuery(); uriQuery.Add("Modal", true.ToString()); applicationController.NavigateTo(settingsDialog, uriQuery, showCompletionScreen: false, isModal: true); }
private void ExecuteGoToArtist(string artistName) { UriQuery q = new UriQuery(); q.Add("artistName", artistName); RegionManager.RequestNavigate(AppRegions.ViewRegion, typeof(ArtistView).FullName + q); }
public void ExecutePopupCommand() { var uri = new UriQuery(); uri.Add("title", "Popup Window Header"); _interactionService.ShowPopupView(typeof(Popup.View), uri); }
public void WhenRequestedForVetoOnNavigationAfterSubmitting_ThenDoesNotRaiseInteractionRequest() { var emailServiceMock = new Mock <IEmailService>(); var viewModel = new ComposeEmailViewModel(emailServiceMock.Object); var uriQuery = new UriQuery(); uriQuery.Add("To", "*****@*****.**"); ((INavigationAware)viewModel).OnNavigatedTo(new NavigationContext(new Mock <IRegionNavigationService>().Object, new Uri("" + uriQuery.ToString(), UriKind.Relative))); InteractionRequestedEventArgs args = null; viewModel.ConfirmExitInteractionRequest.Raised += (s, e) => args = e; viewModel.SendEmailCommand.Execute(null); bool?callbackResult = null; ((IConfirmNavigationRequest)viewModel).ConfirmNavigationRequest( new NavigationContext(new Mock <IRegionNavigationService>().Object, new Uri("some uri", UriKind.Relative)), b => callbackResult = b); Assert.IsNull(args); Assert.IsTrue(callbackResult.Value); }
private async void LoginCommandExecuteAsync(object obj) { await _authenticationRepository.PostAuthorizationAsync(User); if (_authenticationRepository.Authentic.IsAuthorised) { UriQuery query = new UriQuery(); NavigatePatameters.Save(_authenticationRepository.Authentic.GetHashCode(), _authenticationRepository.Authentic); query.Add("authenticationhash", _authenticationRepository.Authentic.GetHashCode().ToString()); Application.Current.Dispatcher.Invoke(new System.Action(() => { var regionManager = ServiceLocator.Current.GetInstance <IRegionManager>(); regionManager.RequestNavigate("MainRegion", new Uri("ServerView" + query.ToString(), UriKind.Relative), nr => { if (nr.Result.HasValue && nr.Result == false) { var error = nr.Error; } }); })); } else { MessageBox.Show("Unable to authenticate!", "Authorization error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void EscapesQueryElements() { var query = new UriQuery(); query.Add("a?", "b@"); Assert.AreEqual("?a%3F=b%40", query.ToString()); }
/// <summary> /// Executes the navigate back. /// </summary> private void ExecuteNavigateBack() { var q = new UriQuery(); q.Add("TabIndex", "1"); RegionManager.RequestNavigate(RegionNames.MainContent, new Uri(ViewNames.MainDataSetView + q, UriKind.Relative)); }
public Task <BiographyResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("id", id); return(ExecuteAsync <BiographyResponse>(query.ToString())); }
public SongResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("id", id); return(Execute <SongResponse>(query.ToString())); }
public SongResponse Execute(string name, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("name", name); return(Execute <SongResponse>(query.ToString())); }
public BiographyResponse Execute(string name, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("name", name); return(Execute <BiographyResponse>(query.ToString())); }
public Task <VideoResponse> ExecuteAsync(IdSpace id, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("id", id); return(ExecuteAsync <VideoResponse>(query.ToString())); }
public ImageResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("id", id); return(Execute <ImageResponse>(query.ToString())); }
public Task <ImageResponse> ExecuteAsync(string name, int numberOfResults = 10, int start = 0, string license = null) { UriQuery query = GetQuery(numberOfResults, start, license); query.Add("name", name); return(ExecuteAsync <ImageResponse>(query.ToString())); }
public Task <VideoResponse> ExecuteAsync(string name, int numberOfResults = 10, int start = 0) { UriQuery query = GetQuery(numberOfResults, start); query.Add("name", name); return(ExecuteAsync <VideoResponse>(query.ToString())); }
private void SyncView( string id ) { // Navigate to the DetailsView, passing the item ID as a navigation parameter. // Only one DetailView instance is created. This instance is activated and // updated to display the details of the specified item. UriQuery parameters = new UriQuery(); parameters.Add( "ID", id ); _regionManager.RequestNavigate( RegionNames.MainRegion, new Uri( "DetailsView" + parameters.ToString(), UriKind.Relative ), NavigationCompleted ); }
public void NavigateTo(string regionName, string viewExportName, Dictionary<string, string> queryParams) { if (queryParams.Any()) { var query = new UriQuery(); foreach(var param in queryParams) query.Add(param.Key, param.Value); _regionManager.RequestNavigate(regionName, new Uri(viewExportName + query, UriKind.Relative)); } else _regionManager.RequestNavigate(regionName, new Uri(viewExportName, UriKind.Relative)); }
private void NavigateToView( string id ) { // Navigate to the EditView, passing the item ID as a navigation parameter. // A new EditView instance is created for each item. If an EditView instance // for a particular item already exists, it is activated. UriQuery parameters = new UriQuery(); parameters.Add( "ID", id ); _regionManager.RequestNavigate( RegionNames.MainRegion, new Uri( "EditView" + parameters.ToString(), UriKind.Relative ), NavigationCompleted ); }
public void WhenNavigatedToWithAToQueryParameter_ThenInitializesToField() { var emailServiceMock = new Mock<IEmailService>(); var viewModel = new ComposeEmailViewModel(emailServiceMock.Object); var uriQuery = new UriQuery(); uriQuery.Add("To", "*****@*****.**"); ((INavigationAware)viewModel).OnNavigatedTo(new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("" + uriQuery.ToString(), UriKind.Relative))); Assert.AreEqual("*****@*****.**", viewModel.EmailDocument.To); }
public void NavigateToUri(NavigationItem item) { UriQuery query = new UriQuery(); eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Start); Shared.SetReceiptNavigation(item); if (item.ReceiptID > 0) { query.Add("BatchType", item.BatchTypeID.ToString()); query.Add("BatchID", item.ReceiptID.ToString()); regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsSummary" + query.ToString(), UriKind.Relative)); } else { query.Add("BatchMonth", item.ReceiptText); regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsBatchSummary" + query.ToString(), UriKind.Relative)); } eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Stop); }
public override string ToString() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(Id)) { query.Add("id", Id); } if (!string.IsNullOrEmpty(TrackId)) { query.Add("track_id", TrackId); } if (Bucket.HasValue) { foreach (var bucket in Bucket.Value.GetBucketDescriptions()) { query.Add("bucket", bucket); } } if (Limit.HasValue) { query.Add("limit", Limit.Value.ToString().ToLower()); } return query.ToString(); }
public void ChangeView(string regionName, string viewName, params string[] args) { UriQuery query = new UriQuery(); foreach (var item in args) { var splited = item.Split(':'); if (splited.Length > 1) query.Add(splited[0], splited[1]); } regionManager.RequestNavigate(regionName, new Uri(viewName + query.ToString(), System.UriKind.Relative)); }
public static Task<dynamic> ExecuteQuery(dynamic options, UriQuery query) { foreach (string option in options) { if (options[option].HasValue) { if (options[option].Value is IEnumerable<string>) { foreach (var value in ((IEnumerable<string>)options[option].Value)) { query.Add(option, value); } } else { query.Add(option, options[option].ToString()); } } } var client = new HttpClient { Timeout = TimeSpan.FromSeconds(5) }; return client .GetStringAsync(query.ToString()) .ContinueWith(task => { if (task.IsFaulted) { Trace.WriteLine((object)task.Exception); return null; } return JsonConvert.DeserializeObject<dynamic>(task.Result); }); }
public void NavigateTo(string region, string view, IDictionary<string, string> parameters) { IRegionManager regionManger = ServiceLocator.Current.GetInstance<IRegionManager>(); var uriQuery = new UriQuery(); foreach (KeyValuePair<string, string> parameter in parameters) { uriQuery.Add(parameter.Key, parameter.Value); } Uri uri = new Uri(view + uriQuery.ToString(), UriKind.Relative); regionManger.RequestNavigate(region, uri); }
/// <summary> /// Build up a Uri string based on the <see cref="NavigationSettings"/> argument, /// assign it a navigation id and store as a key value pair in the navigation settings list. /// Then navigate to that view using the navigation id. /// </summary> /// <param name="navigationSettings"> /// <see cref="NavigationSettings"/> contains information about the target view /// such as the view type, view title, parameters and navigation history. /// </param> public void NavigateDocumentRegion(NavigationSettings navigationSettings) { if (String.IsNullOrEmpty(navigationSettings.View)) { throw new Exception("Navigation Manager Exception : Target view not specified."); } var query = new UriQuery(); query.Add("Title", navigationSettings.Title ?? navigationSettings.View); query.Add("Navigation", navigationSettings.NavigationHistory ?? String.Empty); string partialUri = navigationSettings.View + query.ToString(); navigationSettings.PartialUri = partialUri; var navigationSettingsClone = (NavigationSettings)navigationSettings.Clone(); string navigationId = String.Empty; lock (lockNavigationList) { var existingNavigationSetting = navigationSettingsList.Values.FirstOrDefault( ns => ns.PartialUri.Equals(partialUri) && (ns.Data == null || ns.Data.Equals(navigationSettings.Data))); if (existingNavigationSetting != null) { navigationId = existingNavigationSetting.NavigationId; } else { navigationId = GetNewNavigationSettingsListKey(); query.Add("NavigationId", navigationId); var viewUri = navigationSettings.View + query.ToString(); navigationSettingsClone.NavigationId = navigationId; navigationSettingsClone.ViewUri = viewUri; navigationSettingsList.Add(navigationId, navigationSettingsClone); } } NavigateDocumentRegion(navigationId); }
private string CreateNavigationPath(string navItemName) { UriQuery query = new UriQuery(); query.Add(Names.NavKey, navItemName); switch (navItemName) { case Names.NavItem1: return typeof(View1).FullName + query; case Names.NavItem2: return typeof(View2).FullName + query; default: return null; } }
public void WhenNavigatedToWithAReplyToQueryParameter_ThenRepliesToTheAppropriateMessage() { var replyToEmail = new EmailDocument { From = "*****@*****.**", To = "", Subject = "", Text = "" }; var emailServiceMock = new Mock<IEmailService>(); emailServiceMock .Setup(svc => svc.GetEmailDocument(replyToEmail.Id)) .Returns(replyToEmail); var viewModel = new ComposeEmailViewModel(emailServiceMock.Object); var uriQuery = new UriQuery(); uriQuery.Add("ReplyTo", replyToEmail.Id.ToString("N")); ((INavigationAware)viewModel).OnNavigatedTo(new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("" + uriQuery.ToString(), UriKind.Relative))); Assert.AreEqual("*****@*****.**", viewModel.EmailDocument.To); }
public static void RequestNavigateWithParameters(this IRegionManager regionManager, string regionName, string source, params object[] parameters) { var query = new UriQuery(); var i = 0; foreach (var parameter in parameters) { query.Add(i.ToString(), Serialize(parameter).CompressString()); i++; } regionManager.RequestNavigate(regionName, new Uri(source + query, UriKind.Relative), result => { }); }
/// <summary> /// Navigates the specified region manager. /// </summary> /// <param name="regionManager">The region manager.</param> /// <param name="regionName">Name of the region.</param> /// <param name="viewName">Name of the view.</param> /// <param name="commandName">Name of the command.</param> /// <param name="parameters">The parameters.</param> public void Navigate( IRegionManager regionManager, string regionName, string viewName, string commandName = null, params KeyValuePair<string, string>[] parameters ) { var uriQuery = new UriQuery (); if ( commandName != null ) { uriQuery.Add ( "CommandName", commandName ); } foreach ( var parameter in parameters.Where ( parameter => parameter.Value != null ) ) { uriQuery.Add ( parameter.Key, parameter.Value ); } var uri = new Uri ( viewName + uriQuery, UriKind.Relative ); regionManager.RequestNavigate ( regionName, uri, NavigationCallBack ); }
private void OpenMeetingEmail(Meeting meeting) { // todo: 12 - Opening an email // // This view initiates navigation using the RegionManager. // The RegionManager will find the region and delegate the // navigation request to the region specified. // // This navigation request also includes additional navigation context, an 'EmailId', to // allow the Email view to orient to the right item. The navigation request and context // is built using a UriQuery that helps build the request. var builder = new StringBuilder(); builder.Append(EmailViewName); var query = new UriQuery(); query.Add(EmailIdName, meeting.EmailId.ToString(GuidNumericFormatSpecifier)); builder.Append(query); this.regionManager.RequestNavigate(RegionNames.MainContentRegion, new Uri(builder.ToString(), UriKind.Relative)); }
public void OnNavigatedFrom(NavigationContext navigationContext) { _eventAggregator.GetEvent<TrackCommandBarEvent>().Unsubscribe(_trackMenuBarToken); _eventAggregator.GetEvent<TracksCommandBarEvent>().Unsubscribe(_tracksMenuBarToken); if (Playlist != null && Tracks != null) { var selectedTrack = (ITrack)Tracks.CurrentItem; if (selectedTrack != null) { UriQuery query = new UriQuery(); query.Add("PlaylistSelectedTrackID", selectedTrack.ID.ToString()); navigationContext.NavigationService.Journal.CurrentEntry.Uri = new Uri(MusicRegionViewNames.PlaylistView + query, UriKind.Relative); } } }
public void Search(string text) { InputFieldText = text; UriQuery query = new UriQuery(); query.Add("Query", text); MusicViewRegion.RequestNavigate(new Uri(MusicRegionViewNames.SearchView + query, UriKind.Relative)); }
private void NavigateToView( String viewName, Object id ) { UriQuery query = new UriQuery(); if (id != null) { query.Add( "ID", ((Guid)id).ToString() ); } Uri navigateTo = new Uri( viewName + query.ToString(), UriKind.Relative ); this.RegionManager.RequestNavigate( RegionNames.AdministrationTabsRegion, navigateTo ); }
private void OpenMeetingEmail(Meeting meeting) { var builder = new StringBuilder(); builder.Append(EmailViewName); var query = new UriQuery(); query.Add(EmailIdName, meeting.EmailId.ToString(GuidNumericFormatSpecifier)); builder.Append(query); this.regionManager.RequestNavigate(RegionNames.MainContentRegion, new Uri(builder.ToString(), UriKind.Relative), nr => { }); }
public void WhenAcceptingConfirmationToNavigateAway_ThenInvokesRequestCallbackWithTrue() { var emailServiceMock = new Mock<IEmailService>(); var viewModel = new ComposeEmailViewModel(emailServiceMock.Object); var uriQuery = new UriQuery(); uriQuery.Add("To", "*****@*****.**"); ((INavigationAware)viewModel).OnNavigatedTo(new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("" + uriQuery.ToString(), UriKind.Relative))); InteractionRequestedEventArgs args = null; viewModel.ConfirmExitInteractionRequest.Raised += (s, e) => args = e; bool? callbackResult = null; ((IConfirmNavigationRequest)viewModel).ConfirmNavigationRequest( new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("some uri", UriKind.Relative)), b => callbackResult = b); var confirmation = args.Context as Confirmation; confirmation.Confirmed = true; args.Callback(); Assert.IsTrue(callbackResult.Value); }
public void WhenRequestedForVetoOnNavigationAfterSubmitting_ThenDoesNotRaiseInteractionRequest() { var emailServiceMock = new Mock<IEmailService>(); var viewModel = new ComposeEmailViewModel(emailServiceMock.Object); var uriQuery = new UriQuery(); uriQuery.Add("To", "*****@*****.**"); ((INavigationAware)viewModel).OnNavigatedTo(new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("" + uriQuery.ToString(), UriKind.Relative))); InteractionRequestedEventArgs args = null; viewModel.ConfirmExitInteractionRequest.Raised += (s, e) => args = e; viewModel.SendEmailCommand.Execute(null); bool? callbackResult = null; ((IConfirmNavigationRequest)viewModel).ConfirmNavigationRequest( new NavigationContext(new Mock<IRegionNavigationService>().Object, new Uri("some uri", UriKind.Relative)), b => callbackResult = b); Assert.IsNull(args); Assert.IsTrue(callbackResult.Value); }
private void OnBack() { ReceiptBatchStatus batchStatus; UriQuery query = new UriQuery(); _EventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Start); batchStatus = ((ReceiptBatchStatus)receiptBatch.BatchStatusID); switch (batchStatus) { case ReceiptBatchStatus.Created: query.Add("Status", ReceiptBatchStatus.Created.ToString()); Shared.SetReceiptNavigation(new NavigationItem { BatchStatus = receiptBatch.BatchStatusID, ReceiptText = batchStatus.ToString() }); regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsBatchSummary" + query.ToString(), UriKind.Relative)); break; case ReceiptBatchStatus.Pending: query.Add("Status", ReceiptBatchStatus.Pending.ToString()); Shared.SetReceiptNavigation(new NavigationItem { BatchStatus = receiptBatch.BatchStatusID, ReceiptText = batchStatus.ToString() }); regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsBatchSummary" + query.ToString(), UriKind.Relative)); break; case ReceiptBatchStatus.Posted: if (string.IsNullOrEmpty(receiptBatch.BatchMonth) == false) { query.Add("BatchMonth", receiptBatch.BatchMonth); Shared.SetReceiptNavigation(new NavigationItem { BatchStatus = receiptBatch.BatchStatusID, ReceiptText = receiptBatch.BatchMonth, BatchMonth = receiptBatch.BatchMonth }); } else { query.Add("Status", ReceiptBatchStatus.Posted.ToString()); Shared.SetReceiptNavigation(new NavigationItem { BatchStatus = receiptBatch.BatchStatusID, ReceiptText = batchStatus.ToString() }); } regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsBatchSummary" + query.ToString(), UriKind.Relative)); break; } _EventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Stop); }
protected virtual UriQuery GetUriQuery() { UriQuery query = new UriQuery(BaseUrl); query.Add("api_key", ApiKey); query.Add("format", "json"); if (!string.IsNullOrEmpty(Type)) { query.Add("type", Type); } if (ArtistID.Count() > 0) { foreach (Term artistId in ArtistID) { query.Add("artist_id", artistId); } } if (Artist.Count() > 0) { foreach (Term artist in Artist) { query.Add("artist", artist); } } if (SongID.Count() > 0) { foreach (Term songId in SongID) { query.Add("song_id", songId); } } if (TrackID.Count() > 0) { foreach (Term trackId in TrackID) { query.Add("track_id", trackId); } } if (Results.HasValue) { query.Add("results", Results.Value); } if (Bucket.HasValue) { foreach (string bucket in Bucket.Value.GetBucketDescriptions()) { query.Add("bucket", bucket); } } if (Limit.HasValue) { query.Add("limit", Limit.Value.ToString().ToLower()); } if (Dmca.HasValue) { query.Add("dmca", Dmca.Value.ToString().ToLower()); } return query; }