#region 异步,刷新页面
        /// <summary>
        /// 页面加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            dispatcherTimer.Tick += DispatcherTimer_Tick;//绑定计时器事件
            dispatcherTimer.Interval = new TimeSpan(0, 0, 5);//设置时间间隔::每隔1秒刷新页面
            dispatcherTimer.Start();//开启运行
        }

        /// <summary>
        /// 计时器事件:异步执行[刷新当前页面]
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void DispatcherTimer_Tick(object sender, EventArgs e)
        {
            Task.Factory.StartNew(AsynchronousRefresh);
        }

        /// <summary>
        /// 刷新当前页面方法
        /// </summary>
        public void AsynchronousRefresh()
        {
            Task task = new Task(() => QueryCondition(index, page, true));
            task.Start();
        }
        #endregion 

 

相关文章:

  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-12-05
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
  • 2022-12-23
猜你喜欢
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2021-06-24
相关资源
相似解决方案