Esempio n. 1
0
        /// <summary>
        /// Invoked when something that would affect our search has been modified.
        /// </summary>
        private void OnSearchInputChanged(object sender, EventArgs e)
        {
            // Clear out the search results.
            Content.Clear();

            // Get the current search string.
            string search = searchValue.Value;

            foreach (BooleanChoice filter in filters)
            {
                // If the filter has been disabled, don't search it.
                if (!filter.Value)
                {
                    continue;
                }

                // Get the experience off of the item.
                ApplicationExperience experience = filter.Data["Experience"] as ApplicationExperience;
                if (experience == null)
                {
                    System.Diagnostics.Debug.WriteLine("No Experience stored on " + filter);
                    continue;
                }

                // Search that experience.
                IList <SearchResult> results = experience.Search(search);

                foreach (SearchResult result in results)
                {
                    // Add the search result to the content list.
                    Content.Add(result);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the given experience to the Application's Experiences list
        /// and create a menu category for it.
        /// </summary>
        private void AddExperience(ApplicationExperience experience)
        {
            // Application sets experience's Id to its index in the Experiences
            // array.  This makes it easy to map from id back to experience
            experience.Id = experiences.Count;

            experiences.Add(experience);
            menu.Add(experience.CreateMenuCategory());
        }
Esempio n. 3
0
        /// <summary>
        /// Create a search filter object given an Experience.
        /// </summary>
        private BooleanChoice CreateSearchPageFilter(SearchPage page, ApplicationExperience experience)
        {
            BooleanChoice filter = new BooleanChoice(page, experience.Description);

            // Stick the associated experience in dynamic data so we can fetch it later.
            filter.Data["Experience"] = experience;

            // Default the filter to "on".
            filter.Value = true;

            return(filter);
        }
Esempio n. 4
0
 /// <summary>
 /// Create a download filter object from an experience.
 /// </summary>
 private static DownloadFilter CreateDownloadPageFilter(DownloadsPage page, ApplicationExperience experience)
 {
     return(new DownloadFilter(page, experience.Description, experience.ActiveDownloads));
 }