Exemple #1
0
        private async Task Initialize()
        {
            if (scriptProxy == null)
            {
                scriptProxy = new DOMObjectProxy("navigator.geolocation");
            }

            await scriptProxy.GetProxyObject();

            ScriptObjectProxy = scriptProxy;
        }
Exemple #2
0
        /// <summary>
        /// Obtain a reference to the navigatior.geolocation JavaScript object
        /// </summary>
        /// <returns></returns>
        public static async Task <GeoLocationAPI> Instance()
        {
            if (instance == null)
            {
                // Create a new GeoLocationAPI proxy object
                instance = new GeoLocationAPI();

                // Create a proxy object of the navigator.geolocation
                // JavaScript object
                var scriptProxy = new DOMObjectProxy("navigator.geolocation");

                // Initialize the proxy object.  This will compile the code
                // to access the native bridge.
                await scriptProxy.GetProxyObject();

                // Tell our GeoLocationAPI instance to use the bridge proxy
                instance.ScriptObjectProxy = scriptProxy;
            }
            return(instance);
        }