コード例 #1
0
        private void Search(string ns, bool alwaysPaging = false)
        {
            var isPartial       = false;
            var matchedSettings = allSettings.ForParse();


            var settingCount = 0;

            if (ns.EndsWith("."))
            {
                var settings = matchedSettings.Where(o => o.Namespace.StartsWith(ns)).ToList();

                if (!alwaysPaging && (settings.Count() / 3 > appOptions.TruncateResultsOver))
                {
                    isPartial       = true;
                    matchedSettings = settings.Take(appOptions.TruncateResultsOver);
                    settingCount    = settings.Count;
                }
                else
                {
                    matchedSettings = settings.ToList();
                }
            }
            else
            {
                matchedSettings = matchedSettings.Where(o => o.Namespace == ns).ToList();
            }

            var namespaces = matchedSettings.ToNamespaces().ToList();
            var languages  = allSettings.ToLanguages().ToList();


            var languageGroups = new List <LanguageGroup>();

            foreach (string n in namespaces)
            {
                var languageGroup = new LanguageGroup(n, languages);
                languageGroup.LoadSettings(matchedSettings.Where(o => o.Namespace == n).ToList());
                languageGroups.Add(languageGroup);
            }

            pagingController.SwapData(languageGroups, isPartial);
            languageGroupContainer.ItemsSource = pagingController.PageData;
            pagingMessage.Text             = pagingController.PageMessage;
            partialPagingButton.Visibility = isPartial ? Visibility.Visible : Visibility.Hidden;
            pagingButtons.Visibility       = isPartial ? Visibility.Visible : Visibility.Hidden;
            if (isPartial)
            {
                partialPagingButton.Content = "Load " + settingCount / 3;
            }

            ContentScroller.ScrollToTop();
        }
コード例 #2
0
 private void PagedUpdates()
 {
     languageGroupContainer.ItemsSource = pagingController.PageData;
     pagingMessage.Text = pagingController.PageMessage;
     ContentScroller.ScrollToTop();
 }