private void ResetCurrentContext(ReactContext context) { if (_currentContext == context) { return; } _currentContext = context; if (_devSettings.IsHotModuleReplacementEnabled && context != null) { try { Log.Info(ReactConstants.Tag, "## DevSupportManager ## SourceUrl:[" + SourceUrl.ToString() + "]"); var uri = new Uri(SourceUrl); var path = uri.LocalPath.Substring(1); // strip initial slash in path var host = uri.Host; var port = uri.Port; context.GetJavaScriptModule <HMRClient>().enable("tizen", path, host, port); } catch (Exception ex) { HandleException(ex); } } }
private void ResetCurrentContext(ReactContext context) { if (_currentContext == context) { return; } _currentContext = context; if (_devSettings.IsHotModuleReplacementEnabled && context != null) { try { var uri = new Uri(SourceUrl); var path = uri.LocalPath.Substring(1); // strip initial slash in path var host = uri.Host; var port = uri.Port; context.GetJavaScriptModule <HMRClient>().enable("windows", path, host, port); } catch (Exception ex) { HandleException(ex); } } }
/// <summary> /// Called when the host receives the resume event. /// </summary> public void OnResume() { if (_rctEventEmitter == null) { _rctEventEmitter = _reactContext.GetJavaScriptModule <RCTEventEmitter>(); } ReactChoreographer.Instance.JavaScriptEventsCallback += ScheduleDispatcherSafe; }
/// <summary> /// Called when the host receives the resume event. /// </summary> public void OnResume() { DispatcherHelpers.AssertOnDispatcher(); if (_rctEventEmitter == null) { _rctEventEmitter = _reactContext.GetJavaScriptModule <RCTEventEmitter>(); } CompositionTarget.Rendering += ScheduleDispatch; }
private void OnOrientationChange(DisplayInformation sentDisplay, object e) { String orientationValue = ParseOrientation(sentDisplay.CurrentOrientation); if (RCTContext.HasActiveReactInstance) { RCTContext.GetJavaScriptModule <RCTDeviceEventEmitter>() .emit("orientationDidChange", new Dictionary <string, string>() { { "orientation", orientationValue } }); } }
public void downloadUpdate(JObject updatePackage, bool notifyProgress, IPromise promise) { Action downloadAction = async() => { try { updatePackage[CodePushConstants.BinaryModifiedTimeKey] = "" + await _codePush.GetBinaryResourcesModifiedTime(); await _codePush.UpdateManager.DownloadPackage( updatePackage, _codePush.AssetsBundleFileName, new Progress <HttpProgress>( (HttpProgress progress) => { if (!notifyProgress) { return; } var downloadProgress = new JObject() { { "totalBytes", progress.TotalBytesToReceive }, { "receivedBytes", progress.BytesReceived } }; _reactContext .GetJavaScriptModule <RCTDeviceEventEmitter>() .emit(CodePushConstants.DownloadProgressEventName, downloadProgress); } ) ); JObject newPackage = await _codePush.UpdateManager.GetPackage((string)updatePackage[CodePushConstants.PackageHashKey]); promise.Resolve(newPackage); } catch (InvalidDataException e) { CodePushUtils.Log(e.ToString()); SettingsManager.SaveFailedUpdate(updatePackage); promise.Reject(e); } catch (Exception e) { CodePushUtils.Log(e.ToString()); promise.Reject(e); } }; Context.RunOnNativeModulesQueueThread(downloadAction); }
private void OnBarcodeScanned(Result result) { var resultPoints = new JArray(); foreach (var point in result.ResultPoints) { resultPoints.Add(new JObject { { "x", point.X }, { "y", point.Y }, }); } var eventData = new JObject { { "bounds", resultPoints }, { "data", result.Text }, { "type", result.BarcodeFormat.GetName() }, }; _reactContext.GetJavaScriptModule <RCTDeviceEventEmitter>() .emit("CameraBarCodeReadWindows", eventData); }
public void SendEvent(string eventName, object data) { context.GetJavaScriptModule <RCTDeviceEventEmitter>().emit(eventName, data); }
private void OnBoundsChanged(ApplicationView sender, object args) { _reactContext.GetJavaScriptModule <RCTDeviceEventEmitter>() .emit("didUpdateDimensions", GetDimensions()); }
public static void sendEvent(ReactContext reactContext, string eventName, object data) { reactContext.GetJavaScriptModule <RCTDeviceEventEmitter>() .emit(eventName, data); }
private void OnBoundsChanged(object sender, SizeChangedEventArgs args) { _reactContext.GetJavaScriptModule <RCTDeviceEventEmitter>() .emit("didUpdateDimensions", GetDimensions()); }
/// <summary> /// Dispatch the event to the Javascript Module /// </summary> /// <param name="context">The current react context</param> /// <param name="data">The data to be sent with the event</param> public void Dispatch(ReactContext context, object data) { context.GetJavaScriptModule <RCTDeviceEventEmitter>().emit(this.EventName, data); }
/// <summary> /// Gets the instance of the <see cref="IJavaScriptModule"/> associated /// with the <see cref="IReactInstance"/>. /// </summary> /// <typeparam name="T">Type of JavaScript module.</typeparam> /// <returns>The JavaScript module instance.</returns> public T GetJavaScriptModule <T>() where T : IJavaScriptModule, new() { return(_reactContext.GetJavaScriptModule <T>()); }
private void ResetCurrentContext(ReactContext context) { if (_currentContext == context) { return; } _currentContext = context; if (_devSettings.IsHotModuleReplacementEnabled && context != null) { var uri = new Uri(SourceUrl); var path = uri.LocalPath.Substring(1); // strip initial slash in path var host = uri.Host; var port = uri.Port; context.GetJavaScriptModule<HMRClient>().enable("windows", path, host, port); } }
private void OnLanguageChange(CoreTextServicesManager sender, object args) { context.GetJavaScriptModule <RCTDeviceEventEmitter>() .emit("languagesDidChange", this.GetLanguageOutput()); }