/// <summary> /// Disposer. Release resources and cleanup. /// </summary> /// <param name="disposing">true to dispose managed resources</param> protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!_disposed) { Log.Debug(); if (disposing) { if (_timer != null) { _timer.Dispose(); _timer = null; } if (_acceptTimer != null) { _acceptTimer.Stop(); _acceptTimer = null; } if (_audio != null) { _audio.Dispose(); _audio = null; } } // Release unmanaged resources. } _disposed = true; }
/// <summary> /// Initializes mouse mover /// </summary> public void Init() { _currentState = MouseMoverStates.Idle; _boundWidth = Screen.PrimaryScreen.Bounds.Width; _boundHeight = Screen.PrimaryScreen.Bounds.Height; Log.Debug("boundWidth=" + _boundWidth + " boundHeight=" + _boundHeight); // we could use the radius of the current form/window // or allow the controlling app to pass in a specific radius //radius = boundWidth; // half the screen _radius = 20000; _penColor = Color.FromArgb(255, 255, 0, 0); initRadarLine(); var timerDelegate = new TimerQueue.WaitOrTimerDelegate(mmTimer_Tick); _mouseMoverTimer = new TimerQueue(DefaultTimerInterval, DefaultTimerInterval, timerDelegate); }
/// <summary> /// Disposer. Release resources and cleanup. /// </summary> /// <param name="disposing">true to dispose managed resources</param> protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!_disposed) { Log.Debug(); if (disposing) { // dispose all managed resources. try { if (_mouseMoverTimer != null) { _mouseMoverTimer.Stop(); _mouseMoverTimer.Dispose(); _mouseMoverTimer = null; } if (_pen != null) { _pen.Dispose(); } } catch (Exception ex) { Log.Exception(ex); } closeDrawForm(); } // Release unmanaged resources. } _disposed = true; }
/// <summary> /// Initializes the class variables /// </summary> public void Init() { // don't use setState because we don't want to trigger events before // it is prudent to do so _currentState = MouseMoverStates.Idle; _boundWidth = Screen.PrimaryScreen.Bounds.Width; _boundHeight = Screen.PrimaryScreen.Bounds.Height; Log.Debug("boundWidth=" + _boundWidth + " boundHeight=" + _boundHeight); _gridPenColor = Color.FromArgb(255, 255, 0, 0); initGridLine(); var timerDelegate = new TimerQueue.WaitOrTimerDelegate(mmTimer_Tick); _mouseMoverTimer = new TimerQueue(DefaultTimerInterval, DefaultTimerInterval, timerDelegate); }