Exemple #1
0
        //----
        /// <summary>
        /// Gets a possible shared instance of this class.
        /// </summary>
        /// -
        /// <remarks>
        /// <para>If more that one piece of code is using this class then there
        /// is no need for each to have a private instance.  This method allows
        /// them to access a shared instance.  When first called it creates a
        /// new instance and keeps a weak-reference to it.  Subsequent callers
        /// will then get the same instance.  The instance is kept alive only
        /// as long as at least one caller keeps a reference to it.  If no
        /// references are kept then the instance will be deleted and a new
        /// instance will be created when this method is next called.
        /// </para>
        /// </remarks>
        /// -
        /// <returns>An instance of this class.
        /// </returns>
        public static BluetoothWin32Events GetInstance()
        {
#if NETCF
            throw new NotSupportedException("BluetoothWin32Events is Win32 only.");
#else
            var    weakRef = _instance;
            object target;
            if (weakRef == null || (target = weakRef.Target) == null)
            {
                target    = new BluetoothWin32Events();
                _instance = new WeakReference(target);
            }
            else
            {
                target.ToString(); // COVERAGE
            }
            return((BluetoothWin32Events)target);
#endif
        }
Exemple #2
0
 internal BtEventsForm(BluetoothWin32Events parent)
 {
     _parent   = parent;
     this.Text = "32feet.NET WM_DEVICECHANGE Window";
 }