本文整理汇总了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();
}
示例2: AsyncOperation
internal AsyncOperation (SynchronizationContext ctx,
object state)
{
this.ctx = ctx;
this.state = state;
ctx.OperationStarted ();
}
示例3: AsyncOperation
internal AsyncOperation(SynchronizationContext synchronizationContext, object userSuppliedState)
{
_synchronizationContext = synchronizationContext;
_userSuppliedState = userSuppliedState;
_synchronizationContext.OperationStarted();
}
示例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));
}
示例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);
}
}
}