Пример #1
0
        /// <summary>
        /// loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. If the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.
        /// </summary>
        /// <param name="url">URL of the resource to be loaded. This can be a path or URL to an HTML page, image file, or any other resource which is supported by the browser. If the empty string ("") is specified as url, a blank page is opened into the targeted browsing context.</param>
        /// <param name="windowName">the name of the browsing context (window, <iframe> or tab) into which to load the specified resource; if the name doesn't indicate an existing context, a new window is created and is given the name specified by windowName.</param>
        /// <param name="windowFeature">comma-separated list of window features given with their corresponding values in the form "name=value". These features include options such as the window's default size and position, whether or not to include scroll bars, and so forth. There must be no whitespace in the string.</param>
        /// <returns></returns>
        public async Task <WindowInterop> Open(string url, string windowName = null, WindowFeature windowFeature = null)
        {
            var windowOpenRef = await jsRuntime.InvokeInstanceMethodGetRefAsync(JsRuntimeObjectRef, "open", url, windowName, windowFeature?.GetOpenString());

            var windowInterop = await jsRuntime.GetInstanceContent <WindowInterop>(windowOpenRef, false);

            windowInterop.SetJsRuntime(jsRuntime, windowOpenRef);
            return(windowInterop);
        }
Пример #2
0
        /// <summary>
        /// loads the specified resource into the browsing context (window, &lt;iframe&gt; or tab) with the specified name. If the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.
        /// </summary>
        /// <param name="url">URL of the resource to be loaded. This can be a path or URL to an HTML page, image file, or any other resource which is supported by the browser. If the empty string ("") is specified as url, a blank page is opened into the targeted browsing context.</param>
        /// <param name="windowName">the name of the browsing context (window,  &lt;iframe&gt; or tab) into which to load the specified resource; if the name doesn't indicate an existing context, a new window is created and is given the name specified by windowName.</param>
        /// <param name="windowFeature">comma-separated list of window features given with their corresponding values in the form "name=value". These features include options such as the window's default size and position, whether or not to include scroll bars, and so forth. There must be no whitespace in the string.</param>
        /// <returns></returns>
        public async ValueTask <WindowInterop> Open(Uri url, string windowName  = null,
                                                    WindowFeature windowFeature = null)
        {
            var windowOpenRef = await JsRuntime.InvokeInstanceMethodGetRef(JsObjectRef, "open", url, windowName,
                                                                           windowFeature?.GetOpenString());

            var windowInterop = await JsRuntime.GetInstanceContent <WindowInterop>(windowOpenRef, SerializationSpec);

            windowInterop.SetJsRuntime(JsRuntime, windowOpenRef);
            return(windowInterop);
        }