示例#1
0
 /// <summary>
 /// Methord Used to get search List.
 /// </summary>
 /// <param name="searchString"></param>
 private void OnSearchChanged(string searchString)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(searchString))
         {
             //Add Elements of InstrumentList to SearchResults When Search String is Empty.
             SearchResults.Clear();
             foreach (var security in InstrumentList)
             {
                 SearchResults.Add(security);
             }
         }
         else
         {
             //Filter InstrumentList according to the Search string and Adds it to SearchResults
             SearchResults.Clear();
             var temp = new ObservableCollection <Security>(InstrumentList.Where(d => d.Symbol.Contains(searchString)));
             foreach (var security in temp)
             {
                 SearchResults.Add(security);
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, _oType.FullName, "OnSearchChanged");
     }
 }