public void Dispose()
        {
            _window?.Close();
            _window = null;

            _lifetimeSupervisor.ShowNotificationRequested  -= LifetimeSupervisorOnShowNotificationRequested;
            _lifetimeSupervisor.CloseNotificationRequested -= LifetimeSupervisorOnCloseNotificationRequested;

            _positionProvider.UpdatePositionRequested       -= PositionProviderOnUpdatePositionRequested;
            _positionProvider.UpdateEjectDirectionRequested -= PositionProviderOnUpdateEjectDirectionRequested;
            _positionProvider.UpdateHeightRequested         -= PositionProviderOnUpdateHeightRequested;

            _lifetimeSupervisor = null;
        }
        private void InitializeWindow()
        {
            lock (_syncRoot)
            {
                if (_window != null)
                {
                    return;
                }

                _window = new NotificationsWindow(_positionProvider.ParentWindow);
                _window.SetDisplayOptions(_displayOptions);
                _window.MinHeight = _positionProvider.GetHeight();
                _window.Height    = _positionProvider.GetHeight();
                _window.SetPosition(new Point(Double.NaN, Double.NaN));
                _window.SetKeyboardEventHandler(_keyboardEventHandler);
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _window?.Close();
                _window = null;

                _lifetimeSupervisor.ShowNotificationRequested  -= LifetimeSupervisorOnShowNotificationRequested;
                _lifetimeSupervisor.CloseNotificationRequested -= LifetimeSupervisorOnCloseNotificationRequested;

                _positionProvider.UpdatePositionRequested       -= PositionProviderOnUpdatePositionRequested;
                _positionProvider.UpdateEjectDirectionRequested -= PositionProviderOnUpdateEjectDirectionRequested;
                _positionProvider.UpdateHeightRequested         -= PositionProviderOnUpdateHeightRequested;

                _lifetimeSupervisor = null;
            }

            _disposed = true;
        }