とにかく、IBuildDefinition
または他の関連する「サービス」からコレクションURIを取得することはできますか。
ビルドテンプレートのコレクションにカスタムパラメーターとしてURIを指定する必要がないようにしています。UITypeEditor
カスタムクラス内から(この場合は)プログラムで取得する方法を探しています。
ハードコーディングに頼らずにこれを照会する方法はありますか?ビルドプロセス自体(定義、コントローラー、エージェントなど)は、どのコレクションを処理しているかを知っているように見えますが、どうすればわかりますか?
更新:から継承している場合のサンプルコードは次のとおりですUITypeEditor
。次に、 :のTeamProjectCollection
プロパティにアクセスするだけです。VersionControlService
public class Editor : UITypeEditor
{
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (provider != null)
{
IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (service != null)
{
VersionControlServer vcs = provider.GetService(typeof(VersionControlServer)) as VersionControlServer;
// Do what you need to do with it here
}
}
return value;
}
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}