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);
                                }));
                            }
                        }
                    });

  • 相关阅读:
    Captura
    食用Win系统自带的PowerShell登录服务器
    uTools
    图片镜像缓存服务
    博客园自定义网站ico
    超星图床
    教程翻译-理解基于矢量场寻路算法
    CentOS防火墙命令
    CentOS7的vsftpd安装和配置
    Unity网路编程-TCP实现细节备忘
  • 原文地址:https://www.cnblogs.com/m7777/p/4877224.html
Copyright © 2011-2022 走看看