コード例 #1
0
ファイル: MediaStream.cs プロジェクト: melihercan/WebRTCme
 private MediaStream(IJSRuntime jsRuntime, JsObjectRef jsObjectRef) : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListenerForObjectRef("addtrack", (s, e) => OnAddTrack?.Invoke(s, e),
                                        MediaStreamTrackEvent.Create);
     AddNativeEventListenerForObjectRef("removetrack", (s, e) => OnRemoveTrack?.Invoke(s, e),
                                        MediaStreamTrackEvent.Create);
 }
コード例 #2
0
        public async static Task <ImageMapType> CreateAsync(IJSRuntime jsRuntime, string baseUrlFormat, int minZoom, int maxZoom, string name, float opacity)
        {
            var    realUrl  = baseUrlFormat.Replace("{z}", "' + zoom + '").Replace("{x}", "' + coord.x + '").Replace("{y}", "' + coord.y + '");
            string initOpts = @"{
                'getTileUrl': (coord, zoom) => {
                            return '" + realUrl + @"'
                        },
                'tileSize': new google.maps.Size(256, 256),
                'maxZoom': " + maxZoom.ToString() + @",
                'minZoom': " + minZoom.ToString() + @",
                'opacity': " + opacity.ToString() + @",
                'name': '" + name + @"'
            }";

            //string initOpts = @"{
            //    'getTileUrl': (coord, zoom) => {
            //                return '" + baseUrl + @"' + zoom + '/' + coord.x + '/' + coord.y;
            //            },
            //    'tileSize': new google.maps.Size(256, 256),
            //    'maxZoom': " + maxZoom.ToString() + @",
            //    'minZoom': " + minZoom.ToString() + @",
            //    'opacity': " + opacity.ToString() + @",
            //    'name': '" + name + @"'
            //}";

            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.ImageMapType", initOpts);

            var to = new ImageMapType(jsObjectRef)
            {
                Name = name
            };

            return(to);
        }
コード例 #3
0
 internal MarkerClustering(JsObjectRef jsObjectRef, Map map, IEnumerable <Marker> markers)
 {
     _jsObjectRef     = jsObjectRef;
     _map             = map;
     _originalMarkers = markers;
     EventListeners   = new Dictionary <string, List <MapEventListener> >();
 }
コード例 #4
0
 private RTCIceTransport(IJSRuntime jsRuntime, JsObjectRef jsObjectRef) : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListener("gatheringstatechange", (s, e) => OnGatheringStateChange?.Invoke(s, e));
     AddNativeEventListener("selectedcandidatepairchange", (s, e) =>
                            OnSelectedCandidatePairChange?.Invoke(s, e));
     AddNativeEventListener("statechange", (s, e) => OnStateChange?.Invoke(s, e));
 }
コード例 #5
0
        /// <summary>
        /// Creates a DrawingManager that allows users to draw overlays on the map, and switch between the type of overlay to be drawn with a drawing control.
        /// </summary>
        public async static Task <DrawingManager> CreateAsync(IJSRuntime jsRuntime, DrawingManagerOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.drawing.DrawingManager", opts);

            var obj = new DrawingManager(jsObjectRef, opts);

            return(obj);
        }
コード例 #6
0
        public static async Task <DirectionsRenderer> CreateAsync(IJSRuntime jsRuntime, DirectionsRendererOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.DirectionsRenderer", opts);

            var obj = new DirectionsRenderer(jsObjectRef);

            return(obj);
        }
コード例 #7
0
        /// <summary>
        /// Creates an empty collection, with the given DataOptions.
        /// </summary>
        /// <param name="options"></param>
        public async static Task <MapData> CreateAsync(IJSRuntime jsRuntime, Data.DataOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.Data", opts);

            var obj = new MapData(jsObjectRef);

            return(obj);
        }
コード例 #8
0
        /// <summary>
        /// Creates an info window with the given options.
        /// An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options.
        /// Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened.
        /// After constructing an InfoWindow, you must call open to display it on the map.
        /// The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect.
        /// </summary>
        /// <param name="opts"></param>
        public async static Task <InfoWindow> CreateAsync(IJSRuntime jsRuntime, InfoWindowOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.InfoWindow", opts);

            var obj = new InfoWindow(jsObjectRef, opts);

            return(obj);
        }
コード例 #9
0
        public async static Task <GroundOverlay> CreateAsync(IJSRuntime jsRuntime, string url, LatLngBoundsLiteral bounds, GroundOverlayOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.GroundOverlay", url, bounds, opts);

            var obj = new GroundOverlay(jsObjectRef);

            return(obj);
        }
コード例 #10
0
ファイル: Polygon.cs プロジェクト: emiliszrc/TAVISfe
        /// <summary>
        /// Create a polygon using the passed PolygonOptions, which specify the polygon's path, the stroke style for the polygon's edges, and the fill style for the polygon's interior regions.
        /// A polygon may contain one or more paths, where each path consists of an array of LatLngs.
        /// </summary>
        /// <param name="opts"></param>
        public async static Task <Polygon> CreateAsync(IJSRuntime jsRuntime, PolygonOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.Polygon", opts);

            var obj = new Polygon(jsObjectRef, opts);

            return(obj);
        }
コード例 #11
0
        public async static Task <AutocompleteService> CreateAsync(IJSRuntime jsRuntime, MarkerOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.places.AutocompleteService", opts);

            var obj = new AutocompleteService(jsObjectRef);

            return(obj);
        }
コード例 #12
0
ファイル: Marker.cs プロジェクト: rezasfl/BlazorGoogleMaps
        public async static Task <Marker> CreateAsync(IJSRuntime jsRuntime, MarkerOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.Marker", opts);

            var obj = new Marker(jsObjectRef);

            return(obj);
        }
コード例 #13
0
ファイル: Circle.cs プロジェクト: willapp/BlazorGoogleMaps
        /// <summary>
        /// Create a circle using the passed CircleOptions, which specify the center, radius, and style.
        /// </summary>
        /// <param name="opts"></param>
        public async static Task <Circle> CreateAsync(IJSRuntime jsRuntime, CircleOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.Circle", opts);

            var obj = new Circle(jsObjectRef, opts);

            return(obj);
        }
コード例 #14
0
        /// <summary>
        /// Creates a new instance of HeatmapLayer.
        /// </summary>
        /// <param name="opts"></param>
        public async static Task <HeatmapLayer> CreateAsync(IJSRuntime jsRuntime, HeatmapLayerOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.visualization.HeatmapLayer", opts);

            var obj = new HeatmapLayer(jsObjectRef, opts);

            return(obj);
        }
コード例 #15
0
        /// <summary>
        /// Creates a new instance of a DirectionsService that sends directions queries to Google servers.
        /// </summary>
        public async static Task <DirectionsService> CreateAsync(IJSRuntime jsRuntime)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.DirectionsService");

            var obj = new DirectionsService(jsObjectRef);

            return(obj);
        }
コード例 #16
0
ファイル: Autocomplete.cs プロジェクト: emiliszrc/TAVISfe
        public async static Task <Autocomplete> CreateAsync(IJSRuntime jsRuntime, ElementReference inputField, AutocompleteOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.places.Autocomplete", inputField, opts);

            var obj = new Autocomplete(jsObjectRef);

            return(obj);
        }
コード例 #17
0
        /// <summary>
        /// Constructs a new empty bounds
        /// </summary>
        public async static Task <LatLngBounds> CreateAsync(IJSRuntime jsRuntime)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.LatLngBounds");

            var obj = new LatLngBounds(jsObjectRef);

            return(obj);
        }
コード例 #18
0
ファイル: Circle.cs プロジェクト: willapp/BlazorGoogleMaps
        private Circle(JsObjectRef jsObjectRef, CircleOptions opts = null)
        {
            _jsObjectRef = jsObjectRef;

            if (opts != null)
            {
                _map = opts.Map;
            }
        }
コード例 #19
0
ファイル: RTCDataChannel.cs プロジェクト: melihercan/WebRTCme
 private RTCDataChannel(IJSRuntime jsRuntime, JsObjectRef jsObjectRef) : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListener("bufferedamountlow", (s, e) => OnBufferedAmountLow?.Invoke(s, e));
     AddNativeEventListener("close", (s, e) => OnClose?.Invoke(s, e));
     AddNativeEventListener("closing", (s, e) => OnClosing?.Invoke(s, e));
     AddNativeEventListenerForObjectRef("error", (s, e) => OnError?.Invoke(s, e), ErrorEvent.Create);
     AddNativeEventListenerForObjectRef("message", (s, e) => OnMessage?.Invoke(s, e), MessageEvent.Create);
     AddNativeEventListener("open", (s, e) => OnOpen?.Invoke(s, e));
 }
コード例 #20
0
        /// <summary>
        /// Creates a DrawingManager that allows users to draw overlays on the map, and switch between the type of overlay to be drawn with a drawing control.
        /// </summary>
        private DrawingManager(JsObjectRef jsObjectRef, DrawingManagerOptions opt = null)
        {
            _jsObjectRef = jsObjectRef;

            if (opt?.Map != null)
            {
                _map = opt.Map;
            }
        }
コード例 #21
0
        public static IDisposable AddJsEventListener(this IJSRuntime jsRuntime,
                                                     JsObjectRef jsObjectRef, string property, string event_, JsEventHandler callBack)
        {
            var listenerId = jsRuntime.Invoke <int>("JsInterop.addEventListener", jsObjectRef,
                                                    property, event_, callBack);

            return(new DisposableAction(() =>
                                        jsRuntime.InvokeVoid("JsInterop.removeEventListener", jsObjectRef, property,
                                                             event_, listenerId)));
        }
コード例 #22
0
        public static async Task <MarkerClustering> CreateAsync(IJSRuntime jsRuntime, Map map, IEnumerable <Marker> markers)
        {
            var guid        = System.Guid.NewGuid();
            var jsObjectRef = new JsObjectRef(jsRuntime, guid);
            await jsRuntime.InvokeVoidAsync("googleMapsObjectManager.addClusteringMarkers", guid.ToString(), map.Guid.ToString(), markers);

            var obj = new MarkerClustering(jsObjectRef);

            return(obj);
        }
コード例 #23
0
ファイル: MediaRecorder.cs プロジェクト: melihercan/WebRTCme
 private MediaRecorder(IJSRuntime jsRuntime, JsObjectRef jsObjectRef, IMediaStream stream,
                       MediaRecorderOptions options) : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListenerForObjectRef("dataavailable", (s, e) => OnDataAvailable?.Invoke(s, e),
                                        BlobEvent.Create);
     AddNativeEventListenerForObjectRef("error", (s, e) => OnError?.Invoke(s, e),
                                        DOMException.Create);
     AddNativeEventListener("pause", (s, e) => OnPause?.Invoke(s, e));
     AddNativeEventListener("resume", (s, e) => OnResume?.Invoke(s, e));
     AddNativeEventListener("start", (s, e) => OnStart?.Invoke(s, e));
     AddNativeEventListener("stop", (s, e) => OnStop?.Invoke(s, e));
 }
コード例 #24
0
        public virtual async Task <MapEventListener> AddListener <V>(string eventName, Action <V> handler)
        {
            JsObjectRef listenerRef = await _jsObjectRef.InvokeWithReturnedObjectRefAsync("addListener", eventName, handler);

            MapEventListener eventListener = new MapEventListener(listenerRef);

            if (!EventListeners.ContainsKey(eventName))
            {
                EventListeners.Add(eventName, new List <MapEventListener>());
            }
            EventListeners[eventName].Add(eventListener);

            return(eventListener);
        }
コード例 #25
0
        public MediaRecorderBlobFileStream(string fileName, MediaRecorderOptions mediaRecorderOptions,
                                           IJSRuntime jsRuntime)
        {
            _fileName             = fileName;
            _mediaRecorderOptions = mediaRecorderOptions;
            _jsRuntime            = jsRuntime;

            _streamSaverJsObjectRef     = jsRuntime.GetJsPropertyObjectRef("window", "streamSaver");
            _writeableStreamJsObjectRef = jsRuntime.CallJsMethod <JsObjectRef>(
                _streamSaverJsObjectRef, "createWriteStream", fileName);
            _writerJsObjectRef = jsRuntime.CallJsMethod <JsObjectRef>(_writeableStreamJsObjectRef, "getWriter");

            Initialization = InitAsync();
        }
コード例 #26
0
 private RTCPeerConnection(IJSRuntime jsRuntime, JsObjectRef jsObjectRef, RTCConfiguration rtcConfiguration)
     : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListener("connectionstatechange", (s, e) => OnConnectionStateChanged?.Invoke(s, e));
     AddNativeEventListenerForObjectRef("datachannel", (s, e) => OnDataChannel?.Invoke(s, e),
                                        RTCDataChannelEvent.Create);
     AddNativeEventListenerForObjectRef("icecandidate", (s, e) => OnIceCandidate?.Invoke(s, e),
                                        RTCPeerConnectionIceEvent.Create);
     AddNativeEventListener("iceconnectionstatechange", (s, e) => OnIceConnectionStateChange?.Invoke(s, e));
     AddNativeEventListener("icegatheringstatechange", (s, e) => OnIceGatheringStateChange?.Invoke(s, e));
     AddNativeEventListener("negotiationneeded", (s, e) => OnNegotiationNeeded?.Invoke(s, e));
     AddNativeEventListener("signallingstatechange", (s, e) => OnSignallingStateChange?.Invoke(s, e));
     AddNativeEventListenerForObjectRef("track", (s, e) => OnTrack?.Invoke(s, e),
                                        RTCTrackEvent.Create);
 }
コード例 #27
0
        public static async Task <Map> CreateAsync(
            IJSRuntime jsRuntime,
            ElementReference mapDiv,
            MapOptions opts = null)
        {
            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.Map", mapDiv, opts);

            var dataObjectRef = await jsObjectRef.GetObjectReference("data");

            var data = new MapData(dataObjectRef);
            var map  = new Map(jsObjectRef, data);

            JsObjectRefInstances.Add(map);

            return(map);
        }
コード例 #28
0
        /// <summary>
        /// Create circles list
        /// </summary>
        /// <param name="jsRuntime"></param>
        /// <param name="opts">Dictionary of desired Circle keys and CircleOptions values. Key as any type unique key. Not nessary Guid</param>
        /// <returns>new instance of CircleList class will be returned with its Circles dictionary member populated with the corresponding results</returns>
        public static async Task <CircleList> CreateAsync(IJSRuntime jsRuntime, Dictionary <string, CircleOptions> opts)
        {
            JsObjectRef jsObjectRef = new JsObjectRef(jsRuntime, Guid.NewGuid());

            CircleList obj;
            Dictionary <string, JsObjectRef> jsObjectRefs = await JsObjectRef.CreateMultipleAsync(
                jsRuntime,
                "google.maps.Circle",
                opts.ToDictionary(e => e.Key, e => (object)e.Value));

            Dictionary <string, Circle> objs = jsObjectRefs.ToDictionary(e => e.Key, e => new Circle(e.Value));

            obj = new CircleList(jsObjectRef, objs);

            return(obj);
        }
コード例 #29
0
        public static async Task <MarkerClustering> CreateAsync(
            IJSRuntime jsRuntime,
            Map map,
            IEnumerable <Marker> markers,
            MarkerClustererOptions?options = null
            )
        {
            options ??= new MarkerClustererOptions();

            var guid        = Guid.NewGuid();
            var jsObjectRef = new JsObjectRef(jsRuntime, guid);
            await jsRuntime.InvokeVoidAsync("googleMapsObjectManager.createClusteringMarkers", guid.ToString(), map.Guid.ToString(), markers, options);

            var obj = new MarkerClustering(jsObjectRef, map, markers);

            return(obj);
        }
コード例 #30
0
        public async Task AddOverlayCompleteListener(Action <OverlayCompleteEvent> action)
        {
            void Act(OverlaycompleteArgs args)
            {
                var completeEvent = new OverlayCompleteEvent();
                var reference     = new JsObjectRef(_jsObjectRef.JSRuntime, args.uuid);

                switch (args.type)
                {
                case "polygon":
                    completeEvent.Polygon = new Polygon(reference);
                    completeEvent.Type    = OverlayType.Polygon;
                    break;

                case "marker":
                    completeEvent.Marker = new Marker(reference);
                    completeEvent.Type   = OverlayType.Marker;
                    break;

                case "polyline":
                    completeEvent.Polyline = new Polyline(reference);
                    completeEvent.Type     = OverlayType.Polyline;
                    break;

                case "rectangle":
                    completeEvent.Rectangle = new Rectangle(reference);
                    completeEvent.Type      = OverlayType.Rectangle;
                    break;

                case "circle":
                    completeEvent.Circle = new Circle(reference);
                    completeEvent.Type   = OverlayType.Circle;
                    break;
                }

                action.Invoke(completeEvent);
            }

            await _jsObjectRef.JSRuntime.MyInvokeAsync("googleMapsObjectManager.drawingManagerOverlaycomplete",
                                                       new object[] { this._jsObjectRef.Guid.ToString(), (Action <OverlaycompleteArgs>)Act });

            return;
        }