예제 #1
0
        internal ControlToWatch AddControlToWatch(UIElement elementToWatch, Action <Point, Size> callback)
        {
            ControlToWatch returnvalue = new ControlToWatch(elementToWatch, callback);

            Size             elementCurrentSize;
            FrameworkElement control = elementToWatch as FrameworkElement;

            if (control != null)
            {
                elementCurrentSize = control.INTERNAL_GetActualWidthAndHeight();
            }
            else
            {
                elementCurrentSize = new Size();
            }

            Point elementCurrentPosition = INTERNAL_PopupsManager.GetUIElementAbsolutePosition(elementToWatch);

            returnvalue.PreviousPosition = elementCurrentPosition;
            returnvalue.PreviousSize     = elementCurrentSize;

            _controlsToWatch.Add(returnvalue);
            if (!_timer.IsEnabled)
            {
                _timer.Start();
            }
            return(returnvalue); //note: we need to return the value to be able to remove it afterwards.
        }
예제 #2
0
 internal void RemoveControlToWatch(ControlToWatch controlToStopWatching)
 {
     _controlsToWatch.Remove(controlToStopWatching);
     if (_controlsToWatch.Count == 0)
     {
         _timer.Stop();
     }
 }