Exemplo n.º 1
0
 /// <summary>
 /// Navigates to active view.
 /// </summary>
 /// <param name="regionManager">The region manager.</param>
 /// <param name="regionName">Name of the region.</param>
 /// <param name="uriQuery">The URI query.</param>
 /// <param name="navigationCallback">The navigation callback.</param>
 public static void NavigateToActiveView(
     this IRegionManager regionManager, string regionName, UriQuery uriQuery, Action <NavigationResult> navigationCallback = null)
 {
     if (regionManager.Regions.ContainsRegionWithName(regionName) && regionManager.Regions[regionName].ActiveViews.Count() > 0)
     {
         var region = regionManager.Regions[regionName];
         var view   = region.ActiveViews.ElementAt(0) as FrameworkElement;
         var navigationAwareDataContext = view.DataContext as INavigationAware;
         navigationAwareDataContext.OnNavigatedTo(
             new NavigationContext(region.NavigationService, new Uri(uriQuery.ToString(), UriKind.Relative)));
         if (navigationCallback != null)
         {
             navigationCallback(
                 new NavigationResult(new NavigationContext(null, new Uri(uriQuery.ToString(), UriKind.Relative)), true));
         }
     }
     else
     {
         if (navigationCallback != null)
         {
             navigationCallback(
                 new NavigationResult(new NavigationContext(null, new Uri(uriQuery.ToString(), UriKind.Relative)), false));
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Navigates to active view.
 /// </summary>
 /// <param name="regionManager">The region manager.</param>
 /// <param name="regionName">Name of the region.</param>
 /// <param name="uriQuery">The URI query.</param>
 /// <param name="navigationCallback">The navigation callback.</param>
 public static void NavigateToActiveView(
     this IRegionManager regionManager, string regionName, UriQuery uriQuery, Action<NavigationResult> navigationCallback = null )
 {
     if ( regionManager.Regions.ContainsRegionWithName ( regionName ) && regionManager.Regions[regionName].ActiveViews.Count () > 0 )
     {
         var region = regionManager.Regions[regionName];
         var view = region.ActiveViews.ElementAt ( 0 ) as FrameworkElement;
         var navigationAwareDataContext = view.DataContext as INavigationAware;
         navigationAwareDataContext.OnNavigatedTo (
             new NavigationContext ( region.NavigationService, new Uri ( uriQuery.ToString (), UriKind.Relative ) ) );
         if ( navigationCallback != null )
         {
             navigationCallback (
                 new NavigationResult ( new NavigationContext ( null, new Uri ( uriQuery.ToString (), UriKind.Relative ) ), true ) );
         }
     }
     else
     {
         if ( navigationCallback != null )
         {
             navigationCallback (
                 new NavigationResult ( new NavigationContext ( null, new Uri ( uriQuery.ToString (), UriKind.Relative ) ), false ) );
         }
     }
 }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
        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());
        }
Exemplo n.º 6
0
        public void FlattensQueryWithSingleElement()
        {
            var query = new UriQuery();
            query.Add("a", "b");

            Assert.AreEqual("?a=b", query.ToString());
        }
Exemplo n.º 7
0
        public void EscapesQueryElements()
        {
            var query = new UriQuery();
            query.Add("a?", "b@");

            Assert.AreEqual("?a%3F=b%40", query.ToString());
        }
Exemplo n.º 8
0
        public void FlattensQueryWithMultipleElements()
        {
            var query = new UriQuery();
            query.Add("a", "b");
            query.Add("b", "c");

            Assert.AreEqual("?a=b&b=c", query.ToString());
        }
Exemplo n.º 9
0
        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()));
        }
Exemplo n.º 10
0
        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()));
        }
Exemplo n.º 11
0
        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()));
        }
Exemplo n.º 12
0
        public void EscapesQueryElements()
        {
            var query = new UriQuery();

            query.Add("a?", "b@");

            Assert.AreEqual("?a%3F=b%40", query.ToString());
        }
Exemplo n.º 13
0
        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()));
        }
Exemplo n.º 14
0
        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()));
        }
Exemplo n.º 15
0
        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()));
        }
Exemplo n.º 16
0
        public Task <BlogResponse> ExecuteAsync(string name, int numberOfResults = 10, int start = 0, bool highRelevance = false)
        {
            UriQuery query = GetQuery(numberOfResults, start, highRelevance);

            query.Add("name", name);

            return(ExecuteAsync <BlogResponse>(query.ToString()));
        }
Exemplo n.º 17
0
        public BlogResponse Execute(IdSpace id, int numberOfResults = 10, int start = 0, bool highRelevance = false)
        {
            UriQuery query = GetQuery(numberOfResults, start, highRelevance);

            query.Add("id", id);

            return(Execute <BlogResponse>(query.ToString()));
        }
Exemplo n.º 18
0
        public void FlattensQueryWithSingleElement()
        {
            var query = new UriQuery();

            query.Add("a", "b");

            Assert.AreEqual("?a=b", query.ToString());
        }
Exemplo n.º 19
0
        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()));
        }
Exemplo n.º 20
0
        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()));
        }
Exemplo n.º 21
0
        public void FlattensQueryWithMultipleElements()
        {
            var query = new UriQuery();

            query.Add("a", "b");
            query.Add("b", "c");

            Assert.AreEqual("?a=b&b=c", query.ToString());
        }
Exemplo n.º 22
0
        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 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);
        }
Exemplo n.º 24
0
 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 );
 }
Exemplo n.º 25
0
        public Task <ProfileResponse> ExecuteAsync(IEnumerable <IdSpace> trackIds, SongBucket?bucket = null)
        {
            UriQuery query = GetQuery(bucket);

            foreach (var trackId in trackIds)
            {
                query.Add("track_id", trackId);
            }

            return(ExecuteAsync <ProfileResponse>(query.ToString()));
        }
        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);
        }
Exemplo n.º 27
0
        /// <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);
        }
Exemplo n.º 28
0
        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));
        }
Exemplo n.º 29
0
        private void EmailContact(object ignored)
        {
            var uriQuery = new UriQuery();
            var contact  = this.contactsView.CurrentItem as Contact;

            if (contact != null && !string.IsNullOrEmpty(contact.EmailAddress))
            {
                uriQuery.Add(ToQueryItemName, contact.EmailAddress);
            }

            var uri = new Uri(ComposeEmailViewName + uriQuery.ToString(), UriKind.Relative);

            this.regionManager.RequestNavigate(RegionNames.MainContentRegion, uri);
        }
Exemplo n.º 30
0
        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);
        }
Exemplo n.º 31
0
        /// <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); 
        }
Exemplo n.º 32
0
        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);
        }
        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);
        }
Exemplo n.º 34
0
        private void AddJumpTask(Tile tile)
        {
            Application.Current.Dispatcher.BeginInvoke(
                new Action <Tile>(t =>
            {
                UriQuery q = new UriQuery();
                q.Add("ViewId", t.NavigationUri.OriginalString);
                q.Add("RegionId", t.TargetRegionName);

                JumpTask task  = new JumpTask();
                task.Title     = t.Data.Title;
                task.Arguments = q.ToString();

                _jumpList.JumpItems.Add(task);
                _jumpList.Apply();
            }),
                DispatcherPriority.ContextIdle,
                tile);
        }
Exemplo n.º 35
0
        /// <summary>
        /// Opens the dedicated view of the loader
        /// </summary>
        public int OpenLoader(PackageType package, List <string> addresses, int protocol, string id)
        {
            string packageString = string.Empty;
            int    status        = SerializationString.ExportToXMLString <PackageType>(package, out packageString);

            if (status == (int)StatusCodes.OK)
            {
                var uriQuery = new UriQuery();
                uriQuery.Add("id", id);
                uriQuery.Add("protocol", protocol.ToString());
                uriQuery.Add("package", packageString);
                uriQuery.Add("addresses", string.Join(",", addresses.ToArray()));

                var     uri    = new Uri("MSUView" + uriQuery.ToString(), UriKind.Relative);
                IRegion region = _RegionManager.Regions[RegionNames.ContentRegion];
                region.RequestNavigate(uri);
            }
            return(status);
        }
Exemplo n.º 36
0
        public override string ToString()
        {
            UriQuery query = new UriQuery(BaseUrl);

            query.Add("api_key", ApiKey);
            query.Add("format", "json");

            if (Bucket.HasValue)
            {
                foreach (var bucket in Bucket.Value.GetBucketDescriptions())
                {
                    query.Add("bucket", bucket);
                }
            }

            query.Add("start", 0.ToString());
            query.Add("results", 2000.ToString());
            return(query.ToString());
        }
Exemplo n.º 37
0
        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);
                });
        }
Exemplo n.º 38
0
        public void ShowRegistrationView()
        {
            ValidationText = "";
            Parameters.Save(this.GetHashCode(), this);
            UriQuery q = new UriQuery();
            q.Add("hash", this.GetHashCode().ToString());
            RegionManager.Regions["MainRegion"].RequestNavigate(new Uri("RegistrationView" + q.ToString(), UriKind.RelativeOrAbsolute));

        }
Exemplo n.º 39
0
        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 (Styles.Count() > 0)
            {
                foreach (var style in Styles)
                {
                    query.Add("style", style);
                }
            }

            if (Moods.Count() > 0)
            {
                foreach (var mood in Moods)
                {
                    query.Add("mood", mood);
                }
            }

            if (!string.IsNullOrEmpty(ArtistEndYearAfter))
            {
                query.Add("artist_end_year_after", ArtistEndYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearBefore))
            {
                query.Add("artist_end_year_before", ArtistEndYearBefore);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearAfter))
            {
                query.Add("artist_start_year_after", ArtistStartYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearBefore))
            {
                query.Add("artist_start_year_before", ArtistStartYearBefore);
            }

            if (Bucket.HasValue)
            {
                foreach (var bucket in Bucket.Value.GetBucketDescriptions())
                {
                    query.Add("bucket", bucket);
                }
            }

            if (Description.Count() > 0)
            {
                foreach (var description in Description)
                {
                    query.Add("description", description);
                }
            }

            if (FuzzyMatch.HasValue)
            {
                query.Add("fuzzy_match", FuzzyMatch.Value);
            }

            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 (RankType.HasValue)
            {
                query.Add("rank_type", RankType.Value.ToString().ToLower());
            }

            if (Results.HasValue)
            {
                query.Add("results", Results.Value);
            }

            if (Start.HasValue)
            {
                query.Add("start", Start.Value);
            }

            if (Sort.HasValue)
            {
                query.Add("sort", EnumHelpers.GetDescription(Sort.Value));
            }

            return query.ToString();
        }
Exemplo n.º 40
0
        public static void AddLoadedItem(NavigationItem navItem)
        {
            IRegionManager regionManager;
            UriQuery query = new UriQuery();

            if (_ReceiptLoaded.Children == null)
            {
                _ReceiptLoaded.Children = new ObservableCollection<NavigationItem>();
            }

            _ReceiptLoaded.Children.Insert(0, navItem);

            Shared.SetReceiptNavigation(navItem);


            regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
            query.Add("BatchType", navItem.BatchTypeID.ToString());
            query.Add("BatchID", navItem.ReceiptID.ToString());
            regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsSummary" + query.ToString(), UriKind.Relative));
            Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<IEventAggregator>().GetEvent<NavigationChanged>().Publish(Shared.ReceiptNavigation.NavigatingToPath);
        }
Exemplo n.º 41
0
        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 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);
        }
        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);
        }
Exemplo n.º 44
0
        private void OpenReceiptBatchSummary()
        {
            UriQuery query = new UriQuery();

            if (selectedBatchStatus != null)
            {
                eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Start);
                Shared.SetReceiptNavigation(new NavigationItem { BatchStatus = selectedBatchStatus.BatchStatusID, 
                        ReceiptText = selectedBatchStatus.BatchStatus });

                query.Add("Status", selectedBatchStatus.BatchStatus);
                regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsBatchSummary" + query.ToString(), UriKind.Relative));           
                eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Stop);
            }
        }      
        private void NavigateTo()
        {
            UriQuery query = new UriQuery();
            string uri;

            eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Start);            

            if (Shared.ReceiptNavigation.CurrentItem.ReceiptText.ToLower() == "insyston operations launchpad" || (Shared.ReceiptNavigation.CurrentItem.ReceiptText.ToLower() == "receipts" && Shared.ReceiptNavigation.CurrentItem.Image == null))
            {
                eventAggregator.GetEvent<NavigateToLaunchpad>().Publish(true);
                return;
            }

            Shared.SetReceiptNavigation(CurrentItem);

            if (Shared.ReceiptNavigation.CurrentItem.ReceiptText.ToLower() == "receipts")
            {
                regionManager.RequestNavigate(Regions.ContentRegion, "/ReceiptsHome");
            }
            else
            {
                if (Shared.ReceiptNavigation.CurrentItem.ReceiptID > 0)
                {
                    query.Add("BatchType", Shared.ReceiptNavigation.CurrentItem.BatchTypeID.ToString());
                    query.Add("BatchID", Shared.ReceiptNavigation.CurrentItem.ReceiptID.ToString());
                    uri = "/ReceiptsSummary";
                }
                else if (string.IsNullOrEmpty(Shared.ReceiptNavigation.CurrentItem.BatchMonth) == false)
                {
                    query.Add("BatchMonth", Shared.ReceiptNavigation.CurrentItem.BatchMonth);
                    uri = "/ReceiptsBatchSummary";
                }
                else
                {
                    query.Add("Status", Shared.ReceiptNavigation.CurrentItem.BatchStatus.ToString());
                    uri = "/ReceiptsBatchSummary";
                }

                regionManager.RequestNavigate(Regions.ContentRegion, new Uri(uri + query.ToString(), UriKind.Relative));
            }            

            eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Stop);
        }
 void ToSpecifiedView(string viewName)
 {
     UriQuery query = new UriQuery();
     if (viewName == ViewNames.ViewA)
     {
         query.Add("Time", DateTime.Now.ToShortTimeString());
     }
     Uri uri = new Uri(viewName + query.ToString(), UriKind.Relative);
     _regionManager.RequestNavigate(RegionNames.NavDemoShowRegion, uri);
     logger.Log("跳转到视图 [" + viewName + "]", Category.Info, Priority.Low);
     ResetNavigationButtonState();
 }
        public void NavigateToSummary(NavigationItem navItem)
        {
            eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Start);
            
            UriQuery query = new UriQuery();
            
            if(navItem.BatchStatus == 0)
            {
                Dispatcher.CurrentDispatcher.Invoke(new Action(() => { regionManager.RequestNavigate(Regions.ContentRegion, "/ReceiptsHome"); }));
            }
            else
            {
                query.Add("Status", navItem.BatchStatus.ToString());
                Shared.SetReceiptNavigation(navItem); 
                Dispatcher.CurrentDispatcher.Invoke(new Action(() => { regionManager.RequestNavigate(Regions.ContentRegion, new Uri("/ReceiptsBatchSummary" + query.ToString(), UriKind.Relative)); }));                              
            }

            eventAggregator.GetEvent<ProgressChanged>().Publish(ProgressStatus.Stop);         
        }
Exemplo n.º 48
0
        public void IsNavigationTargetTrueWhenIDMatches()
        {
            var loggerMock = new Mock<ILoggerFacade>();
             var regionNavigationServiceMock = new Mock<IRegionNavigationService>();
             var regionManagerMock = new Mock<IRegionManager>();
             var interactionServiceMock = new Mock<IInteractionService>();
             var dataRepositoryMock = new Mock<IDataRepository>();

             dataRepositoryMock
            .Setup( x => x.GetAllMealTypes() )
            .Returns( new ReadOnlyCollection<MealType>( new List<MealType>() ) );
             dataRepositoryMock
            .Setup( x => x.GetAllFoodItems() )
            .Returns( new ReadOnlyCollection<FoodItem>( new List<FoodItem>() ) );

             var meal = new Meal( Guid.NewGuid(), new MealType( Guid.NewGuid(), "Test", "", DateTime.Now, false ), DateTime.Now, "Test", "This is a test meal" );
             dataRepositoryMock.Setup( x => x.GetMeal( meal.ID ) ).Returns( meal );

             var viewModel =
            new MealViewModel( dataRepositoryMock.Object, regionManagerMock.Object, interactionServiceMock.Object, loggerMock.Object );

             var query = new UriQuery();
             query.Add( "ID", meal.ID.ToString() );
             var navigationContext =
            new NavigationContext( regionNavigationServiceMock.Object, new Uri( "MealView" + query.ToString(), UriKind.Relative ) );
             viewModel.OnNavigatedTo( navigationContext );

             Assert.IsTrue( viewModel.IsNavigationTarget( navigationContext ) );
        }
Exemplo n.º 49
0
        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 );
        }
Exemplo n.º 50
0
        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);
        }
        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);
        }
Exemplo n.º 52
0
        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();
        }
Exemplo n.º 53
0
        public new string ToString()
        {
            UriQuery query = GetUriQuery();

            return(query.ToString());
        }
Exemplo n.º 54
0
        private void EmailContact(object ignored)
        {
            var uriQuery = new UriQuery();
            var contact = this.contactsView.CurrentItem as Contact;
            if (contact != null && !string.IsNullOrEmpty(contact.EmailAddress))
            {
                uriQuery.Add(ToQueryItemName, contact.EmailAddress);
            }

            var uri = new Uri(ComposeEmailViewName + uriQuery.ToString(), UriKind.Relative);
            this.regionManager.RequestNavigate(RegionNames.MainContentRegion, uri, nr => { });
        }
Exemplo n.º 55
0
        public void Execute(object parameter)
        {
            GloablePara = null;
            var ctl = ServiceLocator.Current.GetInstance <Control>(this.Uri);

            var regionManager = ServiceLocator.Current.GetInstance <IRegionManager>();
            var container     = ServiceLocator.Current.GetInstance <IUnityContainer>();

            if (!regionManager.Regions.ContainsRegionWithName(this.RegionName))
            {
                MessageBox.Show(string.Format("未找到区域【{0}】!", this.RegionName));
            }
            var    views = regionManager.Regions[this.RegionName].Views;
            object view  = null;

            foreach (var v in views)
            {
                Type t = v.GetType();
                if (t.FullName == this.Uri)
                {
                    view = v;
                    break;
                }
            }

            if (view == null)
            {
                try
                {
                    regionManager.RegisterViewWithRegion(this.RegionName, () => ctl);
                }
                catch (ViewRegistrationException)
                {
                }
            }

            UriQuery query  = new UriQuery();
            var      adress = new Uri(this.Uri, UriKind.RelativeOrAbsolute);

            if (this.Para != null)
            {
                if (!this.IsGloablePara)
                {
                    query.Add("para", InfoExchange.ConvertToJson(this.Para, InfoExchange.SetingsKonwnTypesBinder));
                    adress = new Uri(this.Uri + query.ToString(), UriKind.Relative);
                }
                else
                {
                    GloablePara = Para;
                }
                if (this.IsSetParaDataContext)
                {
                    ctl.DataContext = Para;
                }
            }

            if (!string.IsNullOrEmpty(this.MenuName))
            {
                query.Add("MenuName", InfoExchange.ConvertToJson(this.MenuName, InfoExchange.SetingsKonwnTypesBinder));
            }

            regionManager.RequestNavigate(this.RegionName, new Uri(this.Uri + query.ToString(), UriKind.Relative));
        }
Exemplo n.º 56
0
        public void FlattensEmptyQueryToEmptyString()
        {
            var query = new UriQuery();

            Assert.AreEqual("", query.ToString());
        }
Exemplo n.º 57
0
        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);
        }
Exemplo n.º 58
0
        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();
        }
Exemplo n.º 59
0
        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);
        }
Exemplo n.º 60
0
        public override string ToString()
        {
            UriQuery query = new UriQuery(BaseUrl);
            query.Add("api_key", ApiKey);
            query.Add("format", "json");

            if (!string.IsNullOrEmpty(Title))
            {
                query.Add("title", Title);
            }

            if (!string.IsNullOrEmpty(Artist))
            {
                query.Add("artist", Artist);
            }

            if (!string.IsNullOrEmpty(Combined))
            {
                query.Add("combined", Combined);
            }

            if (Description.Any())
            {
                foreach (var description in Description)
                {
                    query.Add("description", description);
                }
            }

            if (Styles.Any())
            {
                foreach (var style in Styles)
                {
                    query.Add("style", style);
                }
            }

            if (Moods.Any())
            {
                foreach (var mood in Moods)
                {
                    query.Add("mood", mood);
                }
            }

            if (!string.IsNullOrEmpty(RankType))
            {
                query.Add("rank_type", RankType);
            }

            if (!string.IsNullOrEmpty(ArtistID))
            {
                query.Add("artist_id", ArtistID);
            }

            if (Results.HasValue)
            {
                query.Add("results", Results.Value);
            }

            if (Start.HasValue)
            {
                query.Add("start", Start.Value);
            }

            if (MaxTempo.HasValue)
            {
                query.Add("max_tempo", MaxTempo.Value);
            }

            if (MinTempo.HasValue)
            {
                query.Add("min_tempo", MinTempo.Value);
            }

            if (MaxLoudness.HasValue)
            {
                query.Add("max_loudness", MaxLoudness.Value);
            }

            if (MinLoudness.HasValue)
            {
                query.Add("min_loudness", MinLoudness.Value);
            }

            if (ArtistMaxFamiliarity.HasValue)
            {
                query.Add("artist_max_familiarity", ArtistMaxFamiliarity.Value);
            }

            if (ArtistMinFamiliarity.HasValue)
            {
                query.Add("artist_min_familiarity", ArtistMinFamiliarity.Value);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearAfter))
            {
                query.Add("artist_end_year_after", ArtistEndYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearBefore))
            {
                query.Add("artist_end_year_before", ArtistEndYearBefore);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearAfter))
            {
                query.Add("artist_start_year_after", ArtistStartYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearBefore))
            {
                query.Add("artist_start_year_before", ArtistStartYearBefore);
            }

            if (SongMaxHotttnesss.HasValue)
            {
                query.Add("song_max_hotttnesss", SongMaxHotttnesss.Value);
            }

            if (SongMinHotttnesss.HasValue)
            {
                query.Add("song_min_hotttnesss", SongMinHotttnesss.Value);
            }

            if (ArtistMaxHotttnesss.HasValue)
            {
                query.Add("artist_max_hotttnesss", ArtistMaxHotttnesss.Value);
            }

            if (ArtistMinHotttnesss.HasValue)
            {
                query.Add("artist_min_hotttnesss", ArtistMinHotttnesss.Value);
            }

            if (MaxLongitude.HasValue)
            {
                query.Add("max_longitude", MaxLongitude.Value);
            }

            if (MinLongitude.HasValue)
            {
                query.Add("min_longitude", MinLongitude.Value);
            }

            if (MaxLatitude.HasValue)
            {
                query.Add("max_latitude", MaxLatitude.Value);
            }

            if (MinLatitude.HasValue)
            {
                query.Add("min_latitude", MinLatitude.Value);
            }

            if (MaxDanceability.HasValue)
            {
                query.Add("max_danceability", MaxDanceability.Value);
            }

            if (MinDanceability.HasValue)
            {
                query.Add("min_danceability", MinDanceability.Value);
            }

            if (MaxEnergy.HasValue)
            {
                query.Add("max_energy", MaxEnergy.Value);
            }

            if (MinEnergy.HasValue)
            {
                query.Add("min_energy", MinEnergy.Value);
            }

            if (!string.IsNullOrEmpty(Mode))
            {
                query.Add("mode", Mode);
            }

            if (!string.IsNullOrEmpty(Key))
            {
                query.Add("key", Key);
            }

            if (Bucket.HasValue)
            {
                foreach (var bucket in Bucket.Value.GetBucketDescriptions())
                {
                    query.Add("bucket", bucket);
                }
            }

            if (!string.IsNullOrEmpty(Sort))
            {
                query.Add("sort", Sort);
            }

            if (Limit.HasValue)
            {
                query.Add("limit", Limit.Value.ToString().ToLower());
            }

            return query.ToString();
        }