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


C# IWorkItem类代码示例

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


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

示例1: Execute

        public IWorkResult Execute(IWorkItem workItem)
        {
            var workResult = new MatrixMultiplicationWorkResult();
            workResult.Success = false;

            try
            {
                var concreteWorkItem = workItem as MatrixMultiplicationWorkItem;

                if (concreteWorkItem != null)
                {
                    workResult.Result = concreteWorkItem.GridAValue * concreteWorkItem.GridBValue;
                    workResult.Success = true;
                }
                else
                {
                    workResult.Error = new ArgumentNullException(string.Concat("The workItem was either null or could not be cast to a instance of ", typeof(MatrixMultiplicationWorkItem).Name));
                }

            }
            catch (Exception e)
            {
                workResult.Error = e;
            }

            return workResult;
        }
开发者ID:bartsipes,项目名称:ElementSuite,代码行数:27,代码来源:MatrixMultiplicationCommand.cs

示例2: Matches

 public override ScopeMatchResult Matches(IWorkItem item)
 {
     var res = new ScopeMatchResult();
     res.Add(item.TypeName);
     res.Success = this.ApplicableTypes.Any(type => type.SameAs(item.TypeName));
     return res;
 }
开发者ID:veredflis,项目名称:tfsaggregator,代码行数:7,代码来源:WorkItemTypeScope.cs

示例3: MakeRepository

        private static WorkItemRepositoryMock MakeRepository(out IWorkItem startPoint)
        {
            var repository = new WorkItemRepositoryMock();

            var grandParent = new WorkItemMock(repository);
            grandParent.Id = 1;
            grandParent.TypeName = "Feature";

            var parent = new WorkItemMock(repository);
            parent.Id = 2;
            parent.TypeName = "Use Case";

            var firstChild = new WorkItemMock(repository);
            firstChild.Id = 3;
            firstChild.TypeName = "Task";
            var secondChild = new WorkItemMock(repository);
            secondChild.Id = 4;
            secondChild.TypeName = "Task";

            firstChild.WorkItemLinks.Add(new WorkItemLinkMock(WorkItemImplementationBase.ParentRelationship, parent.Id, repository));
            secondChild.WorkItemLinks.Add(new WorkItemLinkMock(WorkItemImplementationBase.ParentRelationship, parent.Id, repository));
            parent.WorkItemLinks.Add(new WorkItemLinkMock(WorkItemImplementationBase.ParentRelationship, grandParent.Id, repository));

            grandParent.WorkItemLinks.Add(new WorkItemLinkMock(WorkItemImplementationBase.ChildRelationship, parent.Id, repository));
            parent.WorkItemLinks.Add(new WorkItemLinkMock(WorkItemImplementationBase.ChildRelationship, firstChild.Id, repository));
            parent.WorkItemLinks.Add(new WorkItemLinkMock(WorkItemImplementationBase.ChildRelationship, secondChild.Id, repository));

            repository.SetWorkItems(new[] { grandParent, parent, firstChild, secondChild });

            startPoint = grandParent;
            return repository;
        }
开发者ID:veredflis,项目名称:tfsaggregator,代码行数:32,代码来源:NavigationTests.cs

示例4: WorkFailed

 /// <summary>
 /// Notification of failure
 /// </summary>
 /// <param name="workItem">Work item that failed</param>
 /// <param name="failureInfo">Failure information (usually exception)</param>
 public void WorkFailed( IWorkItem workItem, object failureInfo )
 {
     foreach ( IWorkItemProgressMonitor monitor in m_Monitors )
     {
         monitor.WorkFailed( workItem, failureInfo );
     }
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:12,代码来源:WorkItemProgressMonitorList.cs

示例5: WorkComplete

 /// <summary>
 /// Notification of work completion
 /// </summary>
 /// <param name="workItem">Work item that completed</param>
 public void WorkComplete( IWorkItem workItem )
 {
     foreach ( IWorkItemProgressMonitor monitor in m_Monitors )
     {
         monitor.WorkComplete( workItem );
     }
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:11,代码来源:WorkItemProgressMonitorList.cs

示例6: WorkComplete

 /// <summary>
 /// Notification of work completion
 /// </summary>
 /// <param name="workItem">Work item that completed</param>
 public void WorkComplete( IWorkItem workItem )
 {
     if ( m_WorkQueue.NumberOfWorkItemsInQueue == 0 )
     {
         Close( );
     }
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:11,代码来源:SplashScreenForm.cs

示例7: WorkerThreadWorkItemFinishedEventArgs

 /// <summary>
 /// İşçi Thread'i iş parçası işini bitirdi olay argümanları inşacı metodu.
 /// </summary>
 /// <param name="workItem">İş parçası nesnesi.</param>
 public WorkerThreadWorkItemFinishedEventArgs(IWorkItem workItem)
 {
     if (workItem == null)
     {
         throw new ArgumentNullException("workItem");
     }
     WorkItem = workItem;
 }
开发者ID:QuickOrBeDead,项目名称:Labo.Threading,代码行数:12,代码来源:WorkerThreadWorkItemFinishedEventArgs.cs

示例8: UpdateProgress

 /// <summary>
 /// Notification of progress in a work item
 /// </summary>
 /// <param name="workItem">Work item that has progressed</param>
 /// <param name="progress">Normalized progress</param>
 /// <returns>Returns true if the process should continue, false if the process should cancel.</returns>
 public bool UpdateProgress( IWorkItem workItem, float progress )
 {
     bool cancel = false;
     foreach ( IWorkItemProgressMonitor monitor in m_Monitors )
     {
         cancel |= !monitor.UpdateProgress( workItem, progress );
     }
     return !cancel;
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:15,代码来源:WorkItemProgressMonitorList.cs

示例9: Matches

        public override bool Matches(IWorkItem item)
        {
            var trigger = this.FieldNames;

            var fields = item.Fields.ToArray();
            var available = fields.Select(f => f.Name).Concat(fields.Select(f => f.ReferenceName));

            return trigger.All(t => available.Contains(t, StringComparer.OrdinalIgnoreCase));
        }
开发者ID:DEllingsworth,项目名称:tfsaggregator,代码行数:9,代码来源:HasFieldsScope.cs

示例10: MakeNewWorkItem

        public IWorkItem MakeNewWorkItem(IWorkItem inSameProjectAs, string workItemTypeName)
        {
            if (inSameProjectAs == null)
            {
                throw new ArgumentNullException(nameof(inSameProjectAs));
            }

            return this.MakeNewWorkItem(workItemTypeName, inSameProjectAs[CoreFieldReferenceNames.TeamProject] as string);
        }
开发者ID:veredflis,项目名称:tfsaggregator,代码行数:9,代码来源:WorkItemRepositoryMock.cs

示例11: WorkerThreadPoolEnqueuingNewWorkItemEventArgs

        /// <summary>
        /// İşçi Thread havuzu yeni bir iş parçasını iş parcası kuyruğuna sokuyor olay argümanları sınıfı inşacı metodu.
        /// </summary>
        /// <param name="workItem">İş parçası.</param>
        public WorkerThreadPoolEnqueuingNewWorkItemEventArgs(IWorkItem workItem)
        {
            if (workItem == null)
            {
                throw new ArgumentNullException("workItem");
            }

            m_WorkItem = workItem;
        }
开发者ID:QuickOrBeDead,项目名称:Labo.Threading,代码行数:13,代码来源:WorkerThreadPoolEnqueuingNewWorkItemEventArgs.cs

示例12: Add

    public void Add(IWorkItem item_)
    {
      if (item_ == null) return;

      lock (m_queue)
        m_queue.Enqueue(item_);

      m_autoResetEvent.Set();
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:9,代码来源:BackgroundWorker.cs

示例13: TransitionToState

        public static void TransitionToState(IWorkItem workItem, string state, string commentPrefix, ILogEvents logger)
        {
            // Set the sourceWorkItem's state so that it is clear that it has been moved.
            string originalState = (string)workItem.Fields["State"].Value;

            // Try to set the state of the source work item to the "Deleted/Moved" state (whatever is defined in the file).

            // We need an open work item to set the state
            workItem.TryOpen();

            // See if we can go directly to the planned state.
            workItem.Fields["State"].Value = state;

            if (workItem.Fields["State"].Status != FieldStatus.Valid)
            {
                // Revert back to the original value and start searching for a way to our "MovedState"
                workItem.Fields["State"].Value = workItem.Fields["State"].OriginalValue;

                // If we can't then try to go from the current state to another state.  Saving each time till we get to where we are going.
                foreach (string curState in FindNextState(workItem.Type, (string)workItem.Fields["State"].Value, state))
                {
                    string comment;
                    if (curState == state)
                    {
                        comment = string.Format(
                            "{0}{1}  State changed to {2}",
                            commentPrefix,
                            Environment.NewLine,
                            state);
                    }
                    else
                    {
                        comment = string.Format(
                            "{0}{1}  State changed to {2} as part of move toward a state of {3}",
                            commentPrefix,
                            Environment.NewLine,
                            curState,
                            state);
                    }

                    bool success = ChangeWorkItemState(workItem, originalState, curState, comment, logger);

                    // If we could not do the incremental state change then we are done.  We will have to go back to the original...
                    if (!success)
                    {
                        break;
                    }
                }
            }
            else
            {
                // Just save it off if we can.
                string comment = commentPrefix + "\n   State changed to " + state;
                ChangeWorkItemState(workItem, originalState, state, comment, logger);
            }
        }
开发者ID:veredflis,项目名称:tfsaggregator,代码行数:56,代码来源:StateWorkflow.cs

示例14: Enqueue

 public void Enqueue(IWorkItem item)
 {
     var priority = (int)item.Priority;
     if (priority >= _queues.Count)
     {
         throw new ArgumentException(string.Format("Invalid TaskItemPriority: {0}", item.Priority));
     }
     _queues[priority].Enqueue(item);
     _workItemCount++;
 }
开发者ID:blake2002,项目名称:Nelibur,代码行数:10,代码来源:PriorityTaskQueue.cs

示例15: EnqueueWorkItem

 /// <summary>
 /// Add a task object to the test queue.  For a test that is currently 
 /// executing, all tasks contained within the queue are executed to 
 /// completion (unless an Exception is thrown) -before- moving on to 
 /// the next test.
 /// 
 /// The test task queue replaces the PumpMessages(...) system that 
 /// permitted a single callback.  This enables specialized tasks, such 
 /// as DOM bridge tasks, sleep tasks, and conditional continue tasks.
 /// </summary>
 /// <param name="testTaskObject">Asynchronous test task 
 /// instance.</param>
 public virtual void EnqueueWorkItem(IWorkItem testTaskObject)
 {
     if (UnitTestHarness.DispatcherStack.CurrentCompositeWorkItem != null)
     {
         UnitTestHarness.DispatcherStack.CurrentCompositeWorkItem.Enqueue(testTaskObject);
     }
     else
     {
         throw new InvalidOperationException(Properties.UnitTestMessage.WorkItemTest_EnqueueWorkItem_AsynchronousFeatureUnavailable);
     }
 }
开发者ID:dfr0,项目名称:moon,代码行数:23,代码来源:WorkItemTest.cs


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