Ejemplo n.º 1
0
        /// <summary>
        /// 养肥区更新
        /// </summary>
        private void UpdateFatten()
        {
            Thread thread = new Thread(new ThreadStart(delegate
            {
                List <Book> books = DataFetch.GetBooks(true);
                foreach (Book book in books)
                {
                    book.FattenNumber = DataFetch.GetListCount(book) - (int)book.Read;
                    if (book.FattenNumber >= config.FattenNumber)
                    {
                        this.Dispatcher.Invoke(new Action(() =>
                        {
                            new Tips("《" + book.Name + "》已经养肥,请尽情享用~").Show();
                        }));
                    }
                }

                this.Dispatcher.Invoke(new Action(() =>
                {
                    if ((bool)BoolFertilizingArea.IsChecked)
                    {
                        FattenArea.ItemsSource = books;
                    }
                }));
            }));

            thread.IsBackground = true;
            thread.Start();
        }