zoukankan      html  css  js  c++  java
  • System.Windows.Application.Current.Dispatcher.BeginInvoke

    System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                               {
                                   if (True)
                                   {
                                      
                                   }
                               }));

    异步方法

                Task.Factory.StartNew(() =>
                {
                    ViewModel.ToDownload();
                });

    Task.Factory.StartNew<Update.UpdateConfig>(() =>
                    {
                        Thread.Sleep(3000);
                        bool isnew = Update.UpdateService.CheckNewVersion();
                        if (isnew)
                        {
                            UpdateConfig config=Update.UpdateService.GetNewVersion();
                            HasChecked = true;
                            return config;
                        }
                        return null;
                    }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
                    .ContinueWith((e) =>
                    {
                        if (e.Exception == null)
                        {
                            if (e.Result != null)
                            {
                                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                                {
                                    //弹出更新窗口
                                    Update.UpdateService.ShowUpdateWindowLoadComplete(e.Result, () =>
                                    {
                                        return true;
                                    }, Application.Current.MainWindow);
                                }));
                            }
                        }
                    });

  • 相关阅读:
    用Python实现的数据结构与算法:双端队列
    用Python实现的数据结构与算法:队列
    用Python实现的数据结构与算法:堆栈
    用Python实现的数据结构与算法:开篇
    用Markdown写博客
    一个简单的web.py论坛
    在OpenShift上托管web.py应用
    SQLite中的自增关键字:AUTO_INCREMENT、INTEGER PRIMARY KEY与AUTOINCREMENT
    【读书笔记】《HTTP权威指南》:Web Hosting
    【读书笔记】《HTTP权威指南》:Web Robots
  • 原文地址:https://www.cnblogs.com/m7777/p/4877224.html
Copyright © 2011-2022 走看看