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


C# SynchronizationContext.OperationStarted方法代码示例

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


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

示例1: AsyncOperation

 /// <summary>
 ///     Constructor. Protected to avoid unwitting usage - AsyncOperation objects
 ///     are typically created by AsyncOperationManager calling CreateOperation.
 /// </summary>
 private AsyncOperation(object userSuppliedState, SynchronizationContext syncContext)
 {
     _userSuppliedState = userSuppliedState;
     _syncContext = syncContext;
     _alreadyCompleted = false;
     _syncContext.OperationStarted();
 }
开发者ID:jsalvadorp,项目名称:corefx,代码行数:11,代码来源:AsyncOperation.cs

示例2: AsyncOperation

		internal AsyncOperation (SynchronizationContext ctx,
					 object state)
		{
			this.ctx = ctx;
			this.state = state;

			ctx.OperationStarted ();
		}
开发者ID:runefs,项目名称:Marvin,代码行数:8,代码来源:AsyncOperation.cs

示例3: AsyncOperation

 internal AsyncOperation(SynchronizationContext synchronizationContext, object userSuppliedState)
 {
     _synchronizationContext = synchronizationContext;
     _userSuppliedState = userSuppliedState;
     _synchronizationContext.OperationStarted();
 }
开发者ID:JaysonJG,项目名称:Catel,代码行数:6,代码来源:AsyncOperation.cs

示例4: Post

            public static void Post(SynchronizationContext synchronizationContext, SendOrPostCallback callback, object state)
            {
                Fx.Assert(synchronizationContext != null, "Null Sync Context");
                Fx.Assert(callback != null, "Null Callback");

                synchronizationContext.OperationStarted();
                synchronizationContext.Post(wrapperCallback, new PostCallbackState(synchronizationContext, callback, state));
            }
开发者ID:uQr,项目名称:referencesource,代码行数:8,代码来源:SynchronizationContextWorkflowSchedulerService.cs

示例5: UpdateDestinationFields

        /// <summary>
        /// Updates the destination fields.
        /// </summary>
        /// <param name="storedFields">The stored fields.</param>
        /// <param name="destinationFields">The destination fields.</param>
        /// <param name="syncContext">The synchronize context.</param>
        private static void UpdateDestinationFields(IList<IExpressionField> storedFields, IEnumerable<IExpressionField> destinationFields, SynchronizationContext syncContext)
        {
            var newDestinationFields = destinationFields.ToArray();

            foreach (var field in newDestinationFields)
            {
                var exField =
                    (from f in storedFields where ((DestinationField)f).SystemName == ((DestinationField)field).SystemName select f).FirstOrDefault();
                if (exField == null)
                {
                    storedFields.Add(field);
                }
                else
                {
                    //ensure that old script is updated
                    var exf = (DestinationField)exField;
                    var df = (DestinationField)field;
                    exf.SetName = df.SetName;
                    exf.Name = df.Name;
                    exf.InnerName = df.InnerName;
                    exf.SystemName = df.SystemName;
                    exf.DataType = df.DataType;
                    exf.SubfieldsRetriever = df.SubfieldsRetriever;
                    exf.IsKeyVisible = df.IsKeyVisible;
                    exf.IsKeyEnabled = df.IsKeyEnabled;
                    exf.IsKey = exf.IsKey && df.IsKeyEnabled;
                    exf.IsRequired = df.IsRequired;

                    exf.ConnectorIn.Name = df.ConnectorIn.Name;
                    exf.ConnectorIn.DataType = df.ConnectorIn.DataType;
                    exf.ConnectorIn.Validator = df.ConnectorIn.Validator != null ? df.ConnectorIn.Validator.Clone(exf.ConnectorIn) : null;
                    exf.ConnectorIn.IsNullable = df.ConnectorIn.IsNullable;

                    if (exField.Subfields.Count > 0 && field.SubfieldsRetriever != null)
                    {
                        syncContext.OperationStarted();
                        field.SubfieldsRetriever.BeginLoad(
                            exField,
                            (f, l) =>
                                {
                                    UpdateDestinationFields(exField.Subfields, l, syncContext);
                                    syncContext.OperationCompleted();
                                });
                    }
                    else
                    {
                        UpdateDestinationFields(exField.Subfields, field.Subfields, syncContext);
                    }
                }
            }

            for (var i = storedFields.Count - 1; i >= 0; --i)
            {
                var newField =
                    (from f in newDestinationFields where ((DestinationField)f).SystemName == ((DestinationField)storedFields[i]).SystemName select f)
                        .FirstOrDefault();

                if (newField == null)
                {
                    storedFields.RemoveAt(i);
                }
            }
        }
开发者ID:mparsin,项目名称:Elements,代码行数:69,代码来源:ExpressionDesignerWindowBase.cs


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