WorkflowView.GetService(Type) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
가능한 경우, 지정된 형식의 서비스 개체를 가져옵니다.
protected:
override System::Object ^ GetService(Type ^ serviceType);
protected override object GetService (Type serviceType);
override this.GetService : Type -> obj
Protected Overrides Function GetService (serviceType As Type) As Object
매개 변수
반환
serviceType
이 typeof(
CommandID)
일 경우 GetService
가 관련 CommandID를 반환합니다. 그렇지 않을 경우 GetService
는 요청된 서비스를 구현하는 Object를 반환하거나 서비스를 확인할 수 없는 경우 null 참조(Visual Basic에서는 Nothing
)를 반환합니다.
예제
다음 코드 예제에서는 GetService 개체의 WorkflowView 메서드를 사용하여 ISelectionService 인터페이스를 반환합니다. 서비스가 존재하는 경우 EnsureVisible 개체의 PrimarySelection
속성을 사용하여 ISelectionService을 호출해 현재 선택된 활동을 전달합니다.
public void FindSelection()
{
ISelectionService selectionService;
selectionService = ((IServiceProvider)this.workflowView).GetService(typeof(ISelectionService))
as ISelectionService;
if (selectionService != null)
this.workflowView.EnsureVisible(selectionService.PrimarySelection);
}
Public Sub FindSelection()
Dim selectionService As ISelectionService
selectionService = CType(CType(Me.workflowView, IServiceProvider).GetService(GetType(ISelectionService)), ISelectionService)
If selectionService IsNot Nothing Then
Me.workflowView.EnsureVisible(selectionService.PrimarySelection)
End If
End Sub
설명
GetService
는 요청된 서비스를 구현하는 Object를 반환하거나 서비스를 확인할 수 없는 경우 null 참조(Nothing
)를 반환합니다.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기