Example #1
0
        private void StartSearchTimer()
        {
            if (timer.IsNull())
            {
                timer = new DispatcherTimer(interval, DispatcherPriority.Normal, (sender, e) =>
                {
                    if (this.RootItem.IsNull())
                    {
                        this.IsSearching = false;
                        this.StopSearchTimer();
                        return;
                    }

                    if (this.SearchKeyword.IsNullOrEmpty())
                    {
                        this.IsSearching = false;
                        this.StopSearchTimer();
                        return;
                    }

                    //Eric:temp ignore
//                    if (!(this.RootItem is CloudFolder) && this.RootItem.IsLoading)
//                    {
//#if DEBUG
//                        LogHelper.Debug("--- Searching timer, current folder is loading----");
//#endif
//                        //this.IsSearching = true;
//                        //return;
//                    }
//                    else
                    {
                        this.Search(this.SearchKeyword);
                        this.StopSearchTimer();
                    }
                }, Application.Current.Dispatcher);
            }

            if (!timer.IsEnabled)
            {
                timer.Start();
            }
            this.IsSearching = true;
        }
Example #2
0
        private void StartSearchTimer()
        {
            if (timer.IsNull())
            {
                timer = new DispatcherTimer(interval, DispatcherPriority.Normal, (sender, e) =>
                {
                    if (this.RootItem.IsNull())
                    {
                        this.StopSearchTimer();
                        return;
                    }

                    if (this.SearchKeyword.IsNullOrEmpty())
                    {
                        this.IsSearching = false;
                        this.StopSearchTimer();
                        return;
                    }

                    if (this.RootItem.IsLoading)
                    {
#if DEBUG
                        LogHelper.Debug("--- Searching timer, current folder is loading----");
#endif
                        //this.IsSearching = true;
                        //return;
                    }
                    else
                    {
                        this.Search(this.SearchKeyword);
                        this.StopSearchTimer();
                    }
                }, App.Current.Dispatcher);
            }

            if (!timer.IsEnabled)
            {
                timer.Start();
            }
            this.IsSearching = true;
        }