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


C# ComponentModel.AsyncOperation类代码示例

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


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

示例1: IrcClient

 public IrcClient(string Server, int Port, string ServerPassword)
 {
     ops = AsyncOperationManager.CreateOperation(null);
     _server = Server;
     _port = Port;
     _serverPass = ServerPassword;
 }
开发者ID:cuken,项目名称:SharpBot-CLI,代码行数:7,代码来源:IrcClient.cs

示例2: CalculateAsync

        public void CalculateAsync()
        {
            if (task_id != Guid.Empty)
            {
                throw new InvalidOperationException();
            }

            task_id = Guid.NewGuid();
            async_operation = AsyncOperationManager.CreateOperation(task_id);
            Action calc = () =>
            {
                Exception error = null;
                try
                {
                    CalculatePrimeNumbers();
                }
                catch (Exception ex)
                {
                    error = ex;
                }
                bool cancelled = IsTaskCanceled;
                bool lock_taken = false;
                spin_lock_task_id.Enter(ref lock_taken);
                task_id = Guid.Empty;
                spin_lock_task_id.Exit(false);
                async_operation.PostOperationCompleted((arg) =>
                {
                    if (CalculateCompleted != null)
                    {
                        CalculateCompleted(this, arg as AsyncCompletedEventArgs);
                    }
                }, new AsyncCompletedEventArgs(error, cancelled, async_operation.UserSuppliedState));
            };
            this.AsyncResult = calc.BeginInvoke(null, null);
        }
开发者ID:EFanZh,项目名称:EFanZh,代码行数:35,代码来源:Calculator.cs

示例3: MessageMarkService

		public MessageMarkService([NotNull] IServiceProvider provider)
		{
			if (provider == null)
				throw new ArgumentNullException(nameof(provider));

			_provider = provider;
			_uiAsyncOperation = _provider.GetRequiredService<IUIShell>().CreateUIAsyncOperation();
		}
开发者ID:rsdn,项目名称:janus,代码行数:8,代码来源:MessageMarkService.cs

示例4: Run2

 public void Run2()
 {
     somethingHappened += SynchronizationDemo_somethingHappened;
     operation = AsyncOperationManager.CreateOperation(null);
     Thread workerThread = new Thread(new ThreadStart(DoWork));
     workerThread.Start();
     Thread.Sleep(2000);
     Output("Call end");
 }
开发者ID:HK-Zhang,项目名称:Grains,代码行数:9,代码来源:SynchronizationDemo.cs

示例5: loading

        private void loading(object obj, AsyncOperation asyncOperation)
        {
            string[] flist = (string[])obj;

            //loading
            string res = "ok";

            asyncOperation.PostOperationCompleted(new SendOrPostCallback(OnComplete), res);
        }
开发者ID:pJqEM5Kj,项目名称:stuff,代码行数:9,代码来源:Form1.cs

示例6: UIShell

		public UIShell(Func<IWin32Window> parentWindowGetter, [NotNull] Action<bool> uiFreezer)
		{
			if (parentWindowGetter == null)
				throw new ArgumentNullException(nameof(parentWindowGetter));
			if (uiFreezer == null) throw new ArgumentNullException(nameof(uiFreezer));
			_parentWindowGetter = parentWindowGetter;
			_uiFreezer = uiFreezer;
			_ctorAsyncOperation = AsyncHelper.CreateOperation();
		}
开发者ID:rsdn,项目名称:janus,代码行数:9,代码来源:UIShell.cs

示例7: GemixCompiler

        public GemixCompiler()
        {
            _Thread = new Thread(new ParameterizedThreadStart(gemix_compiler));
            _Thread.Priority = ThreadPriority.Normal;
            _Thread.IsBackground = true;

            _OutputCallBack = new SendOrPostCallback(OutputCallBack);

            _AsyncOperation = AsyncOperationManager.CreateOperation(null);
        }
开发者ID:viticm,项目名称:pap2,代码行数:10,代码来源:GemixCompiler.cs

示例8: CommentInput

 /// <summary>
 /// 初始化CommentInput类的新实例。
 /// </summary>
 protected CommentInput()
 {
     operation = AsyncOperationManager.CreateOperation(Guid.NewGuid());
     onComment = new SendOrPostCallback(o =>
         {
             if (Comment != null)
                 Comment(this, new CommentEventArgs((string)o));
         }
     );
 }
开发者ID:KotonoYuuri,项目名称:OriginalFireBarrager,代码行数:13,代码来源:CommentInput.cs

示例9: Navigator

        internal Navigator([NotNull] IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");

            _serviceProvider = serviceProvider;

            _uiAsyncOperation = _serviceProvider.GetRequiredService<IUIShell>().CreateUIAsyncOperation();
            _form = new NavigationDummyForm(_serviceProvider);
            _serviceProvider.GetRequiredService<DockManager>().RegisterPersistablePane(_form);
        }
开发者ID:permyakov,项目名称:janus,代码行数:11,代码来源:Navigator.cs

示例10: CompletionMethod

        private void CompletionMethod(string output, Exception ex, bool cancelled, AsyncOperation asyncOp)
        {
            lock (userStateDictionary)
            {
                userStateDictionary.Remove(asyncOp.UserSuppliedState);
            }

            // results of the operation
            asyncOp.PostOperationCompleted(onCompletedDelegate,
                new LongTaskCompletedEventArgs(output, ex, cancelled, asyncOp.UserSuppliedState));
        }
开发者ID:ChegnduJackli,项目名称:Projects,代码行数:11,代码来源:AsyncComponent.cs

示例11: AsyncGuessState

 public AsyncGuessState(
     string phrase,
     NetworkSetting networkSetting,
     AsyncOperation asyncOperation,
     EventHandler<GuessCompletedEventArgs> guessCompletedHandler)
 {
     this.asyncOperation = asyncOperation;
     this.phrase = phrase;
     this.networkSetting = networkSetting;
     GuessCompleted += guessCompletedHandler;
 }
开发者ID:cyotek,项目名称:translateclient,代码行数:11,代码来源:Guesser.cs

示例12: SyncGroupHelper

 public SyncGroupHelper(string groupName, object userState, AsyncOperation asyncOp, SendOrPostCallback progressReporterDelegate)
 {
     if (groupName == null)
     {
         throw new ArgumentNullException("groupName");
     }
     this.groupName = groupName;
     this.userState = userState;
     this.asyncOperation = asyncOp;
     this.progressReporter = progressReporterDelegate;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:SyncGroupHelper.cs

示例13: TestInit

		public void TestInit()
		{
			ManualResetEvent waitHandle = new ManualResetEvent(false);
			ThreadPool.QueueUserWorkItem(o =>
			{
				operation = AsyncOperationManager.CreateOperation(null);
				InputProviderManager = new InputProviderManager_Accessor(new Provider());
				waitHandle.Set();
				Application.Run();
			});
			waitHandle.WaitOne();
		}
开发者ID:zhuangfangwang,项目名称:ise,代码行数:12,代码来源:BaseTestForApplicationInterfaceService.cs

示例14: DispatchCompleting

 private void DispatchCompleting(MessageData responsemsg, Exception ex, bool canceled, AsyncOperation asyncOper)
 {
     if (!canceled)
     {
         lock (_userStateToLifetime.SyncRoot)
         {
             _userStateToLifetime.Remove(asyncOper.UserSuppliedState);
         }
     }
     TransmitCompletedEventArgs eventArgs = new TransmitCompletedEventArgs(responsemsg, ex, canceled, asyncOper.UserSuppliedState);
     asyncOper.PostOperationCompleted(onCompletedDelegate, eventArgs);
 }
开发者ID:joeiren,项目名称:quant.AidSystem,代码行数:12,代码来源:MsgDispatchEAP.cs

示例15: Process

 protected override Bitmap Process(Bitmap bitmap, AsyncOperation asyncOp)
 {
     Bitmap newBitmap = new Bitmap(bitmap);
     Graphics g = Graphics.FromImage(newBitmap);
     g.SmoothingMode = SmoothingMode.HighQuality;
     g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
     SizeF textSize = g.MeasureString(ImageAddTextPluginContext.Text, ImageAddTextPluginContext.Font);
     PointF p = new Point();
     switch (ImageAddTextPluginContext.Position)
     {
         case ContentAlignment.TopLeft:
             p.X = 0.0f;
             p.Y = 0.0f;
             break;
         case ContentAlignment.TopCenter:
             p.X = (newBitmap.Width - textSize.Width) / 2;
             p.Y = 0.0f;
             break;
         case ContentAlignment.TopRight:
             p.X = newBitmap.Width - textSize.Width;
             p.Y = 0.0f;
             break;
         case ContentAlignment.MiddleLeft:
             p.X = 0.0f;
             p.Y = (newBitmap.Height - textSize.Height) / 2;
             break;
         case ContentAlignment.MiddleCenter:
             p.X = (newBitmap.Width - textSize.Width) / 2;
             p.Y = (newBitmap.Height - textSize.Height) / 2;
             break;
         case ContentAlignment.MiddleRight:
             p.X = newBitmap.Width - textSize.Width;
             p.Y = (newBitmap.Height - textSize.Height) / 2;
             break;
         case ContentAlignment.BottomLeft:
             p.X = 0.0f;
             p.Y = newBitmap.Height - textSize.Height;
             break;
         case ContentAlignment.BottomCenter:
             p.X = (newBitmap.Width - textSize.Width) / 2;
             p.Y = newBitmap.Height - textSize.Height;
             break;
         case ContentAlignment.BottomRight:
             p.X = newBitmap.Width - textSize.Width;
             p.Y = newBitmap.Height - textSize.Height;
             break;
     }
     p.X += ImageAddTextPluginContext.XOffset;
     p.Y += ImageAddTextPluginContext.YOffset;
     g.DrawString(ImageAddTextPluginContext.Text, ImageAddTextPluginContext.Font, new SolidBrush(ImageAddTextPluginContext.Color), p);
     g.Dispose();
     return newBitmap;
 }
开发者ID:EFanZh,项目名称:EFanZh,代码行数:53,代码来源:ImageAddTextPlugin.cs


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