Exemplo n.º 1
0
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    Logger.Info("KeylockSimulator", "Disposing class: " + this.ToString());
                    // Release the managed resources you added in
                    // this derived class here.

                    if (KeyChangeEvent != null)
                    {
                        KeyChangeEvent.Dispose();
                        KeyChangeEvent = null;
                    }
                }
                // Release the native unmanaged resources
                // WindowThread needs to be treated as an unmanaged resource because
                // it is a class that contain threads and windows and won't get collected
                // by the GC
                if (Window != null)
                {
                    Window.Close();
                    Window = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
Exemplo n.º 2
0
        internal void SetKeyPosition(int keyPosition)
        {
            if (keyposition != keyPosition)
            {
                keyposition = keyPosition;

                if (KeyWaitPosition == keyPosition || KeyWaitPosition == Keylock.PositionAny)
                {
                    KeyChangeEvent.Set();
                }

                IncrementStatistic(Keylock.StatisticLockPositionChangeCount);

                // TODO: this event should be sent to all service objects that have this
                // device opened
                QueueEvent(new StatusUpdateEventArgs(keyposition));
            }
        }