protected virtual void OnCallback(CFStreamEventType type) { var args = new StreamEventArgs(type); switch (type) { case CFStreamEventType.OpenCompleted: OnOpenCompleted(args); break; case CFStreamEventType.CanAcceptBytes: OnCanAcceptBytesEvent(args); break; case CFStreamEventType.HasBytesAvailable: OnHasBytesAvailableEvent(args); break; case CFStreamEventType.ErrorOccurred: OnErrorEvent(args); break; case CFStreamEventType.EndEncountered: OnClosedEvent(args); break; } }
public void Notify(CFStreamEventType eventType) { if ((flags & eventType) == 0) return; context.Invoke (callback, Handle, eventType); }
internal void Invoke (IntPtr callback, IntPtr stream, CFStreamEventType eventType) { if (callback == IntPtr.Zero) return; CFReadStreamRef_InvokeCallback (callback, stream, eventType, Info); }
public void Notify(CFStreamEventType eventType) { if ((flags & eventType) == 0) { return; } context.Invoke(callback, Handle, eventType); }
internal void Invoke(IntPtr callback, IntPtr stream, CFStreamEventType eventType) { if (callback == IntPtr.Zero) { return; } CFReadStreamRef_InvokeCallback(callback, stream, eventType, Info); }
protected virtual bool SetCFClientFlags (CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr) { CFStreamClientContext inContext; if (inContextPtr == IntPtr.Zero) return false; inContext = (CFStreamClientContext) Marshal.PtrToStructure (inContextPtr, typeof (CFStreamClientContext)); if (inContext.Version != 0) return false; context.Release (); context = inContext; context.Retain (); flags = inFlags; callback = inCallback; return true; }
protected virtual bool SetCFClientFlags(CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr) { CFStreamClientContext inContext; if (inContextPtr == IntPtr.Zero) { return(false); } inContext = (CFStreamClientContext)Marshal.PtrToStructure(inContextPtr, typeof(CFStreamClientContext)); if (inContext.Version != 0) { return(false); } context.Release(); context = inContext; context.Retain(); flags = inFlags; callback = inCallback; return(true); }
static void OnCallback(IntPtr s, CFStreamEventType type, IntPtr info) { var stream = GCHandle.FromIntPtr (info).Target as CFStream; stream.OnCallback (type); }
protected virtual void OnCallback(CFStreamEventType type) { var args = new StreamEventArgs (type); switch (type) { case CFStreamEventType.OpenCompleted: OnOpenCompleted (args); break; case CFStreamEventType.CanAcceptBytes: OnCanAcceptBytesEvent (args); break; case CFStreamEventType.HasBytesAvailable: OnHasBytesAvailableEvent (args); break; case CFStreamEventType.ErrorOccurred: OnErrorEvent (args); break; case CFStreamEventType.EndEncountered: OnClosedEvent (args); break; } }
static void CFReadStreamRef_InvokeCallback(IntPtr callback, IntPtr stream, CFStreamEventType eventType, IntPtr info) { ((CallbackDelegate)Marshal.GetDelegateForFunctionPointer (callback, typeof (CallbackDelegate))) (stream, eventType, info); }
public StreamEventArgs(CFStreamEventType type) { this.EventType = type; }
static void CFReadStreamRef_InvokeCallback(IntPtr callback, IntPtr stream, CFStreamEventType eventType, IntPtr info) { ((CallbackDelegate)Marshal.GetDelegateForFunctionPointer(callback, typeof(CallbackDelegate)))(stream, (IntPtr)eventType, info); }
static void OnCallback(IntPtr s, CFStreamEventType type, IntPtr info) { var stream = GCHandle.FromIntPtr(info).Target as CFStream; stream.OnCallback(type); }
protected override bool SetCFClientFlags (CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr) { // Just call the base implementation, which knows how to handle everything. return base.SetCFClientFlags (inFlags, inCallback, inContextPtr); }
protected override bool SetCFClientFlags(CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr) { // Just call the base implementation, which knows how to handle everything. return(base.SetCFClientFlags(inFlags, inCallback, inContextPtr)); }
public void Notify(CFStreamEventType eventType) { if ((flags & eventType) == 0) return; }