private void ExecuteSearchCommand()
 {
     try
     {
         FilteredSamples = AllSamples.Where(
             x => x.Title.ToLower().Contains(SearchText) ||
             x.Character.ToLower().Contains(SearchText))
                           .ToList();
     }
     catch { }
 }
示例#2
0
        /// <summary>
        /// Initializes the sample manager by loading all of the samples in the app.
        /// </summary>
        public void Initialize()
        {
            // Get the currently-executing assembly.
            Assembly samplesAssembly = GetType().GetTypeInfo().Assembly;

            // Get the list of all samples in the assembly.
            AllSamples = CreateSampleInfos(samplesAssembly).OrderBy(info => info.Category)
                         .ThenBy(info => info.SampleName.ToLowerInvariant())
                         .ToList();

            // Create a tree from the list of all samples.
            FullTree = BuildFullTree(AllSamples);

            // Add a special category for featured samples.
            SearchableTreeNode featured = new SearchableTreeNode("Featured", AllSamples.Where(sample => sample.Tags.Contains("Featured")));

            FullTree.Items.Insert(0, featured);
        }