public LiveController( IMapper mapper, NotificationService notificator, IIdentityService identity, NotificationObserver observer ) { this.observer = observer; this.mapper = mapper; this.identity = identity; this.notificator = notificator; }
internal override HttpRequestMessageBuilder BuildRequest(HttpRequestMessageBuilder requestMessageBuilder) { foreach (var eventType in Events) { requestMessageBuilder.AddQueryParameter("events", eventType.value); } requestMessageBuilder.AddQueryParameter("prefix", Prefix); requestMessageBuilder.AddQueryParameter("suffix", Suffix); requestMessageBuilder.ResponseWriter = async responseStream => { using (responseStream) { var sr = new StreamReader(responseStream); while (!sr.EndOfStream) { try { var line = await sr.ReadLineAsync(); if (EnableTrace) { Console.WriteLine("== ListenBucketNotificationsAsync read line =="); Console.WriteLine(line); Console.WriteLine("=============================================="); } var trimmed = line.Trim(); if (trimmed.Length > 2) { NotificationObserver.OnNext(new MinioNotificationRaw(trimmed)); } } catch { break; } } } }; return(requestMessageBuilder); }
public static void postNotification(object scope, string name, Hashtable args) { // do not allow notifications from background threads if (PlanetUnityGameObject.IsMainThread() == false) { return; } if (name == null) { UnityEngine.Debug.Log("Warning: NotificationCenter.postNotification() called with null notification name"); return; } if (scope == null) { scope = globalScope; } if (name.StartsWith("GLOBAL::", StringComparison.OrdinalIgnoreCase)) { scope = globalScope; name = name.Substring(8); } List <NotificationObserver> list; if (observersByScope.TryGetValue(scope, out list)) { for (int i = 0; i < list.Count; i++) { NotificationObserver o = list [i]; if (o.name.Equals(name) || o.name.Equals("*")) { if (!o.callObserver(args, name)) { list.RemoveAt(i); i--; } } } } }
private static void addObserverPrivate(object observer, string name, object scope, Action <Hashtable, string> block, string methodName) { if (observer == null || name == null) { UnityEngine.Debug.Log("Warning: NotificationCenter.addObserver() called with null observer or name"); return; } if (scope == null) { scope = globalScope; } if (name.StartsWith("GLOBAL::", StringComparison.OrdinalIgnoreCase)) { scope = globalScope; name = name.Substring(8); if (methodName.StartsWith("GLOBAL::", StringComparison.OrdinalIgnoreCase)) { methodName = methodName.Substring(8); } } NotificationObserver obv = new NotificationObserver(); obv.name = name; obv.block = block; obv.methodName = methodName; obv.observer = observer; List <NotificationObserver> list; if (!observersByScope.TryGetValue(scope, out list)) { list = new List <NotificationObserver>(); observersByScope.Add(scope, list); } list.Add(obv); }
private static void addObserverPrivate(object observer, string name, object scope, Action<Hashtable, string> block, string methodName) { if (observer == null || name == null) { UnityEngine.Debug.Log ("Warning: NotificationCenter.addObserver() called with null observer or name"); return; } if (scope == null) { scope = globalScope; } NotificationObserver obv = new NotificationObserver (); obv.name = name; obv.block = block; obv.methodName = methodName; obv.observer = observer; List<NotificationObserver> list; if (!observersByScope.TryGetValue(scope, out list)) { list = new List<NotificationObserver>(); observersByScope.Add(scope, list); } list.Add(obv); }
private void RegisterObservers() { var notificationObserver = new NotificationObserver(_db, _notificationTimerElapsed); }
public bool UnregisterObserver(NotificationObserver notificationObserver) { return(true); }
public bool UnregisterObserver(NotificationObserver notificationObserver) { return(this.observers.Remove(notificationObserver)); }
public bool RegisterObserver(NotificationObserver notificationObserver) { return(this.observers.Add(notificationObserver)); }