当前位置: 首页>>代码示例>>C#>>正文


C# IInputElement.RaiseEvent方法代码示例

本文整理汇总了C#中IInputElement.RaiseEvent方法的典型用法代码示例。如果您正苦于以下问题:C# IInputElement.RaiseEvent方法的具体用法?C# IInputElement.RaiseEvent怎么用?C# IInputElement.RaiseEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInputElement的用法示例。


在下文中一共展示了IInputElement.RaiseEvent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RaiseCursorEvents

 /// <summary>
 /// Raises the cursor events.
 /// </summary>
 /// <param name="element">The ui element under the cursor.</param>
 /// <param name="cursorPosition">Cursor position.</param>
 public void RaiseCursorEvents(IInputElement element, Point cursorPosition)
 {
     element.RaiseEvent(new HandCursorEventArgs(KinectEvents.HandCursorMoveEvent, cursorPosition));
     if (element != _lastElement)
     {
         if (_lastElement != null)
             _lastElement.RaiseEvent(new HandCursorEventArgs(KinectEvents.HandCursorLeaveEvent, cursorPosition));
         element.RaiseEvent(new HandCursorEventArgs(KinectEvents.HandCursorEnterEvent, cursorPosition));
     }
     _lastElement = element;
 }
开发者ID:blackViking007,项目名称:3D_Virtual_Fitting_Room,代码行数:16,代码来源:ButtonsManager.cs

示例2: CheckMouseEvent

 private static void CheckMouseEvent(TestWindow window, IInputElement button, RoutedEvent routedEvent, bool shouldBeHandled)
 {
     var args = new MouseButtonEventArgs(Mouse.PrimaryDevice, (int) DateTime.Now.Ticks, MouseButton.Left);
     args.RoutedEvent = routedEvent;
     button.RaiseEvent(args);
     window.ProcessEvents();
     Assert.AreEqual(shouldBeHandled, args.Handled);
 }
开发者ID:p69,项目名称:magellan-framework,代码行数:8,代码来源:UIElementExtensionsTests.cs

示例3: OnRaiseEndEditEvent

        private bool OnRaiseEndEditEvent(IInputElement uiElement)
        {
            if (uiElement == null) return false;
            var arg = new CellEditRoutedEventArgs(EndEditEvent, this);
            uiElement.RaiseEvent(arg);

            if (arg.HasChanged)
            {
                //arg.ChangedSet.ForEach(x => DirtyItems.Add(x));
                //_isDirty = true;
                LayerContainer.OnRaiseAfterMouseUpEvent(this); // 刷新控制, 重绘
            }
            return arg.HasChanged;
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:14,代码来源:EditControlLayer.cs

示例4: ProcessKeyEventArgs

    private bool ProcessKeyEventArgs( KeyEventArgs e, IInputElement target )
    {
      bool retval = false;

      if( target != null )
      {
        //foward the event to the child check box
        Key realKey;
        if( ( e.Key == Key.None ) && ( e.SystemKey != Key.None ) )
        {
          realKey = e.SystemKey;
        }
        else
        {
          realKey = e.Key;
        }

        //in XBAP the Keyboard.PrimaryDevice.ActiveSource will throw ,therefore, protect against the throw and suppress the exception
        //if its the one we expect.
        try
        {
          KeyEventArgs kea = new KeyEventArgs( Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, realKey );
          kea.RoutedEvent = e.RoutedEvent;

          //send the event
          target.RaiseEvent( kea );

          retval = kea.Handled;
        }
        catch( SecurityException ex )
        {
          //if the exception is for the UIPermission, then we want to suppress it
          if( ( ex.PermissionType.FullName == "System.Security.Permissions.UIPermission" ) == false )
          {
            //not correct type, then rethrow the exception
            throw;
          }
          else //this means that we are in XBAP
          {
            //we want to handle speciallly the case where the space was pressed (so that checkbox works in XBAP)
            //condition taken from the System ChecckBox
            if( ( e.RoutedEvent == Keyboard.KeyDownEvent )
                && ( e.Key == Key.Space )
                && ( ( Keyboard.Modifiers & ( ModifierKeys.Control | ModifierKeys.Alt ) ) != ModifierKeys.Alt )
                && ( this.IsMouseCaptured == false ) )
            {
              if( this.IsChecked.HasValue == true )
              {
                if( this.IsChecked.Value == false )
                {
                  this.IsChecked = true;
                }
                else if( this.IsThreeState == false )
                {
                  this.IsChecked = false;
                }
                else
                {
                  this.IsChecked = null;
                }
              }
              else
              {
                this.IsChecked = false;
              }

              retval = true;
            }
          }
        }
      }

      return retval;
    }
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:74,代码来源:DataGridCheckBox.cs

示例5: RightClick

        private void RightClick(IInputElement element)
        {
            element.RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Right)
            {
                RoutedEvent = Mouse.MouseDownEvent
            });

            element.RaiseEvent(new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Right)
            {
                RoutedEvent = Mouse.MouseUpEvent
            });

            DispatcherUtil.DoEvents();
        }
开发者ID:limrzx,项目名称:Dynamo,代码行数:14,代码来源:CoreUITests.cs

示例6: GetInfoForElement

        private AccessKeyInformation GetInfoForElement(IInputElement element, string key)
        {
            AccessKeyInformation info = new AccessKeyInformation();
            if (element != null)
            {
                AccessKeyPressedEventArgs args = new AccessKeyPressedEventArgs(key);

                element.RaiseEvent(args);
                info.Scope = args.Scope;
                info.target = args.Target;
                if (info.Scope == null)
                {
                    info.Scope = GetSourceForElement(element);
                }
            }
            else
            {
                info.Scope = CriticalGetActiveSource();
            }
            return info;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:21,代码来源:AccessKeyManager.cs

示例7: OnDeactivateStoryboardCompleted

 private static void OnDeactivateStoryboardCompleted(
     IInputElement snackbar, SnackbarMessage message)
 {
     var args = new SnackbarMessageEventArgs(DeactivateStoryboardCompletedEvent, message);
     snackbar.RaiseEvent(args);
 }
开发者ID:punker76,项目名称:MaterialDesignInXamlToolkit,代码行数:6,代码来源:Snackbar.cs

示例8: NavigateToUri

        private static void NavigateToUri(IInputElement sourceElement, Uri targetUri, string targetWindow) 
        {
            Debug.Assert(targetUri != null); 

            //
            // This prevents against multi-threaded spoofing attacks.
            // 
            DependencyObject dObj = (DependencyObject)sourceElement;
            dObj.VerifyAccess(); 
 
            //
            // Spoofing countermeasure makes sure the URI hasn't changed since display in the status bar. 
            //
            Uri cachedUri = Hyperlink.s_cachedNavigateUri.Value;
            // ShouldPreventUriSpoofing is checked last in order to avoid incurring a first-chance SecurityException
            // in common scenarios. 
            if (cachedUri == null || cachedUri.Equals(targetUri) || !ShouldPreventUriSpoofing)
            { 
                // 

                // We treat FixedPage seperately to maintain backward compatibility 
                // with the original separate FixedPage implementation of this, which
                // calls the GetLinkUri method.
                if (!(sourceElement is Hyperlink))
                { 
                    targetUri = FixedPage.GetLinkUri(sourceElement, targetUri);
                } 
 
                RequestNavigateEventArgs navigateArgs = new RequestNavigateEventArgs(targetUri, targetWindow);
                navigateArgs.Source = sourceElement; 
                sourceElement.RaiseEvent(navigateArgs);

                if (navigateArgs.Handled)
                { 
                    //
                    // The browser's status bar should be cleared. Otherwise it will still show the 
                    // hyperlink address after navigation has completed. 
                    // !! We have to do this after the current callstack is unwound in order to keep
                    // the anti-spoofing state valid. A particular attach is to do a bogus call to 
                    // DoClick() in a mouse click preview event and then change the NavigateUri.
                    //
                    dObj.Dispatcher.BeginInvoke(DispatcherPriority.Send,
                        new System.Threading.SendOrPostCallback(ClearStatusBarAndCachedUri), sourceElement); 
                }
            } 
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:46,代码来源:Hyperlink.cs

示例9: RaiseMouseLeaveNode

        private void RaiseMouseLeaveNode(IInputElement nv)
        {
            View.Dispatcher.Invoke(() =>
            {
                nv.RaiseEvent(new MouseEventArgs(Mouse.PrimaryDevice, 0) { RoutedEvent = Mouse.MouseLeaveEvent });
            });

            DispatcherUtil.DoEvents();
        }
开发者ID:sm6srw,项目名称:Dynamo,代码行数:9,代码来源:PreviewBubbleTests.cs

示例10: RaiseContextMenuOpeningEvent

        private bool RaiseContextMenuOpeningEvent(IInputElement source, double x, double y,bool userInitiated)
        {
            // Fire the event
            ContextMenuEventArgs args = new ContextMenuEventArgs(source, true /* opening */, x, y);
            DependencyObject sourceDO = source as DependencyObject;
            if (userInitiated && sourceDO != null)
            {
                if (InputElement.IsUIElement(sourceDO))
                {
                    ((UIElement)sourceDO).RaiseEvent(args, userInitiated);
                }
                else if (InputElement.IsContentElement(sourceDO))
                {
                    ((ContentElement)sourceDO).RaiseEvent(args, userInitiated);
                }
                else if (InputElement.IsUIElement3D(sourceDO))
                {
                    ((UIElement3D)sourceDO).RaiseEvent(args, userInitiated);
                }
                else
                {
                    source.RaiseEvent(args);
                }
            }
            else
            {
                source.RaiseEvent(args);
            }


            if (!args.Handled)
            {
                // No one handled the event, auto show any available ContextMenus

                // Saved from the bubble up the tree where we looked for a set ContextMenu property
                DependencyObject o = args.TargetElement;
                if ((o != null) && ContextMenuService.ContextMenuIsEnabled(o))
                {
                    // Retrieve the value
                    object menu = ContextMenuService.GetContextMenu(o);
                    ContextMenu cm = menu as ContextMenu;
                    cm.SetValue(OwnerProperty, o);
                    cm.Closed += new RoutedEventHandler(OnContextMenuClosed);

                    if ((x == -1.0) && (y == -1.0))
                    {
                        // We infer this to mean that the ContextMenu was opened with the keyboard
                        cm.Placement = PlacementMode.Center;
                    }
                    else
                    {
                        // If there is a CursorLeft and CursorTop, it was opened with the mouse.
                        cm.Placement = PlacementMode.MousePoint;
                    }

                    // Clear any open tooltips
                    RaiseToolTipClosingEvent(true /*reset */);

                    cm.SetCurrentValueInternal(ContextMenu.IsOpenProperty, BooleanBoxes.TrueBox);

                    return true; // A menu was opened
                }

                return false; // There was no menu to open
            }

            // Clear any open tooltips since someone else opened one
            RaiseToolTipClosingEvent(true /*reset */);

            return true; // The event was handled by someone else
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:71,代码来源:PopupControlService.cs

示例11: UpdateIsDefaulted

        private void UpdateIsDefaulted(IInputElement focus)
        { 
            // If it's not a default button, or nothing is focused, or it's disabled then it's not defaulted. 
            if (!IsDefault || focus == null || !IsEnabled)
            { 
                SetValue(IsDefaultedPropertyKey, BooleanBoxes.FalseBox);
                return;
            }
 
            DependencyObject focusDO = focus as DependencyObject;
            object thisScope, focusScope; 
 
            // If the focused thing is not in this scope then IsDefaulted = false
            AccessKeyPressedEventArgs e; 

            object isDefaulted = BooleanBoxes.FalseBox;
            try
            { 
                // Step 1: Determine the AccessKey scope from currently focused element
                e = new AccessKeyPressedEventArgs(); 
                focus.RaiseEvent(e); 
                focusScope = e.Scope;
 
                // Step 2: Determine the AccessKey scope from this button
                e = new AccessKeyPressedEventArgs();
                this.RaiseEvent(e);
                thisScope = e.Scope; 

                // Step 3: Compare scopes 
                if (thisScope == focusScope && (focusDO == null || (bool)focusDO.GetValue(KeyboardNavigation.AcceptsReturnProperty) == false)) 
                {
                    isDefaulted = BooleanBoxes.TrueBox; 
                }
            }
            finally
            { 
                SetValue(IsDefaultedPropertyKey, isDefaulted);
            } 
 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:40,代码来源:Button.cs


注:本文中的IInputElement.RaiseEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。