public CFRunLoopExitReason RunInMode(string mode, double interval, bool returnAfterSourceHandled) { CFString s = mode == null ? null : new CFString(mode); var v = CFRunLoopRunInMode(s == null ? IntPtr.Zero : s.Handle, interval, returnAfterSourceHandled ? 1 : 0); if (s != null) { s.Dispose(); } return((CFRunLoopExitReason)v); }
static void Cancel(IntPtr info, IntPtr runLoop, IntPtr mode) { var source = GCHandle.FromIntPtr(info).Target as CFRunLoopSourceCustom; var loop = new CFRunLoop(runLoop); var mstring = new CFString(mode); try { source.OnCancel(loop, (string)mstring); } finally { loop.Dispose(); mstring.Dispose(); } }
public CFRunLoopExitReason RunInMode(string mode, double seconds, bool returnAfterSourceHandled) { if (mode == null) { throw new ArgumentNullException("mode"); } CFString s = new CFString(mode); var v = CFRunLoopRunInMode(s.Handle, seconds, returnAfterSourceHandled ? 1 : 0); s.Dispose(); return((CFRunLoopExitReason)v); }
public CFRunLoopExitReason RunInMode (string mode, double seconds, bool returnAfterSourceHandled) { if (mode == null) throw new ArgumentNullException ("mode"); CFString s = new CFString (mode); var v = CFRunLoopRunInMode (s.Handle, seconds, returnAfterSourceHandled ? 1 : 0); s.Dispose (); return (CFRunLoopExitReason) v; }
static void Cancel (IntPtr info, IntPtr runLoop, IntPtr mode) { var source = GCHandle.FromIntPtr (info).Target as CFRunLoopSourceCustom; var loop = new CFRunLoop (runLoop); var mstring = new CFString (mode); try { source.OnCancel (loop, (string)mstring); } finally { loop.Dispose (); mstring.Dispose (); } }
public void ApplyCredentials (CFHTTPAuthentication auth, NetworkCredential credential) { if (auth.RequiresAccountDomain) { ApplyCredentialDictionary (auth, credential); return; } var username = new CFString (credential.UserName); var password = new CFString (credential.Password); try { CFStreamError error; var ok = CFHTTPMessageApplyCredentials ( Handle, auth.Handle, username.Handle, password.Handle, out error); if (!ok) throw GetException ((ErrorHTTPAuthentication)error.code); } finally { username.Dispose (); password.Dispose (); } }