Esempio n. 1
0
        async void MediaSearchClickCommandExecute(RoutedEventArgs e)
        {
            var textValue = string.Empty;

            //텍스트 데이터 트림
            if (!string.IsNullOrWhiteSpace(SearchWord))
            {
                textValue = SearchWord.Trim().ToLower();
            }

            if (!SearchInResult)
            {
                SearchResultSource.Clear();
                await ThreadPool.RunAsync(async handler =>
                {
                    List <MediaInfo> resultList = new List <MediaInfo>();
                    fileDAO.SearchAllVideoList(resultList, textValue);

                    foreach (var mi in resultList)
                    {
                        await DispatcherHelper.RunAsync(() => {
                            SearchResultSource.Add(mi);
                        });
                    }
                });
            }
            else
            {
                for (int i = SearchResultSource.Count - 1; i >= 0; i--)
                {
                    var mii = SearchResultSource[i];
                    if (mii.Name.ToLower().IndexOf(textValue) == -1)
                    {
                        SearchResultSource.RemoveAt(i);
                    }
                }
            }
            CheckListButtonEnable = SearchResultSource.Count > 0;
        }