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


C# WorkItemState类代码示例

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


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


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