Exemple #1
0
        /// <summary>
        /// Creates a new named browsing context as child of the given parent.
        /// </summary>
        /// <param name="name">The name of the child context, if any.</param>
        /// <param name="security">The security flags to apply.</param>
        /// <returns></returns>
        public IBrowsingContext CreateChild(String?name, Sandboxes security)
        {
            var context = new BrowsingContext(this, security);

            if (name is { Length : > 0 })
 /// <summary>
 /// Opens a new document loaded from the specified request
 /// asynchronously in the given context.
 /// </summary>
 /// <param name="context">The browsing context to use.</param>
 /// <param name="request">The request to issue.</param>
 /// <param name="cancel">The cancellation token.</param>
 /// <returns>The task that creates the document.</returns>
 public static Task <IDocument> OpenAsync(this IBrowsingContext context, DocumentRequest request, CancellationToken cancel = default)
 {
     request = request ?? throw new ArgumentNullException(nameof(request));
     context = context ?? BrowsingContext.New();
     return(context.NavigateToAsync(request, cancel));
 }