示例#1
0
 public SCardMonitor(ISCardContext context, SCardScope scope, bool releaseContextOnDispose = true)
 {
     if (context == null)
     {
         throw new ArgumentNullException(nameof(context));
     }
     _context = context;
     _context.Establish(scope);
     _releaseContextOnDispose = releaseContextOnDispose;
 }
示例#2
0
 /// <summary>Creates a new SCardMonitor object that is able to listen for certain smart card / reader changes.</summary>
 /// <param name="context">A new Application Context to the PC/SC Resource Manager.</param>
 /// <param name="scope">Scope of the establishment. This can either be a local or remote connection.</param>
 /// <param name="releaseContextOnDispose">If <see langword="true" /> the supplied <paramref name="context" /> will be released (using <see cref="ISCardContext.Release()" />) on <see cref="Dispose()" /></param>
 /// <remarks>The monitor object should use its own application context to the PC/SC Resource Manager. It will create a (new) backgroud thread that will listen for status changes.
 ///     <para>Warning: You MUST dispose the monitor instance otherwise the background thread will run forever!</para>
 /// </remarks>
 public SCardMonitor(ISCardContext context, SCardScope scope, bool releaseContextOnDispose = true)
     : this(context, releaseContextOnDispose)
 {
     _context.Establish(scope);
 }