示例#1
0
        /// <summary>
        /// Creates a <see cref="IWebView" /> within the context of <paramref name="process" />.
        /// </summary>
        /// <param name="process">An instance of <see cref="WebViewControlProcess" />.</param>
        /// <param name="control">An instance of <see cref="Control"/> to parent the <see cref="WebView"/>.</param>
        /// <returns>An <see cref="IWebView"/> instance.</returns>
        /// <exception cref="ArgumentNullException">Occurs when <paramref name="control"/> is <see langword="null" />.</exception>
        internal static Task <IWebView> CreateWebViewAsync(
            this WebViewControlProcess process,
            Control control)
        {
            if (control == null)
            {
                throw new ArgumentNullException(nameof(control));
            }

            return(process.CreateWebViewAsync(control, control.Bounds));
        }
示例#2
0
        /// <summary>
        /// Creates a <see cref="IWebView" /> within the context of <paramref name="process" />.
        /// </summary>
        /// <param name="process">An instance of <see cref="WebViewControlProcess" />.</param>
        /// <param name="control">An instance of <see cref="Control"/> to parent the <see cref="WebView"/>.</param>
        /// <param name="bounds">A <see cref="Rectangle" /> containing numerical values that represent the location and size of the control.</param>
        /// <returns>An <see cref="IWebView"/> instance.</returns>
        /// <exception cref="ArgumentNullException">Occurs when <paramref name="control"/> is <see langword="null" />.</exception>
        internal static async Task <IWebView> CreateWebViewAsync(
            this WebViewControlProcess process,
            Control control,
            Rectangle bounds)
        {
            if (control == null)
            {
                throw new ArgumentNullException(nameof(control));
            }

            var webViewControl = await process.CreateWebViewAsync(control.Handle, bounds).ConfigureAwait(false);

            control.Controls.Add((Control)webViewControl);
            return(webViewControl);
        }