2015-09-28 64 views

回答

1

確定這裏是缺少的故事,是不是在說我已經找到了MS DOCO .. 例如https://msdn.microsoft.com/en-us/library/dd647551(v=vs.120).aspx

雖然MS文檔中,INOUT出ARGS其範圍不共享...即

錯誤的世界觀

像MyBoolInOut INOUT XAML參數是相同的參數,在C#代碼正在使用,例如

public InOutArgument MyBoolInOut {get;組; }

所以你只需要改變在C#代碼值更改TFS XAML值

的這種處理 自定義代碼活動變量都在XAML可見,但有不同的正確看待XAML參數。即

如下,你的C#codeactivity ARGS必須手動連接到XAML ARGS

因此,即使XAML具有參數和C#有爭論,這是分開的。

這是MS可以大大提高其在DOCO的區域。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Activities; 
using Microsoft.TeamFoundation.Build.Client; 
using Microsoft.TeamFoundation.Client; 
using Microsoft.TeamFoundation.TestManagement.Client; 
using Microsoft.TeamFoundation.Build.Workflow.Activities; 

namespace SampleActivityLibrary 
{ 
     [BuildActivity(HostEnvironmentOption.All)] 

     // Sample Acitivty that will Flip a bool from True to False or from False to True 
     public sealed class SampleFlipInOutBoolean : CodeActivity<Boolean> 
     { 
      public InOutArgument<Boolean> MyBoolInOut { get; set; } 

      protected override Boolean Execute(CodeActivityContext context) 
      { 
       Boolean MyBool = context.GetValue(MyBoolInOut); 
       context.TrackBuildWarning("SampleFlipInOutBoolean: In Value of Bool: " + MyBool.ToString(), BuildMessageImportance.High); 

       MyBoolInOut.Set(context, !MyBool); 
       MyBool = context.GetValue(MyBoolInOut); 
       context.TrackBuildWarning("SampleFlipInOutBoolean: Out Value of Bool: " + MyBool.ToString(), BuildMessageImportance.High); 

       return MyBool; 

      } 
     } 
} 

enter image description here

相關問題