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); }
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); }
internal MarkerClustering(JsObjectRef jsObjectRef, Map map, IEnumerable <Marker> markers) { _jsObjectRef = jsObjectRef; _map = map; _originalMarkers = markers; EventListeners = new Dictionary <string, List <MapEventListener> >(); }
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)); }
/// <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); }
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); }
/// <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); }
/// <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); }
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); }
/// <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); }
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); }
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); }
/// <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); }
/// <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); }
/// <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); }
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); }
/// <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); }
private Circle(JsObjectRef jsObjectRef, CircleOptions opts = null) { _jsObjectRef = jsObjectRef; if (opts != null) { _map = opts.Map; } }
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)); }
/// <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; } }
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))); }
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); }
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)); }
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); }
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(); }
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); }
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); }
/// <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); }
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); }
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; }