• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SendOrPostCallback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SendOrPostCallback的典型用法代码示例。如果您正苦于以下问题:C# SendOrPostCallback类的具体用法?C# SendOrPostCallback怎么用?C# SendOrPostCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SendOrPostCallback类属于命名空间,在下文中一共展示了SendOrPostCallback类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VerifyDelegateNotNull

 private void VerifyDelegateNotNull(SendOrPostCallback d)
 {
     if (d == null)
     {
         throw new ArgumentNullException(SR.GetString("Async_NullDelegate"), "d");
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AsyncOperation.cs


示例2: Post

 public override void Post(SendOrPostCallback d, object state)
 {
     lock (_postedCallbacks)
     {
         _postedCallbacks.Add(Tuple.Create(d, state));
     }
 }
开发者ID:rdterner,项目名称:Perspex,代码行数:7,代码来源:UnitTestSynchronizationContext.cs


示例3: AsyncSendData

 private AsyncSendData(AsyncDataHandler handler, Uri uriToUse, AtomEntry entry, AtomFeed feed,
     SendOrPostCallback callback, object userData, bool parseFeed)
     : base(uriToUse, null, userData, callback, parseFeed) {
     this.DataHandler = handler;
     this.entry = entry;
     this.Feed = feed;
 }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:7,代码来源:asyncservice.cs


示例4: Post

        public void Post(SendOrPostCallback callback, object state)
        {
            #region Contracts

            if (callback == null) throw new ArgumentNullException();

            #endregion

            // Create
            Action action = delegate()
            {
                try
                {
                    callback(state);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Delegate:{0}, State:{1}, Message:{2}", callback.GetType(), "Exception", ex.Message));
                }
            };

            // Set
            lock (_syncRoot)
            {
                // Require
                if (_operateState != OperateState.Started) throw new InvalidOperationException();
                if (_executeThreadState != OperateState.Started) throw new InvalidOperationException();

                // Attach
                _executeActionQueue.Enqueue(action);
            }
        }
开发者ID:JPomichael,项目名称:CLK,代码行数:32,代码来源:STAThread.cs


示例5: Functions

 public Functions()
 {
     #region Initialize Delegates for Database Commands
     onGetProfileCompletedDelegate = new SendOrPostCallback(GetProfileCompleted);
     onGetServersCompletedDelegate = new SendOrPostCallback(GetServersCompleted);
     #endregion
 }
开发者ID:jedlimke,项目名称:csharp.tent,代码行数:7,代码来源:Functions.cs


示例6: Post

        public virtual void Post(SendOrPostCallback d, object state) {
#if (dotNET10 || dotNET11 || dotNETCF10)
            ThreadPool.QueueUserWorkItem(new WaitCallback(d), state);
#else
            ThreadPool.QueueUserWorkItem(d.Invoke, state);
#endif
        }
开发者ID:cooclsee,项目名称:hprose-dotnet,代码行数:7,代码来源:SynchronizationContext.cs


示例7: CallbackItem

 public CallbackItem(SendOrPostCallback item, object state)
 {
     this.Id = Guid.NewGuid();
     this.executionCompleted = new ManualResetEvent(false);
     this.callback = item;
     this.state = state;
 }
开发者ID:namesecured,项目名称:TestSync,代码行数:7,代码来源:CallbackItem.cs


示例8: AsyncPost

 /// <summary>
 /// Post a call to the specified method on the creator thread
 /// </summary>
 /// <param name="callback">Method that is to be called</param>
 /// <param name="state">Method parameter/state</param>
 public void AsyncPost(SendOrPostCallback callback, object state)
 {
     if (IsAsyncCreatorThread)
         callback(state); // Call the method directly
     else
         AsynchronizationContext.Post(callback, state);  // Post on creator thread
 }
开发者ID:Gainedge,项目名称:BetterExplorer,代码行数:12,代码来源:AsyncContext.cs


示例9: Post

        public override async void Post(SendOrPostCallback d, object state)
        {
            // The call to Post() may be the state machine signaling that an exception is
            // about to be thrown, so we make sure the operation count gets incremented
            // before the Task.Run, and then decrement the count when the operation is done.
            OperationStarted();

            try
            {
                // await and eat exceptions that come from this post
                // We could get a thread abort, so we need to handle that
                await Task.Run(() =>
                {
                    try
                    {
                        Send(d, state);
                    }
                    finally
                    {
                        OperationCompleted();
                    }
                }).ConfigureAwait(false);
            }
            catch { }
        }
开发者ID:kouweizhong,项目名称:xunit,代码行数:25,代码来源:AsyncTestSyncContext.cs


示例10: Invoke

 void Invoke(SendOrPostCallback d, object state, bool sync)
 {
     if (sync)
         sc.Send(d,state);
     else
         sc.Post(d, state);
 }
开发者ID:winterheart,项目名称:game-utilities,代码行数:7,代码来源:BrowserController.cs


示例11: SynchronizedCall

        /// <summary>
        /// Initializes a new instance of the <see cref="SynchronizedCall"/> class.
        /// </summary>
        /// <param name="callback">The call to marshal.</param>
        /// <param name="state">The state to provide to the call. <see langword="null"/> is fine if you don't need to include any state.</param>
        public SynchronizedCall(SendOrPostCallback callback, object state)
        {
            Throw.If.Null(callback, "callback");

            this.callback = callback;
            this.state = state;
        }
开发者ID:qmfrederik,项目名称:remoteviewing,代码行数:12,代码来源:SynchronizedCall.cs


示例12: Post

        public void Post(string resource, Dictionary<string, string> parameters, SendOrPostCallback onComplete) {
            var uriPath = resource;
            var uri = new Uri(uriPath, UriKind.Absolute);
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            httpWebRequest.Method = "POST";

            var writeRequest = new AsyncCallback(e => {
                httpWebRequest.ContentType = "application/x-www-form-urlencoded";

                var stream = httpWebRequest.EndGetRequestStream(e);
                var postData = string.Empty;

                foreach (var key in parameters.Keys) {
                    postData += key + "=" + parameters[key] + "&";
                }

                var streamWriter = new StreamWriter(stream);
                streamWriter.Write(postData);
                streamWriter.Close();
                stream.Close();

                httpWebRequest.BeginGetResponse(x => synchronizationContext.Post(onComplete, x), null);
            });

            httpWebRequest.BeginGetRequestStream(writeRequest, null);
        }
开发者ID:slieser,项目名称:sandbox2,代码行数:26,代码来源:Rest.cs


示例13: Post

        public override void Post(SendOrPostCallback d, object state)
        {
            if (mQueue.IsAddingCompleted)
                throw new SynchronizationContextCompletedException();

            mQueue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
        }
开发者ID:afj88,项目名称:DBBranchManager,代码行数:7,代码来源:SingleThreadSynchronizationContext.cs


示例14: Post

 public static void Post(SendOrPostCallback callback, object state = null)
 {
     lock (s_posts)
     {
         s_posts.Add(Tuple.Create(callback, state));
     }
 }
开发者ID:SaladLab,项目名称:TicTacToe,代码行数:7,代码来源:ChannelEventDispatcher.cs


示例15: Post

		public override void Post(SendOrPostCallback d, object state)
		{
			lock (list)
			{
				list.Add(() => d(state));
			}
		}
开发者ID:Zamir7,项目名称:urho,代码行数:7,代码来源:ListBasedUpdateSynchronizationContext.cs


示例16: ImageListViewCacheThumbnail

        /// <summary>
        /// Initializes a new instance of the <see cref="ImageListViewCacheThumbnail"/> class.
        /// </summary>
        /// <param name="owner">The owner control.</param>
        public ImageListViewCacheThumbnail(ImageListView owner)
        {
            context = null;
            bw = new QueuedBackgroundWorker();
            bw.ProcessingMode = ProcessingMode.LIFO;
            bw.IsBackground = true;
            bw.DoWork += bw_DoWork;
            bw.RunWorkerCompleted += bw_RunWorkerCompleted;

            checkProcessingCallback = new SendOrPostCallback(CanContinueProcessing);

            mImageListView = owner;
            CacheMode = CacheMode.OnDemand;
            CacheLimitAsItemCount = 0;
            CacheLimitAsMemory = 20 * 1024 * 1024;
            RetryOnError = false;

            thumbCache = new Dictionary<Guid, CacheItem>();
            editCache = new Dictionary<Guid, bool>();
            processing = new Dictionary<Guid, bool>();
            processingRendererItem = Guid.Empty;
            processingGalleryItem = Guid.Empty;

            rendererItem = null;
            galleryItem = null;

            MemoryUsed = 0;
            MemoryUsedByRemoved = 0;
            removedItems = new List<Guid>();

            disposed = false;
        }
开发者ID:zebulon75018,项目名称:mauriceadmin,代码行数:36,代码来源:ImageListViewCacheThumbnail.cs


示例17: Post

        public override void Post(SendOrPostCallback d, object state)
        {
            if (isSingleThread) Queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
            else
                base.Post(chainedState => CallWithOperationContext(d, state), state);

        }
开发者ID:JonasSyrstad,项目名称:Stardust,代码行数:7,代码来源:ThreadSynchronizationContext.cs


示例18: Send

 /// <inheritdoc/>
 public override void Send(SendOrPostCallback d, object state)
 {
     if (Dispatcher.UIThread.CheckAccess())
         d(state);
     else
         Dispatcher.UIThread.InvokeTaskAsync(() => d(state)).Wait();
 }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:8,代码来源:AvaloniaSynchronizationContext.cs


示例19: Send

		public override void Send(SendOrPostCallback d, object state)
		{
			if (System.Threading.Thread.CurrentThread.ManagedThreadId == ApplicationHandler.MainThreadID)
			{
				d(state);
			}
			else
			{
				var evt = new ManualResetEvent(false);
				Exception exception = null;

				Idle.Add(() =>
				{
					try
					{
						d(state);
					}
					catch (Exception ex)
					{
						exception = ex;
					}
					finally
					{
						evt.Set();
					}
					return false;
				});

				evt.WaitOne();

				if (exception != null)
					throw exception;
			}
		}
开发者ID:mhusen,项目名称:Eto,代码行数:34,代码来源:GtkSynchronizationContext.cs


示例20: Send

        public override void Send(SendOrPostCallback d, object state) {
#if !dotNETCF10
            contextControl.Invoke(d, new object[] { state });
#else
            contextControl.Invoke(new EventHandler(new EventHandleCreate(d, state).EventHandler));
#endif
        }
开发者ID:cooclsee,项目名称:hprose-dotnet,代码行数:7,代码来源:WindowsFormsSynchronizationContext.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SendParameters类代码示例发布时间:2022-05-24
下一篇:
C# SendOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap