public EnhancedPresence1(NotifyEventHandler notifyEvent) { this.notifyEvent = notifyEvent; Subscription.ResolvePublicationEvent += ResolvePublication; SubscriptionResource.NotifySubscriberEvent += SubscriptionResource_NotifySubscriber; this.timer = new Timer(new TimerCallback(ValidateExpired), null, 1000, 1000); }
public void AddNotify (string dir, NotifyEventHandler notify) { if (dir == null) throw new NullReferenceException("dir"); if (notify == null) throw new NullReferenceException("notify"); NotifyWrapper wrapper = new NotifyWrapper (notify, dir); client.AddNotify (dir, wrapper.HandleNotify); wrapper_list.Add (wrapper); }
internal TcpSocketSaeaSession( NotifyEventHandler <TcpSessionNotify, TcpSocketSaeaSession> notifyEventHandler, TcpSocketConfigurationBase configuration, SaeaAwaiterPool handlerSaeaPool, SessionPool sessionPool, TcpSocketSaeaEngineBased agent) { NotifyEventHandler = notifyEventHandler; Configuration = configuration; HandlerSaeaPool = handlerSaeaPool; SessionPools = sessionPool; Agent = agent; }
internal TcpSocketSaeaClientAgent( TcpSocketSaeaSessionType saeaSessionType, TcpSocketSaeaClientConfiguration configuration, NotifyEventHandler <TcpSocketCompletionNotify, TcpSocketSaeaSession> completetionNotify) : base(saeaSessionType, configuration, completetionNotify) { if (configuration.AppKeepAlive && saeaSessionType == TcpSocketSaeaSessionType.Packet) { var keepAliveThread = new Thread(AppKeepAliveWorkThread); keepAliveThread.IsBackground = true; keepAliveThread.Start(); } }
/// <summary> /// This method is invoked by the parent when a new instance is constructed, /// and this must copy all current state to this instance from the argument. /// </summary> /// <param name="notifyEventHandler">Not null.</param> public virtual void CopyStateFrom(NotifyEventHandler notifyEventHandler) { if (notifyEventHandler == null) { throw new ArgumentNullException(nameof(notifyEventHandler)); } collectionChangedEventArgs = notifyEventHandler.collectionChangedEventArgs; raiseCount = notifyEventHandler.raiseCount; raiseIndexer = notifyEventHandler.raiseIndexer; raisePropertyChanged = notifyEventHandler.raisePropertyChanged.IsNullOrEmpty() ? null : new List <string>(notifyEventHandler.raisePropertyChanged); IsSuspended = notifyEventHandler.IsSuspended; IsRaiseAllEventsAsResetEvents = notifyEventHandler.IsRaiseAllEventsAsResetEvents; }
/// <summary> /// 触发事件函数 /// </summary> /// <param name="args"></param> protected virtual void OnDataRecived(DataNotifyEventArgs args) { var delegateHandles = NotifyEventHandler.GetInvocationList(); foreach (Delegate item in delegateHandles) { try { item.DynamicInvoke(this, args); } catch { } } }
internal TcpSocketSaeaSession( NotifyEventHandler <TcpSocketCompletionNotify, TcpSocketSaeaSession> notifyEventHandler, TcpSocketConfigurationBase configuration, SaeaAwaiterPool handlerSaeaPool, SessionPool sessionPool, TcpSocketSaeaEngineBased agent, LogHelper logHelper) { _notifyEventHandler = notifyEventHandler; _configuration = configuration; _handlerSaeaPool = handlerSaeaPool; _sessionPool = sessionPool; _agent = agent; _logger = logHelper; }
public void AddNotify(string dir, NotifyEventHandler notify) { if (dir == null) { throw new NullReferenceException("dir"); } if (notify == null) { throw new NullReferenceException("notify"); } NotifyWrapper wrapper = new NotifyWrapper(notify, dir); client.AddNotify(dir, wrapper.HandleNotify); wrapper_list.Add(wrapper); }
internal TcpSocketSaeaEngineBased( TcpSocketSaeaSessionType saeaSessionType, TcpSocketConfigurationBase configuration, NotifyEventHandler <TcpSessionNotify, TcpSocketSaeaSession> completetionNotify) { TcpSocketSaeaSessions = new List <TcpSocketSaeaSession>(); HandlerSaeaPool = new SaeaAwaiterPool(); SessionPool = new SessionPool(); SaeaSessionType = saeaSessionType; Configuration = configuration; CompletetionNotify = completetionNotify; HandlerSaeaPool.Initialize(() => new SaeaAwaiter(), (saea) => { try { saea.Saea.AcceptSocket = null; saea.Saea.SetBuffer(EmptyArray, 0, EmptyArray.Length); saea.Saea.RemoteEndPoint = null; saea.Saea.SocketFlags = SocketFlags.None; } catch (Exception ex) { Console.WriteLine("server_clean awaiter info:" + ex.Message); } }, 50); if (saeaSessionType == TcpSocketSaeaSessionType.Full) { SessionPool.Initialize(() => new TcpSocketSaeaFullBased(Configuration, HandlerSaeaPool, SessionPool, completetionNotify, this), (session) => { session.Detach(); }, 50); } else { SessionPool.Initialize(() => new TcpSocketSaeaPackBased(Configuration, HandlerSaeaPool, SessionPool, completetionNotify, this), (session) => { session.Detach(); }, 50); } }
public void Remove(NotifyEventHandler notify) { ArrayList removes = new ArrayList(); foreach (uint id in connections.Keys) { if (connections [id] == notify) { removes.Add(id); } } foreach (uint id in removes) { gconf_client_notify_remove(handle, id); connections.Remove(id); } }
public void Set(string key, object value) { try { CreatePath(key); prefsDoc.SelectSingleNode(key).InnerText = System.Convert.ToString(value); prefsDoc.Save(fileName); foreach (string nkey in events.Keys) { NotifyEventHandler handler = events [nkey] as NotifyEventHandler; if (handler != null && key.StartsWith(nkey)) { NotifyEventArgs args = new NotifyEventArgs(key, value); handler(this, args); } } } catch {} }
/// <summary> /// 订阅数据 /// </summary> /// <param name="name"></param> /// <param name="notifyEvent"></param> public static void Subscribe(string name, NotifyEventHandler notifyEvent) { //必须方法同步 lock (lock_obj) { Topic subscriber = null; if (topic.TryGetValue(name, out subscriber)) { subscriber.AddObserver(notifyEvent); } else { //说明是先订阅 subscriber = new Topic(name, null); subscriber.AddObserver(notifyEvent); topic[name] = subscriber; } } }
private void PacketPartProcess(SaeaAwaiter awaiter, SocketError error) { var bytesTransferred = awaiter.Saea.BytesTransferred; if (bytesTransferred == 0 || error != SocketError.Success || State != TcpSocketConnectionState.Connected || Socket == null) { LogHelper.WriteLog("session_recv endtransfer state:" + State.ToString() + " socket_error:" + error.ToString()); this.EndTransfer(awaiter); return; } this.ReceiveBytesTransferred = bytesTransferred; NotifyEventHandler?.Invoke(TcpSessionNotify.OnDataReceiveing, this); awaiter.Saea.SetBuffer(CompletedBuffer, 0, CompletedBuffer.Length); SaeaExHelper.ReceiveAsync(this.Socket, awaiter, PacketPartProcess); }
public static Task<string> GetAsync() { var t = new TaskCompletionSource<string>(); var w = new WebView(); w.AllowedScriptNotifyUris = WebView.AnyScriptNotifyUri; w.NavigateToString("<html />"); NotifyEventHandler h = null; h = (s, e) => { try { var match = Regex.Match(e.Value, @"Windows\s+NT\s+\d+(\.\d+)?"); if (match.Success) t.SetResult(match.Value); else t.SetResult("Unknowm"); } catch (Exception ex) { t.SetException(ex); } finally { /* release */ w.ScriptNotify -= h; } }; w.ScriptNotify += h; w.InvokeScript("execScript", new[] { "window.external.notify(navigator.appVersion); " }); return t.Task; }
public void RemoveNotify (string dir, NotifyEventHandler notify) { if (dir == null) throw new NullReferenceException("dir"); if (notify == null) throw new NullReferenceException("notify"); NotifyWrapper wrapper_to_remove = null; foreach (NotifyWrapper wrapper in wrapper_list) if (wrapper.dir.Equals (dir) && wrapper.notify.Equals (notify)) { wrapper_to_remove = wrapper; break; } // NOTE: For some unknown reason, the RemoveNotify call does not // work here. That is why we explicitly disable the wrapper, // since it will unfortunately continue to exist and get // inappropriately notified. if (wrapper_to_remove != null) { client.RemoveNotify (dir, wrapper_to_remove.HandleNotify); wrapper_to_remove.enabled = false; wrapper_list.Remove (wrapper_to_remove); } }
public void RemoveNotify (string dir, NotifyEventHandler notify) { lock (events) { if (events.ContainsKey (dir)) events [dir] -= notify; } }
public void RemoveNotify (string dir, NotifyEventHandler notify) { // Do nothing }
public static void AddObserver(NotifyEventHandler ob) { NotifyEvent += ob; }
public void AddNotify(string dir, NotifyEventHandler notify) { GetConnections(dir).Add(notify); }
protected virtual void ProcessNotifyEvent(NotifyEventHandler handler, NotifyEventArgs args) { if (handler != null) { handler(this, args); } }
public static void Notify(INotification notification) { notifications.Add(notification); if (notified == null) notified = new NotifyEventHandler(notifHandler); notified(null, new NotifyEventArgs(notification)); }
public static UnmanagedEventHandler CreateNotifyEventHandlerDispatcher(NotifyEventHandler handler) { return(SafeDispatcher((sender, calldata, closure) => handler(NativeDependencyObjectHelper.FromIntPtr(closure), new NotifyEventArgs()))); }
public static void AddNotify(string baseDir, NotifyEventHandler handler) { EnsureClient (); GConfClient.AddNotify (baseDir, handler); }
public void AddObserver(NotifyEventHandler ob) => NotifyEvent += ob; //增加订阅消息
public void AddListener(string path, NotifyEventHandler handler) { client.AddNotify(path, handler); }
public void RemoveNotify(string dir, NotifyEventHandler notify) { // Do nothing }
/// <summary> /// 移除订阅人员 /// </summary> /// <param name="obj"></param> public void RemoveObserver(NotifyEventHandler obj) { NotifyEvent -= obj; }
public static void RemoveObserver(NotifyEventHandler ob) { NotifyEvent -= ob; }
public void RemoveObserver(NotifyEventHandler notdel) { mydel -= notdel; }
public NotifyWrapper (NotifyEventHandler notify) { this.notify = notify; this.native = new NotifyFuncNative (this.NotifyCB); }
public NotifyWrapper(NotifyEventHandler notify) { this.notify = notify; this.native = new NotifyFuncNative(this.NotifyCB); }
public static NotifyFuncNative Wrap (NotifyEventHandler notify) { NotifyWrapper wrapper = new NotifyWrapper (notify); refs.Add (wrapper); return wrapper.native; }
public NotifyWrapper (NotifyEventHandler notify, string dir) { this.notify = notify; this.dir = dir; }
public static UnmanagedEventHandler CreateNotifyEventHandlerDispatcher (NotifyEventHandler handler) { return SafeDispatcher( (sender, calldata, closure) => handler (NativeDependencyObjectHelper.FromIntPtr (closure), new NotifyEventArgs ()) ); }
public void RemoveNotify(string dir, NotifyEventHandler notify) { GetConnections(dir).Remove(notify); }
public void Add (NotifyEventHandler notify) { IntPtr error; uint id = gconf_client_notify_add (handle, path, NotifyWrapper.Wrap (notify), IntPtr.Zero, IntPtr.Zero, out error); if (error != IntPtr.Zero) throw new GLib.GException (error); connections [id] = notify; }
public void Detach(NotifyEventHandler obj) { NotifyEvent -= obj; }
public void AddNotify (string dir, NotifyEventHandler notify) { GetConnections (dir).Add (notify); }
public void AddNotify (string dir, NotifyEventHandler notify) { lock (events) { if (!events.ContainsKey (dir)) events [dir] = notify; else events [dir] += notify; } }
public static void AddNotify(NotifyEventHandler handler) { EnsureClient (); GConfClient.AddNotify (GConfBase, handler); }
public void Attach(NotifyEventHandler obj) { NotifyEvent += obj; }
public void AddListener(string path, NotifyEventHandler handler) { client.AddNotify (path, handler); }
public void Remove (NotifyEventHandler notify) { ArrayList removes = new ArrayList (); foreach (uint id in connections.Keys) if (connections [id] == notify) removes.Add (id); foreach (uint id in removes) { gconf_client_notify_remove (handle, id); connections.Remove (id); } }
public NotifyWrapper(NotifyEventHandler notify, string dir) { this.notify = notify; this.dir = dir; }
public void RemoveNotify (string dir, NotifyEventHandler notify) { GetConnections (dir).Remove (notify); }
public void AddObserver(NotifyEventHandler observer) { NotifyEvent += observer; }
/// <summary> /// 取消绑定订阅 /// </summary> /// <param name="observer"></param> public void RemoteObserver(NotifyEventHandler observer) { NotifyEvent -= observer; }
//委托实现 public void AddObserver(NotifyEventHandler notdel) { mydel += notdel; }
public void AddObserver(NotifyEventHandler ob) => NotifyEvent += ob; //增加订阅消息 public void RemoveObserver(NotifyEventHandler ob) => NotifyEvent -= ob; //去除订阅消息