private void OnMouseInactivityTimer(object sender, EventArgs e)
        {
            //****************************************************************************************************************************************
            // When Mouse is not moving (Inactive) then this method will called.
            //****************************************************************************************************************************************
            _mouseInactivityTimer.Stop();
            lock (_viewLock)
            {
                if (_viewModel == null || _viewModel.CallState == VATRPCallState.Closed)
                {
                    return;
                }
                if (_inactivityTimerStopped)
                {
                    Debug.WriteLine("Inactivity timer stopped. Do not process ");
                    return;
                }

                if (!restoreVisibilityStates)
                {
                    Win32Api.POINT mousePositionInControl;
                    Win32Api.GetCursorPos(out mousePositionInControl);
                    _lastMousePosition = mousePositionInControl;
                    HideOverlayControls();
                }
                else
                {
                    RestoreControlsVisibility();
                }
            }
        }
        private void CtrlVideo_OnMouseLeave(object sender, MouseEventArgs e)
        {
            //***************************************************************************************************************************************
            // When mouse leave the Video call window
            //**************************************************************************************************************************************
            lock (_viewLock)
            {
                if (_viewModel == null || !_viewModel.AllowHideContorls)
                {
                    return;
                }

                Point mousePosition = Mouse.GetPosition(this);

                //Debug.WriteLine("MouseLeave: X = {0}, Y={1}", mousePositionInControl.X, mousePositionInControl.Y);
                if (mousePosition.X > 0 && mousePosition.Y > 0)
                {
                    //Debug.WriteLine("we are in control area, ");
                    _mouseInControlArea = true;
                }

                Win32Api.POINT mousePositionInControl;
                Win32Api.GetCursorPos(out mousePositionInControl);
                _lastMousePosition = mousePositionInControl;
                RestartInactivityDetectionTimer();
            }
        }
        private void CtrlVideo_OnMouseMove(object sender, MouseEventArgs e)
        {
            //*************************************************************************************************************************************
            // When Mouse is moved over call window.
            //*************************************************************************************************************************************
            lock (_viewLock)
            {
                if (_viewModel == null || !_viewModel.AllowHideContorls)
                {
                    return;
                }
                if (_viewModel.CallState == VATRPCallState.Closed)
                {
                    return;
                }
                Win32Api.POINT mousePositionInControl;
                Win32Api.GetCursorPos(out mousePositionInControl);

                if (_lastMousePosition.X != mousePositionInControl.X ||
                    _lastMousePosition.Y != mousePositionInControl.Y)
                {
                    _mouseInControlArea = false;
                    RestoreControlsVisibility();
                    RestartInactivityDetectionTimer();
                }
                _lastMousePosition = mousePositionInControl;
            }
        }
        private void CtrlVideo_OnMouseEnter(object sender, MouseEventArgs e)
        {
            //*****************************************************************************************************************************************
            // When Mouse is moved over call window.
            //*****************************************************************************************************************************************
            lock (_viewLock)
            {
                if (_viewModel == null || !_viewModel.AllowHideContorls)
                {
                    return;
                }

                if (_viewModel == null || _viewModel.CallState == VATRPCallState.Closed)
                {
                    return;
                }
                Win32Api.POINT mousePositionInControl;
                Win32Api.GetCursorPos(out mousePositionInControl);

                if (_lastMousePosition.X == mousePositionInControl.X &&
                    _lastMousePosition.Y == mousePositionInControl.Y)
                {
                    //Debug.WriteLine("Unchanged coordinates. Should be skipped. Control area: " + _mouseInControlArea);
                    if (restoreVisibilityStates)
                    {
                        if (_mouseInactivityTimer.IsEnabled)
                        {
                            _inactivityTimerStopped = true;
                            _mouseInactivityTimer.Stop();
                        }
                    }
                    return;
                }

                _lastMousePosition = mousePositionInControl;
                if (!_mouseInControlArea)
                {
                    RestoreControlsVisibility();
                }
                RestartInactivityDetectionTimer();
            }
        }