示例#1
0
        /// <summary>
        /// 更换书源
        /// </summary>
        private void Replace_Click(object sender, RoutedEventArgs e)
        {
            bookshelf.Visibility    = Visibility.Hidden;
            SourceChange.Visibility = Visibility.Visible;
            int  Newid = Convert.ToInt32(((MenuItem)sender).Tag);
            Book book  = DataFetch.GetBook(Newid);

            SourceChange.ItemsSource = null;

            Thread thread = new Thread(new ThreadStart(delegate
            {
                List <Book> books = DataFetch.SourceSearch(book);

                this.Dispatcher.Invoke(new Action(() =>
                {
                    SourceChange.ItemsSource = books;
                }));
            }));

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