コード例 #1
0
        /// <summary>
        /// 异步查询名人信息
        /// </summary>
        public async void SearchPersonAsync()
        {
            var contions = await GetSearchPersonCondtionsAsync();

            if (contions.Count() == 0)
            {
                return;
            }
            bool isFirst = true;
            IEnumerable <FamousPerson> tmpQuery = null;

            foreach (var contion in contions)
            {
                if (isFirst)
                {
                    tmpQuery = FamousPersons.Where(contion);
                    isFirst  = false;
                }
                else
                {
                    tmpQuery = tmpQuery.Where(contion);
                }
            }
            SelectFamousPersons = new ObservableCollection <FamousPerson>(tmpQuery);
            ShowSelectFamouses();
        }
コード例 #2
0
 private void ShowSelectFamousesByGraphic(IEnumerable <Graphic> graphics)
 {
     SelectFamousPersons = new ObservableCollection <FamousPerson>(FamousPersons.Where(p =>
     {
         return(graphics.Where(g => (int)g.Attributes["PersonId"] == p.FamousPersonId).Count() > 0);
     }));
     foreach (var graphic in graphics)
     {
         graphic.IsSelected = true;
     }
     new SelectPersonsDialog().ShowDialog();
 }