コード例 #1
0
        internal static async Task <GeoLocationAPI> Instance()
        {
            var proxy = new GeoLocationAPI();
            await proxy.Initialize();

            return(proxy);
        }
コード例 #2
0
ファイル: GeoLocationAPI.cs プロジェクト: swipswaps/WebSharp
        /// <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);
        }