示例#1
0
        /////////////////////////////////////////////////////////////////////

        internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
        {
            // This is all very sketchy...
            //
            // Tablet can support multiple stylus devices concurrently.  They can each
            // be over a different element.  They all update the IsStylusOver property,
            // which calls into here, but ends up using the "current" stylus device,
            // instead of each using their own device.  Worse, all of these will end up
            // writing to the same bits in the UIElement.  They are going to step all over
            // each other.
            if (Stylus.CurrentStylusDevice == null)
            {
                return;
            }

            StylusEventArgs stylusEventArgs = new StylusEventArgs(Stylus.CurrentStylusDevice, Environment.TickCount);

            stylusEventArgs.RoutedEvent = oldValue ? Stylus.StylusLeaveEvent : Stylus.StylusEnterEvent;

            if (uie != null)
            {
                uie.RaiseEvent(stylusEventArgs);
            }
            else if (ce != null)
            {
                ce.RaiseEvent(stylusEventArgs);
            }
            else if (uie3D != null)
            {
                uie3D.RaiseEvent(stylusEventArgs);
            }
        }
示例#2
0
        /////////////////////////////////////////////////////////////////////

        internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
        { 
            // This is all very sketchy...
            // 
            // Tablet can support multiple stylus devices concurrently.  They can each 
            // be over a different element.  They all update the IsStylusOver property,
            // which calls into here, but ends up using the "current" stylus device, 
            // instead of each using their own device.  Worse, all of these will end up
            // writing to the same bits in the UIElement.  They are going to step all over
            // each other.
            if(Stylus.CurrentStylusDevice == null) 
            {
                return; 
            } 

            StylusEventArgs stylusEventArgs = new StylusEventArgs(Stylus.CurrentStylusDevice, Environment.TickCount); 
            stylusEventArgs.RoutedEvent = oldValue ? Stylus.StylusLeaveEvent : Stylus.StylusEnterEvent;

            if (uie != null)
            { 
                uie.RaiseEvent(stylusEventArgs);
            } 
            else if (ce != null) 
            {
                ce.RaiseEvent(stylusEventArgs); 
            }
            else if (uie3D != null)
            {
                uie3D.RaiseEvent(stylusEventArgs); 
            }
        } 
示例#3
0
        /////////////////////////////////////////////////////////////////////

        internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
        {
            // Before we fire the mouse event we need to figure if the notification is still relevant.
            // This is because it is possible that the mouse state has changed during the previous
            // property engine callout. Example: Consider a MessageBox being displayed during the
            // IsMouseOver OnPropertyChanged override.

            bool shouldFireNotification = false;

            if (uie != null)
            {
                shouldFireNotification = (!oldValue && uie.IsMouseOver) || (oldValue && !uie.IsMouseOver);
            }
            else if (ce != null)
            {
                shouldFireNotification = (!oldValue && ce.IsMouseOver) || (oldValue && !ce.IsMouseOver);
            }
            else if (uie3D != null)
            {
                shouldFireNotification = (!oldValue && uie3D.IsMouseOver) || (oldValue && !uie3D.IsMouseOver);
            }

            if (shouldFireNotification)
            {
                MouseEventArgs mouseEventArgs = new MouseEventArgs(Mouse.PrimaryDevice, Environment.TickCount, Mouse.PrimaryDevice.StylusDevice);
                mouseEventArgs.RoutedEvent = oldValue ? Mouse.MouseLeaveEvent : Mouse.MouseEnterEvent;

                if (uie != null)
                {
                    uie.RaiseEvent(mouseEventArgs);
                }
                else if (ce != null)
                {
                    ce.RaiseEvent(mouseEventArgs);
                }
                else if (uie3D != null)
                {
                    uie3D.RaiseEvent(mouseEventArgs);
                }
            }
        }
示例#4
0
        /////////////////////////////////////////////////////////////////////

        internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
        {
            // Before we fire the mouse event we need to figure if the notification is still relevant. 
            // This is because it is possible that the mouse state has changed during the previous 
            // property engine callout. Example: Consider a MessageBox being displayed during the 
            // IsMouseOver OnPropertyChanged override.
            
            bool shouldFireNotification = false;
            if (uie != null)
            {
                shouldFireNotification = (!oldValue && uie.IsMouseOver) || (oldValue && !uie.IsMouseOver);
            }
            else if (ce != null)
            {
                shouldFireNotification = (!oldValue && ce.IsMouseOver) || (oldValue && !ce.IsMouseOver);
            }
            else if (uie3D != null)
            {
                shouldFireNotification = (!oldValue && uie3D.IsMouseOver) || (oldValue && !uie3D.IsMouseOver);
            }

            if (shouldFireNotification)
            {
                MouseEventArgs mouseEventArgs = new MouseEventArgs(Mouse.PrimaryDevice, Environment.TickCount, Mouse.PrimaryDevice.StylusDevice);
                mouseEventArgs.RoutedEvent = oldValue ? Mouse.MouseLeaveEvent : Mouse.MouseEnterEvent;

                if (uie != null)
                {
                    uie.RaiseEvent(mouseEventArgs);
                }
                else if (ce != null)
                {
                    ce.RaiseEvent(mouseEventArgs);
                }
                else if (uie3D != null)
                {
                    uie3D.RaiseEvent(mouseEventArgs);
                }
            }
        }