public void Dispose(ServiceKey key) { var service = _services[key]; service.Dispose(); _services.Remove(key); }
public IEventStream CreateFor(ServiceKey service) { //if (_flutterEventChannel == null) Android.Util.Log.WriteLine(Android.Util.LogPriority.Info, "Vistian.Flutter.Remoting.Droid.Example", $"Creating Event Channel - {GetEventChannelName(service)}"); var flutterEventChannel = new EventChannel(_messenger, GetEventChannelName(service)); var eventStream = new FlutterEventStream(flutterEventChannel); Android.Util.Log.WriteLine(Android.Util.LogPriority.Info, "Vistian.Flutter.Remoting.Droid.Example", $"Complete Event Channel - {GetEventChannelName(service)}"); return(eventStream); }
public static ObservableNotificationMessage FromNotification <T>(ServiceKey service, Notification <T> notification) { var on = new ObservableNotificationMessage { Kind = _map[notification.Kind] }; switch (@on.Kind) { case NotificationKind.OnData: @on.Value = JsonConvert.SerializeObject(notification.Value); break; case NotificationKind.OnError: @on.Exception = notification.Exception.Message; break; } on.Service = service; return(on); }
public static ServiceKey CreateKeyFor(ServiceInstance container, string method) { return(ServiceKey.Create($"{container.Key}_{method}")); }
public ObservableServiceInstance(ClassServiceInstance container, ObservableProxy observableProxy, ServiceKey key) : base(container, key) { ObservableProxy = observableProxy; }
protected ServiceInstance(ServiceInstance container, ServiceKey key) { Container = container; Key = key; }
private string GetEventChannelName(ServiceKey service) { return($"{service.Value}/events"); }
public ClassServiceInstance(object instance) : base(null, ServiceKey.Create(instance.GetType().FullName)) { Instance = instance; }
public ServiceInstance this[ServiceKey key] => _services[key];
public T Get <T>(ServiceKey key) where T : ServiceInstance { var instance = _services[key]; return(instance is T ? (T)instance : null); }