当前位置: 首页>>代码示例>>C#>>正文


C# Dispatcher.BeginInvoke方法代码示例

本文整理汇总了C#中System.Windows.Threading.Dispatcher.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# Dispatcher.BeginInvoke方法的具体用法?C# Dispatcher.BeginInvoke怎么用?C# Dispatcher.BeginInvoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Threading.Dispatcher的用法示例。


在下文中一共展示了Dispatcher.BeginInvoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Verify

        public static bool Verify(Dispatcher dispatcher, Stream file)
        {
            if (file.Length == 0)
            {
                dispatcher.BeginInvoke(() =>
                    MessageBox.Show(Resources.EmptyFile,
                        Properties.Resources.DownloadTitle,
                        MessageBoxButton.OK));

                return false;
            }

            if (!DatabaseReader.CheckSignature(file))
            {
                dispatcher.BeginInvoke(() =>
                    MessageBox.Show(Resources.NotKdbx,
                        Properties.Resources.DownloadTitle,
                        MessageBoxButton.OK));

                return false;
            }

            file.Position = 0;
            return true;
        }
开发者ID:MarioBinder,项目名称:7Pass,代码行数:25,代码来源:DatabaseVerifier.cs

示例2: Refresh

        internal void Refresh(Dispatcher dispatcher)
        {
            dispatcher.BeginInvoke((Action)delegate
            {
                //RGB
                unsafe
                {
                    if (rgbSource != null)
                    {
                        ReadLockedWrapperPtr ptr = ResultsDllWrapper.lockFactoryImage(ImageProductType.RGBSourceProduct);
                        rgbSource.Lock();
                        rgbSource.WritePixels(new Int32Rect(0, 0, rgbWidth, rgbHeight), ptr.IntPtr, rgbWidth * rgbHeight * 3, rgbWidth * 3);
                        rgbSource.Unlock();
                        ResultsDllWrapper.releaseReadLockedWrapperPtr(ptr);
                    }
                }

                //Depth
                unsafe
                {
                    if (depthSource != null)
                    {
                        ReadLockedWrapperPtr ptr = ResultsDllWrapper.lockFactoryImage(ImageProductType.DepthSynchronizedProduct);
                        depthSource.Lock();
                        depthSource.WritePixels(new Int32Rect(0, 0, depthWidth, depthHeight), ptr.IntPtr, depthWidth * depthHeight * 2, depthWidth * 2);
                        depthSource.Unlock();
                        ResultsDllWrapper.releaseReadLockedWrapperPtr(ptr);
                    }
                }
            }, null);
        }
开发者ID:zhuangfangwang,项目名称:ise,代码行数:31,代码来源:RawVideoStreamingDLL.cs

示例3: BeginInvoke

 public static void BeginInvoke(Dispatcher dispatcher, Action action)
 {
     if (IsSynchronous)
         action();
     else
         dispatcher.BeginInvoke(action);
 }
开发者ID:JoeyEremondi,项目名称:tikzedt,代码行数:7,代码来源:MyBackgroundWorker.cs

示例4: FacebookWPFBrowser

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="url">The url to navigate to when loaded.</param>
 public FacebookWPFBrowser(string url)
 {
     dispatcher = Dispatcher.CurrentDispatcher;
     InitializeComponent();
     _url = url;
     dispatcher.BeginInvoke(new Action(() => this.webBrowser.Navigate(new Uri(_url))));
 }
开发者ID:jeffdeville,项目名称:FacebookDeveloperToolkit---Fork-at-37335,代码行数:11,代码来源:FacebookWPFBrowser.xaml.cs

示例5: VisualCommentsHelper

        public VisualCommentsHelper(Dispatcher disp, ItemContainerGenerator gen, Comment placeholder)
        {
            _gen = gen;
            _placeholder = placeholder;

            disp.BeginInvoke(new Action(DeferredFocusSet),
                             System.Windows.Threading.DispatcherPriority.Background, null);
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:8,代码来源:VisualCommentsHelper.cs

示例6: ExecuteAsyncUI

 public static void ExecuteAsyncUI(Dispatcher dispatcher, Action action, Action callback)
 {
     DispatcherOperation dispatcherOp = dispatcher.BeginInvoke(action, DispatcherPriority.Normal);
     if (null != callback)
     {
         dispatcherOp.Completed += (s, e) => { callback(); };
     }
 }
开发者ID:jarrodwood,项目名称:MediaScribe,代码行数:8,代码来源:ThreadHelper.cs

示例7: DoEvents

        public static void DoEvents(Dispatcher disp = null) {
            DispatcherFrame frame = new DispatcherFrame();
            if(disp == null) {
                disp = Dispatcher.CurrentDispatcher;
            }

            disp.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame);
            Dispatcher.PushFrame(frame);
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:9,代码来源:TestScript.cs

示例8: CommentNotificationDeferral

        public CommentNotificationDeferral(Dispatcher disp, DiscCtx ctx, ItemsControl commentItems)
        {
            _disp = disp;
            _ctx = ctx;
            _commentItems = commentItems;

            _disp.BeginInvoke(new Action(InjectCommentNotifications),
                              System.Windows.Threading.DispatcherPriority.Background);
        }     
开发者ID:gdlprj,项目名称:duscusys,代码行数:9,代码来源:CommentNotificationDeferral.cs

示例9: WithExceptionThrowingInDispatcher

 /// <summary>
 /// Rethrows exceptions thrown during task execution in thespecified dispatcher thread.
 /// </summary>
 /// <param name="task">The task.</param>
 /// <param name="dispatcher">The dispatcher.</param>
 /// <returns></returns>
 public static Task WithExceptionThrowingInDispatcher(this Task task, Dispatcher dispatcher)
 {
     return task.ContinueWith(t =>
     {
         dispatcher.BeginInvoke(() =>
         {
             throw t.Exception;
         }, DispatcherPriority.Send);
     }, TaskContinuationOptions.OnlyOnFaulted);
 }
开发者ID:modulexcite,项目名称:DynamicDataDisplay,代码行数:16,代码来源:TaskExtensions.cs

示例10: CreateTournamentViewModel

        public CreateTournamentViewModel(Dispatcher dispatcher)
        {
            _dispatcher = dispatcher;
            _xmppHost = ((App)App.Current).XmppHost;
            _gameController = ServiceLocator.Current.GetInstance<GameController>();

            StartTournamentCommand = new RelayCommand(StartTournament);

            TournamentTypeListInternal.Add(new Option<string>("Round Robin", "RoundRobin"));
            _xmppHost.PlayerRegistered += (sender, e) => { _dispatcher.BeginInvoke(() => { RegisteredPlayerListInternal.Add(new Option<Jid>(e.User.Bare, e.User)); UpdateCanStartTournament(); }); };
        }
开发者ID:micahlmartin,项目名称:RPS-Xmpp,代码行数:11,代码来源:CreateTournamentViewModel.cs

示例11: GitHubModel

        public GitHubModel(Dispatcher dispatcher)
        {
            Dispatcher = dispatcher;
            _exceptionAction = ex => Dispatcher.BeginInvoke(() =>
                    MessageBox.Show("Error: " + Enum.GetName(typeof(ErrorType), ex.ErrorType), "", MessageBoxButton.OK)
                );

            _client = new GitHubClient();

            Contexts = new ObservableCollection<Context>();
        }
开发者ID:quandtm,项目名称:Milestone,代码行数:11,代码来源:GitHubModel.cs

示例12: OnUiThread

        public static void OnUiThread(Action action, Dispatcher disp = null,
			DispatcherPriority prio = DispatcherPriority.Background)
        {
            if (disp == null)
            {
                if (Application.Current != null)
                    disp = Application.Current.Dispatcher;
            }

            if (disp != null)
                disp.BeginInvoke(action, prio);
        }
开发者ID:rajkosto,项目名称:DayZeroLauncher,代码行数:12,代码来源:Execute.cs

示例13: BuildItemViewModel

 public BuildItemViewModel(BuildItem item, Dispatcher dispatcher)
 {
     Item = item;
     Item.StatusChanged += (sender, args) => dispatcher.BeginInvoke((Action)(() =>
     {
         NotifyPropertyChanged("Status");
         NotifyPropertyChanged("Error");
         NotifyPropertyChanged("ErrorTitle");
         NotifyPropertyChanged("ErrorMessage");
         NotifyPropertyChanged("ShowError");
     }));
 }
开发者ID:Zocdoc,项目名称:ZocBuild.Database,代码行数:12,代码来源:BuildItemViewModel.cs

示例14: UpdateStats

 private void UpdateStats(RoutedEventArgs e)
 {
     var button = e.Source as Button;
     if (button != null)
     {
         _dispatcher = button.Dispatcher;
         var client = BrightstarService.GetClient(Store.Source.ConnectionString);
         _statsUpdateJob = client.UpdateStatistics(Store.Location);
         _dispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                 new TransactionViewModel.JobMonitorDelegate(CheckJobStatus));
     }
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:12,代码来源:StoreStatisticsViewModel.cs

示例15: Download

        public void Download(string file, string saveWhere, Dispatcher dispatch, Action done)
        {
            var shareResp = _client.GetMedia(file);

            using (WebClient webclient = new WebClient())
            {
                webclient.DownloadFileCompleted +=
                    (object sender, AsyncCompletedEventArgs e) =>
                        { dispatch.BeginInvoke(new Action(() => { done(); })); };
                webclient.DownloadFileAsync(new Uri(shareResp.Url), saveWhere);
            }
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:12,代码来源:DropStorage.cs


注:本文中的System.Windows.Threading.Dispatcher.BeginInvoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。