本文整理汇总了C#中WorkItemState类的典型用法代码示例。如果您正苦于以下问题:C# WorkItemState类的具体用法?C# WorkItemState怎么用?C# WorkItemState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkItemState类属于命名空间,在下文中一共展示了WorkItemState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1:
public EmsWorkItem
(
decimal id,
int externalEntityId,
WorkItemState workItemState,
SubmissionPriority submissionPriority,
byte[] messageBody,
bool assigned,
bool isRetry,
string ownerName,
ContextIdentifier contextIdentifier,
EmsReaderQueue queue,
Message message
)
: base
(
id,
externalEntityId,
workItemState,
submissionPriority,
messageBody,
assigned,
isRetry,
ownerName,
contextIdentifier
)
{
this.queue = queue;
this.message = message;
}
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:30,代码来源:EmsWorkItem.cs
示例2: WorkItem
/// <summary>
/// Construct a WorkItem for a particular test.
/// </summary>
/// <param name="test">The test that the WorkItem will run</param>
/// <param name="context">The TestExecutionContext in which it will run</param>
public WorkItem(Test test, TestExecutionContext context)
{
_test = test;
_testResult = test.MakeTestResult();
_state = WorkItemState.Ready;
_context = context;
}
开发者ID:haf,项目名称:nunit-framework,代码行数:12,代码来源:WorkItem.cs
示例3:
public ResponseWorkItem
(
long id,
int externalEntityId,
WorkItemState workItemState,
SubmissionPriority submissionPriority,
byte[] messageBody,
bool assigned,
bool isRetry,
string ownerName,
ContextIdentifier contextIdentifier
)
: base
(
id,
externalEntityId,
workItemState,
submissionPriority,
messageBody,
assigned,
isRetry,
ownerName,
contextIdentifier
)
{
}
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:26,代码来源:ResponseWorkItem.cs
示例4: GetDescription
public static string GetDescription(WorkItemState state)
{
string desc = (isJa) ? "�쐬�ς�" : "Created";
switch (state)
{
case WorkItemState.Created:
desc = (isJa) ? "�쐬�ς�" : "Created";
break;
case WorkItemState.Scheduled:
desc = (isJa) ? "�X�P�W���[���ς�" : "Scheduled";
break;
case WorkItemState.Queued:
desc = (isJa) ? "���[�N�L���[" : "Queued";
break;
case WorkItemState.Running:
desc = (isJa) ? "���s��" : "Running";
break;
case WorkItemState.Failed:
desc = (isJa) ? "���s" : "Failed";
break;
case WorkItemState.Completed:
desc = (isJa) ? "����" : "Completed";
break;
default:
break;
}
return desc;
}
开发者ID:tchandrap-elephanttalk,项目名称:rmainte4,代码行数:28,代码来源:WorkItemState.cs
示例5: WorkItem
/// <summary>
/// Construct a WorkItem for a particular test.
/// </summary>
/// <param name="test">The test that the WorkItem will run</param>
public WorkItem(Test test, FinallyDelegate finallyDelegate)
{
_test = test;
testResult = test.MakeTestResult();
_state = WorkItemState.Ready;
finD = finallyDelegate;
}
开发者ID:alexanderkyte,项目名称:NUnitLite,代码行数:11,代码来源:WorkItem.cs
示例6: WorkItem
/// <summary>
/// Construct a WorkItem for a particular test.
/// </summary>
/// <param name="test">The test that the WorkItem will run</param>
/// <param name="context">The context to be used for running this test</param>
public WorkItem(Test test, TestExecutionContext context)
{
_test = test;
_context = context.Save();
testResult = test.MakeTestResult();
_command = test.GetTestCommand();
_state = WorkItemState.Ready;
}
开发者ID:pjcollins,项目名称:Andr.Unit,代码行数:13,代码来源:WorkItem.cs
示例7: IsValidStatesTransition
private static bool IsValidStatesTransition(WorkItemState currentState, WorkItemState nextState)
{
bool valid = false;
switch (currentState)
{
case WorkItemState.InQueue:
valid = (WorkItemState.InProgress == nextState) || (WorkItemState.Canceled == nextState);
break;
case WorkItemState.InProgress:
valid = (WorkItemState.Completed == nextState) || (WorkItemState.Canceled == nextState);
break;
case WorkItemState.Completed:
case WorkItemState.Canceled:
// Cannot be changed
break;
default:
// Unknown state
Debug.Assert(false);
break;
}
return valid;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:24,代码来源:WorkItem.cs
示例8: WorkItemStateChanged
/// <summary>
/// Invoked by an <see cref="IWorkItem"/> to inform a work queue that its <see cref="IWorkItem.State"/>
/// has changed.
/// </summary>
/// <param name="workItem">
/// The <see cref="IWorkItem"/> that has changed <see cref="IWorkItem.State"/>.
/// </param>
/// <param name="previousState">
/// One of the <see cref="WorkItemState"/> values indicating the previous state of the <paramref name="workItem"/>.
/// </param>
/// <remarks>
/// The <see cref="ChangedWorkItemState"/> event is raised by calling the
/// <see cref="OnChangedWorkItemState"/> method. Then the following actions are performed,
/// based on the new <see cref="IWorkItem.State"/> of <paramref name="workItem"/>:
/// <list type="table">
/// <listheader>
/// <term>State</term>
/// <description>Action</description>
/// </listheader>
/// <item>
/// <term><see cref="WorkItemState">Scheduled</see></term>
/// <description>Assign the <paramref name="workItem"/> to the <see cref="WorkerPool"/>.</description>
/// </item>
/// <item>
/// <term><see cref="WorkItemState">Running</see></term>
/// <description>Raise the <see cref="RunningWorkItem"/> event.</description>
/// </item>
/// <item>
/// <term><see cref="WorkItemState">Failing</see></term>
/// <description>Raise the <see cref="FailedWorkItem"/> event.</description>
/// </item>
/// <item>
/// <term><see cref="WorkItemState">Completed</see></term>
/// <description>Raise the <see cref="CompletedWorkItem"/> event and schedule the next work item in the queue.</description>
/// </item>
/// </list>
/// </remarks>
public void WorkItemStateChanged(IWorkItem workItem, WorkItemState previousState)
{
OnChangedWorkItemState(workItem, previousState);
switch (workItem.State)
{
case WorkItemState.Scheduled:
lock (this)
{
// Housekeeping chores.
++runningItems;
// Now start it.
WorkerPool.BeginWork(workItem);
}
break;
case WorkItemState.Running:
OnRunningWorkItem(workItem);
break;
case WorkItemState.Failing:
OnFailedWorkItem(workItem);
break;
case WorkItemState.Completed:
bool allDone = false;
lock (this)
{
--runningItems;
allDone = queue.Count == 0 && runningItems == 0;
}
// Tell the world that the workitem has completed.
OnCompletedWorkItem(workItem);
// Find some more work.
if (allDone)
{
// Wakeup.
OnAllWorkCompleted(EventArgs.Empty);
lock (completed)
{
Monitor.PulseAll(completed);
}
}
else
{
DoNextWorkItem();
}
break;
}
}
开发者ID:ssoju,项目名称:csharp-webaccessibility,代码行数:90,代码来源:WorkQueue.cs
示例9: WorkItemComplete
/// <summary>
/// Method called by the derived class when all work is complete
/// </summary>
protected void WorkItemComplete()
{
finD.Complete();
_state = WorkItemState.Complete;
if (Completed != null)
Completed(this, EventArgs.Empty);
}
开发者ID:alexanderkyte,项目名称:NUnitLite,代码行数:10,代码来源:WorkItem.cs
示例10: SetWorkItemState
/// <summary>
/// Sets the work item's state
/// </summary>
/// <param name="workItemState">The state to set the work item to</param>
private void SetWorkItemState(WorkItemState workItemState)
{
lock(this)
{
_workItemState = workItemState;
}
}
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:11,代码来源:WorkItem.cs
示例11: Initialize
internal void Initialize()
{
_workItemState = WorkItemState.InQueue;
_workItemCompleted = null;
_workItemCompletedRefCount = 0;
}
开发者ID:BookSwapSteve,项目名称:Exceptionless,代码行数:6,代码来源:WorkItem.cs
示例12: WorkItem
/// <summary>
/// Construct a WorkItem for a particular test.
/// </summary>
/// <param name="test">The test that the WorkItem will run</param>
public WorkItem(Test test)
{
_test = test;
Result = test.MakeTestResult();
_state = WorkItemState.Ready;
}
开发者ID:roboticai,项目名称:nunit,代码行数:10,代码来源:WorkItem.cs
示例13: RunTest
private void RunTest()
{
_context.CurrentTest = this.Test;
_context.CurrentResult = this.Result;
_context.Listener.TestStarted(this.Test);
_context.StartTime = DateTime.UtcNow;
_context.StartTicks = Stopwatch.GetTimestamp();
_context.EstablishExecutionEnvironment();
_state = WorkItemState.Running;
#if PORTABLE
PerformWork();
#else
try
{
PerformWork();
}
catch (ThreadAbortException)
{
//Result.SetResult(ResultState.Cancelled);
}
#endif
}
开发者ID:roboticai,项目名称:nunit,代码行数:23,代码来源:WorkItem.cs
示例14: SetWorkItemState
/// <summary>
/// Sets the work item's state
/// </summary>
/// <param name="workItemState">The state to set the work item to</param>
private void SetWorkItemState(WorkItemState workItemState)
{
lock (this)
{
if (IsValidStatesTransition(_workItemState, workItemState))
{
_workItemState = workItemState;
}
}
}
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:14,代码来源:WorkItem.cs
示例15: GetWorkItemState
private WorkItemState GetWorkItemState()
{
lock (this)
{
if (WorkItemState.Completed == _workItemState)
{
return _workItemState;
}
long nowTicks = DateTime.UtcNow.Ticks;
if (WorkItemState.Canceled != _workItemState && nowTicks > _expirationTime)
{
_workItemState = WorkItemState.Canceled;
}
if (WorkItemState.InProgress == _workItemState)
{
return _workItemState;
}
if (CanceledSmartThreadPool.IsCanceled || CanceledWorkItemsGroup.IsCanceled)
{
return WorkItemState.Canceled;
}
return _workItemState;
}
}
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:29,代码来源:WorkItem.cs
示例16: WorkItemComplete
/// <summary>
/// Method called by the derived class when all work is complete
/// </summary>
protected void WorkItemComplete()
{
_state = WorkItemState.Complete;
//long tickCount = Stopwatch.GetTimestamp() - Context.StartTicks;
//double seconds = (double)tickCount / Stopwatch.Frequency;
//Result.Duration = TimeSpan.FromSeconds(seconds);
Result.Duration = DateTime.Now - Context.StartTime;
// We add in the assert count from the context. If
// this item is for a test case, we are adding the
// test assert count to zero. If it's a fixture, we
// are adding in any asserts that were run in the
// fixture setup or teardown. Each context only
// counts the asserts taking place in that context.
// Each result accumulates the count from child
// results along with it's own asserts.
Result.AssertCount += Context.AssertCount;
_context.Listener.TestFinished(Result);
if (Completed != null)
Completed(this, EventArgs.Empty);
}
开发者ID:haf,项目名称:nunit-framework,代码行数:28,代码来源:WorkItem.cs
示例17: ChangedWorkItemStateEventArgs
/// <summary>
/// Initialise a new instance of the <see cref="ChangedWorkItemStateEventArgs"/> class with the
/// specified <see cref="IWorkItem"/> and <see cref="WorkItemState">previous state</see>.
/// </summary>
/// <param name="workItem">
/// The <see cref="IWorkItem"/> associated with the event.
/// </param>
/// <param name="previousState">
/// One of the <see cref="WorkItemState"/> values indicating the previous state of the
/// <paramref name="workItem"/>.
/// </param>
/// <remarks>
/// Use this constructor to create and initialize a new instance of the <see cref="ChangedWorkItemStateEventArgs"/>
/// with the specified <paramref name="workItem"/> and <paramref name="previousState"/>.
/// </remarks>
public ChangedWorkItemStateEventArgs(IWorkItem workItem, WorkItemState previousState)
: base(workItem)
{
this.previousState = previousState;
}
开发者ID:ssoju,项目名称:csharp-webaccessibility,代码行数:20,代码来源:ChangedWorkItemStateEvent.cs
示例18: DoNothing
private void DoNothing(WorkItemState state)
{
WorkItemState workItemState = (WorkItemState)state;
_workingStates.Add(workItemState.QueueUsageEntry, workItemState.QueueUsageEntry);
do
{
if (SmartThreadPool.IsWorkItemCanceled)
{
break;
}
Stopwatch stopwatch = Stopwatch.StartNew();
//while (stopwatch.ElapsedMilliseconds < workItemState.SleepDuration);
Thread.Sleep(workItemState.SleepDuration);
} while (_paused);
_workingStates.Remove(workItemState.QueueUsageEntry);
//return null;
}
开发者ID:mlabs-pl,项目名称:stp,代码行数:18,代码来源:Form1.cs
示例19: WorkItem
public WorkItem(WaitCallback callback, object state)
{
_callback = callback;
_state = state;
_workItemState = WorkItemState.InQueue;
}
开发者ID:Boreeas,项目名称:LoLNotes,代码行数:6,代码来源:WorkItem.cs
示例20: Initialize
internal void Initialize()
{
// The _workItemState is changed directly instead of using the SetWorkItemState
// method since we don't want to go throught IsValidStateTransition.
_workItemState = WorkItemState.InQueue;
_workItemCompleted = null;
_workItemCompletedRefCount = 0;
}
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:9,代码来源:WorkItem.cs
注:本文中的WorkItemState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论