• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IWorkItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: EnqueueCore

 protected override void EnqueueCore(IWorkItem item)
 {
     lock (_locker)
     {
         _taskQueue.Enqueue(item);
         if (_consumersWaiting > 0)
         {
             Monitor.PulseAll(_locker);
         }
     }
 }
开发者ID:GSerjo,项目名称:CodeProject,代码行数:11,代码来源:DefaultTaskQueueController.cs


示例17: Setup

        public bool Setup(string serverType, string bootstrapUri, string assemblyImportRoot, IServerConfig config, ProviderFactoryInfo[] factories)
        {
            m_AssemblyImporter = new AssemblyImport(assemblyImportRoot);

            var serviceType = Type.GetType(serverType);
            m_AppServer = (IWorkItem)Activator.CreateInstance(serviceType);

            var bootstrap = (IBootstrap)Activator.GetObject(typeof(IBootstrap), bootstrapUri);

            return m_AppServer.Setup(bootstrap, config, factories);
        }
开发者ID:hjlfmy,项目名称:SuperSocket,代码行数:11,代码来源:WorkItemAgent.cs


示例18: RunWorkItemTask

 private static void RunWorkItemTask(IWorkItem todo, TaskScheduler sched)
 {
     try
     {
         RuntimeContext.SetExecutionContext(todo.SchedulingContext, sched);
         todo.Execute();
     }
     finally
     {
         RuntimeContext.ResetExecutionContext();
     }
 }
开发者ID:Rejendo,项目名称:orleans,代码行数:12,代码来源:TaskSchedulerUtils.cs


示例19: PerformanceMonitor

        public PerformanceMonitor(IRootConfig config, IEnumerable<IWorkItem> appServers, IWorkItem serverManager, ILogFactory logFactory)
        {
            m_PerfLog = logFactory.GetLog("Performance");

            m_AppServers = appServers.ToArray();

            m_ServerManager = serverManager;

            m_Helper = new ProcessPerformanceCounterHelper(Process.GetCurrentProcess());

            m_TimerInterval = config.PerformanceDataCollectInterval * 1000;
            m_PerformanceTimer = new Timer(OnPerformanceTimerCallback);
        }
开发者ID:huodianyan,项目名称:SuperSocket,代码行数:13,代码来源:PerformanceMonitor.cs


示例20: Matches

        public override ScopeMatchResult Matches(IWorkItem item)
        {
            var res = new ScopeMatchResult();

            var trigger = this.FieldNames;

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

            res.AddRange(available);
            res.Success = trigger.All(t => available.Contains(t, StringComparer.OrdinalIgnoreCase));

            return res;
        }
开发者ID:veredflis,项目名称:tfsaggregator,代码行数:14,代码来源:HasFieldsScope.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWorkItemResult类代码示例发布时间:2022-05-24
下一篇:
C# IWorkContextAccessor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap