Partager via


IOpenDocumentService.OpenDocumentAsync Method

Definition

Overloads

OpenDocumentAsync(String, CancellationToken)

Opens document at the given local file path with the default editor for that document. If the path represents local file path of a remote file and can be converted to remote URI via ConvertLocalUriToRemoteUriAsync(Uri, CancellationToken), the remote file will be downloaded and opened.

OpenDocumentAsync(Uri, OpenDocumentOptions, CancellationToken)

Opens document at the given documentUri. If the document is already open, its document frame is activated and openDocumentOptions are applied. If the documentUri represents local file path of a remote file and can be converted to remote URI via ConvertLocalUriToRemoteUriAsync(Uri, CancellationToken), the remote file will be downloaded and opened. If the document is already open, openDocumentOptions are applied to that already open document instead (for example Selection).

OpenDocumentAsync(String, CancellationToken)

Opens document at the given local file path with the default editor for that document. If the path represents local file path of a remote file and can be converted to remote URI via ConvertLocalUriToRemoteUriAsync(Uri, CancellationToken), the remote file will be downloaded and opened.

public:
 System::Threading::Tasks::Task ^ OpenDocumentAsync(System::String ^ path, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task OpenDocumentAsync (string path, System.Threading.CancellationToken cancellationToken);
abstract member OpenDocumentAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function OpenDocumentAsync (path As String, cancellationToken As CancellationToken) As Task

Parameters

path
String

The local file path to the document to open. If the path represents local file path of a remote file and can be converted to remote URI via ConvertLocalUriToRemoteUriAsync(Uri, CancellationToken), the remote file will be downloaded and opened.

cancellationToken
CancellationToken

A cancellation token.

Returns

A task representing the opening of a document editor.

Applies to

OpenDocumentAsync(Uri, OpenDocumentOptions, CancellationToken)

Opens document at the given documentUri. If the document is already open, its document frame is activated and openDocumentOptions are applied. If the documentUri represents local file path of a remote file and can be converted to remote URI via ConvertLocalUriToRemoteUriAsync(Uri, CancellationToken), the remote file will be downloaded and opened. If the document is already open, openDocumentOptions are applied to that already open document instead (for example Selection).

public:
 System::Threading::Tasks::Task<System::String ^> ^ OpenDocumentAsync(Uri ^ documentUri, Microsoft::VisualStudio::RpcContracts::OpenDocument::OpenDocumentOptions ^ openDocumentOptions, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<string> OpenDocumentAsync (Uri documentUri, Microsoft.VisualStudio.RpcContracts.OpenDocument.OpenDocumentOptions openDocumentOptions, System.Threading.CancellationToken cancellationToken);
abstract member OpenDocumentAsync : Uri * Microsoft.VisualStudio.RpcContracts.OpenDocument.OpenDocumentOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function OpenDocumentAsync (documentUri As Uri, openDocumentOptions As OpenDocumentOptions, cancellationToken As CancellationToken) As Task(Of String)

Parameters

documentUri
Uri

The URI of the document to open.

openDocumentOptions
OpenDocumentOptions

Options defining how to open the document.

cancellationToken
CancellationToken

A cancellation token.

Returns

A document moniker of the window frame containing the opened document.

Remarks

This method is added in VS2019_8 update.

Applies to