コード例 #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="book"></param>
        /// <param name="mainWindow"></param>
        /// <param name="config"></param>
        public DetailsPage(Book book, MainWindow mainWindow = null, Config config = null)
        {
            InitializeComponent();

            Thread thread = new Thread(new ThreadStart(delegate
            {
                this.book       = book;
                this.mainWindow = mainWindow;
                this.config     = config;

                this.Dispatcher.Invoke(new Action(() =>
                {
                    this.Title       = "《" + book.Name + "》-最新章节:" + book.Newest;
                    this.DataContext = book;
                    if (DataFetch.BoolBookAdd(book.Name))
                    {
                        Join.Background   = Brushes.DarkTurquoise;
                        Join.Content      = "已加入";
                        Join.IsEnabled    = false;
                        buffer.Visibility = Visibility.Hidden;
                    }
                }));
            }));

            thread.IsBackground = true;  //是否为后台线程
            thread.Start();
            this.Closed += BeforeClosing;
        }
コード例 #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="book"></param>
 /// <param name="mainWindow"></param>
 /// <param name="config"></param>
 public DetailsPage(Book book, MainWindow mainWindow = null, Config config = null)
 {
     InitializeComponent();
     this.book        = book;
     this.mainWindow  = mainWindow;
     this.config      = config;
     this.Title       = "《" + book.Name + "》-最新章节:" + book.Newest;
     this.DataContext = book;
     this.Closed     += BeforeClosing;
     if (DataFetch.BoolBookAdd(book.Name))
     {
         Join.Background = Brushes.DarkTurquoise;
         Join.Content    = "已加入";
         Join.IsEnabled  = false;
     }
 }