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

  • 相关阅读:
    写一点应用关于 Lucene.Net,snowball的重新组装(三)
    写一点应用关于 Lucene.Net,snowball的重新组装(二)
    C++ stirng,int 互转(转载)
    特征词选择算法对文本分类准确率的影响(二)
    webGL简单例子(klayge)
    QT 信号和槽
    windows资源管理(内核对象/GDI对象/user对象)
    memcpy memmove区别和实现
    演示软件SpringHome制作
    在浏览器中加载googleEarth插件
  • 原文地址:https://www.cnblogs.com/m7777/p/4877224.html
Copyright © 2011-2022 走看看