• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IInputElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Capture

		public bool Capture(Contact contact, IInputElement element, CaptureMode captureMode)
		{
			if(element == null)
				captureMode = CaptureMode.None;
			if(captureMode == CaptureMode.None)
				element = null;

			DependencyObject oldCaptured = contact.InputArgs.Captured;
			if(oldCaptured == element)
				return true;

			using (dispatcher.DisableProcessing())
			{
				long timestamp = Stopwatch.GetTimestamp();
				if (contact.InputArgs.Captured != null)
					RaiseCaptureEvent(contact, MultitouchScreen.LostContactCaptureEvent, contact.InputArgs.Captured, timestamp);


				contact.InputArgs.Captured = (DependencyObject)element;
				contact.InputArgs.CaptureState = captureMode;

				if (contact.InputArgs.Captured != null)
					RaiseCaptureEvent(contact, MultitouchScreen.GotContactCaptureEvent, contact.InputArgs.Captured, timestamp);
			}
			return true;
		}
开发者ID:zhuangfangwang,项目名称:ise,代码行数:26,代码来源:ContactsManager.cs


示例2: Focus

        /// <summary>
        /// Focuses a control.
        /// </summary>
        /// <param name="control">The control to focus.</param>
        /// <param name="method">The method by which focus was changed.</param>
        /// <param name="modifiers">Any input modifiers active at the time of focus.</param>
        public void Focus(
            IInputElement control, 
            NavigationMethod method = NavigationMethod.Unspecified,
            InputModifiers modifiers = InputModifiers.None)
        {
            if (control != null)
            {
                var scope = GetFocusScopeAncestors(control)
                    .FirstOrDefault();

                if (scope != null)
                {
                    Scope = scope;
                    SetFocusedElement(scope, control, method, modifiers);
                }
            }
            else if (Current != null)
            {
                // If control is null, set focus to the topmost focus scope.
                foreach (var scope in GetFocusScopeAncestors(Current).Reverse().ToList())
                {
                    IInputElement element;

                    if (_focusScopes.TryGetValue(scope, out element))
                    {
                        Focus(element, method);
                        break;
                    }
                }
            }
        }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:37,代码来源:FocusManager.cs


示例3: SetFocusedElement

        public void SetFocusedElement(IInputElement element, NavigationMethod method)
        {
            if (element != FocusedElement)
            {
                var interactive = FocusedElement as IInteractive;

                if (interactive != null)
                {
                    interactive.RaiseEvent(new RoutedEventArgs
                    {
                        RoutedEvent = InputElement.LostFocusEvent,
                    });
                }

                FocusedElement = element;
                interactive = element as IInteractive;

                if (interactive != null)
                {
                    interactive.RaiseEvent(new GotFocusEventArgs
                    {
                        RoutedEvent = InputElement.GotFocusEvent,
                        NavigationMethod = method,
                    });
                }
            }
        }
开发者ID:Mike-EEE,项目名称:Perspex,代码行数:27,代码来源:KeyboardDevice.cs


示例4: ManipulationDeltaEventArgs

        /// <summary>
        ///     Instantiates a new instance of this class.
        /// </summary> 
        internal ManipulationDeltaEventArgs(
            ManipulationDevice manipulationDevice, 
            int timestamp, 
            IInputElement manipulationContainer,
            Point origin, 
            ManipulationDelta delta,
            ManipulationDelta cumulative,
            ManipulationVelocities velocities,
            bool isInertial) 
            : base(manipulationDevice, timestamp)
        { 
            if (delta == null) 
            {
                throw new ArgumentNullException("delta"); 
            }

            if (cumulative == null)
            { 
                throw new ArgumentNullException("cumulative");
            } 
 
            if (velocities == null)
            { 
                throw new ArgumentNullException("velocities");
            }

            RoutedEvent = Manipulation.ManipulationDeltaEvent; 

            ManipulationContainer = manipulationContainer; 
            ManipulationOrigin = origin; 
            DeltaManipulation = delta;
            CumulativeManipulation = cumulative; 
            Velocities = velocities;
            IsInertial = isInertial;
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:38,代码来源:ManipulationDeltaEventArgs.cs


示例5: Unregister

        /// <summary>
        /// Unregister one key bound to a particular element
        /// </summary>
        /// <param name="key"></param>
        /// <param name="element"></param>
        public static void Unregister(string key, IInputElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            key = NormalizeKey(key);

            AccessKeyManager akm = AccessKeyManager.Current;

            lock (akm._keyToElements)
            {
                // Get all elements bound to this key and remove this element
                ArrayList elements = (ArrayList)akm._keyToElements[key];

                if (elements != null)
                {
                    PurgeDead(elements, element);
                    if (elements.Count == 0)
                    {
                        akm._keyToElements.Remove(key);
                    }
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:30,代码来源:AccessKeyManager.cs


示例6: GetBounds

        private Rect GetBounds(StylusPoint stylusPoint, 
            Point position,
            IInputElement relativeTo, 
            GeneralTransform elementToRoot,
            GeneralTransform rootToElement)
        {
            // Get width and heith in pixel value 
            double width = GetStylusPointWidthOrHeight(stylusPoint, /*isWidth*/ true);
            double height = GetStylusPointWidthOrHeight(stylusPoint, /*isWidth*/ false); 
 
            // Get the position with respect to root
            Point rootPoint; 
            if (elementToRoot == null ||
                !elementToRoot.TryTransform(position, out rootPoint))
            {
                rootPoint = position; 
            }
 
            // Create a Rect with respect to root and transform it to element coordinate space 
            Rect rectBounds = new Rect(rootPoint.X - width * 0.5, rootPoint.Y - height * 0.5, width, height);
            if (rootToElement != null) 
            {
                rectBounds = rootToElement.TransformBounds(rectBounds);
            }
            return rectBounds; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:26,代码来源:StylusTouchDevice.cs


示例7: Unregister

 /// <summary>
 /// Unregisters the access keys associated with the input element.
 /// </summary>
 /// <param name="element">The input element.</param>
 public void Unregister(IInputElement element)
 {
     foreach (var i in _registered.Where(x => x.Item2 == element).ToList())
     {
         _registered.Remove(i);
     }
 }
开发者ID:Arlorean,项目名称:Perspex,代码行数:11,代码来源:MenuItemAccessKeyHandler.cs


示例8: OnPaste

		private void OnPaste(IInputElement container)
		{
			using (new WaitWrapper())
			using (new TimeCounter("Command.Paste: {0}"))
				if (this.FitsCanvas(this.clipboard.Buffer))
				{
					DesignerCanvas.Toolbox.SetDefault();
					DesignerCanvas.DeselectAll();

					var newElements = this.clipboard.Buffer
						.Select(element =>
						{
							var newElement = element.Clone();
							newElement.UID = Guid.NewGuid();
							return newElement;
						})
						.ToList();

					this.NormalizeBuffer(container, newElements);
					var newItems = newElements.Select(element => DesignerCanvas.CreateElement(element)).ToList();

					newItems.ForEach(item => item.IsSelected = true);
					ServiceFactoryBase.Events.GetEvent<ElementAddedEvent>().Publish(DesignerCanvas.SelectedElements.ToList());
					newItems.ForEach(item => item.IsSelected = true);
					MoveToFrontCommand.Execute();
					DesignerCanvas.DesignerChanged();
					if (this.clipboard.SourceAction == ClipboardSourceAction.Cut)
						this.clipboard.Clear();
				}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:30,代码来源:BasePlanDesignerViewModel.CopyPaste.cs


示例9: GetIntermediateTouchPoints

        public override TouchPointCollection GetIntermediateTouchPoints(IInputElement relativeTo)
        {
            TouchPointCollection collection = new TouchPointCollection();
            UIElement element = relativeTo as UIElement;

            if (element == null)
                return collection;

            foreach (HandPointEventArgs e in intermediateEvents)
            {
                Point point = screen.MapPositionToScreen(e.Session);
                if (relativeTo != null)
                {
                    point = this.ActiveSource.RootVisual.TransformToDescendant((Visual)relativeTo).Transform(point);
                }

                //Rect rect = e.BoundingRect;
                Rect rect = new Rect(screen.MapPositionToScreen(e.Session),
                                 new Size(1, 1));

                TouchAction action = TouchAction.Move;
                if (lastEventArgs.Status == HandPointStatus.Down)
                {
                    action = TouchAction.Down;
                }
                else if (lastEventArgs.Status == HandPointStatus.Up)
                {
                    action = TouchAction.Up;
                }
                collection.Add(new TouchPoint(this, point, rect, action));
            }
            return collection;
        }
开发者ID:InfoStrat,项目名称:MotionFx,代码行数:33,代码来源:MotionTrackingTouchDevice.cs


示例10: WpfUIResizeOperationHandleConnector

 public WpfUIResizeOperationHandleConnector(ICanvasItem canvasItem, IInputElement parent, IEdgeSnappingEngine snappingEngine)
 {
     CanvasItem = canvasItem;
     Parent = parent;
     SnappingEngine = snappingEngine;
     Handles = new Dictionary<IInputElement, IPoint>();
 }
开发者ID:postsharp,项目名称:VisualDesigner,代码行数:7,代码来源:WpfUIResizeOperationHandleConnector.cs


示例11: GetKeys

		private static Keys[] GetKeys(IInputElement focusElement)
		{
			// the buffer must be exactly 256 bytes long as per API definition
			var keyStates = new byte[256];

			if (!NativeGetKeyboardState(keyStates))
				throw new Win32Exception(Marshal.GetLastWin32Error());

			var pressedKeys = new List<Keys>();
			if (focusElement.IsKeyboardFocused)
			{
				// skip the first 8 entries as they are actually mouse events and not keyboard keys
				const int skipMouseKeys = 8;
				for (int i = skipMouseKeys; i < keyStates.Length; i++)
				{
					byte key = keyStates[i];

					//Logical 'and' so we can drop the low-order bit for toggled keys, else that key will appear with the value 1!
					if ((key & 0x80) != 0)
					{

						//This is just for a short demo, you may want this to return
						//multiple keys!
						if (key != 0)
							pressedKeys.Add((Keys)i);
					}
				}
			}
			return pressedKeys.ToArray();
		}
开发者ID:Ziriax,项目名称:MonoGame.Framework.WpfInterop,代码行数:30,代码来源:WpfKeyboard.cs


示例12: WpfKeyboard

		/// <summary>
		/// Creates a new instance of the keyboard helper.
		/// </summary>
		/// <param name="focusElement">The element that will be used as the focus point. Provide your implementation of <see cref="WpfGame"/> here.</param>
		public WpfKeyboard(IInputElement focusElement)
		{
			if (focusElement == null)
				throw new ArgumentNullException(nameof(focusElement));

			_focusElement = focusElement;
		}
开发者ID:Ziriax,项目名称:MonoGame.Framework.WpfInterop,代码行数:11,代码来源:WpfKeyboard.cs


示例13: ExecuteCommitEdit

 /// <summary>
 /// 提交树型表格内部某元素引发的修改。
 /// </summary>
 public static void ExecuteCommitEdit(IInputElement target)
 {
     if (TreeGrid.CommitEditCommand.CanExecute(null, target))
     {
         TreeGrid.CommitEditCommand.Execute(null, target);
     }
 }
开发者ID:569550384,项目名称:Rafy,代码行数:10,代码来源:TreeGridHelper.cs


示例14: ShowDialog

        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ModelPropertyEntryToOwnerActivityConverter ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();
            ModelItem activityItem =
                ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;
            EditingContext context = activityItem.GetEditingContext();

            ModelItem parentModelItem =
                ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null) as ModelItem;
            ModelItemDictionary arguments = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Dictionary;

            DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions
            {
                Title = propertyValue.ParentProperty.DisplayName
            };

            using (ModelEditingScope change = arguments.BeginEdit("PowerShellParameterEditing"))
            {
                if (DynamicArgumentDialog.ShowDialog(activityItem, arguments, context, activityItem.View, options))
                {
                    change.Complete();
                }
                else
                {
                    change.Revert();
                }
            }
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:28,代码来源:ArgumentDictionaryEditor.cs


示例15: ShowDialog

        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ModelPropertyEntryToOwnerActivityConverter propertyEntryConverter =
                new ModelPropertyEntryToOwnerActivityConverter();

            ModelItem activityModelItem =
                (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);

            ModelItem parentModelItem =
                (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null);

            EditingContext context = ((IModelTreeItem)activityModelItem).ModelTreeManager.Context;

            var inputData = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Collection;            

            DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions
            { 
                Title = propertyValue.ParentProperty.DisplayName, 
            };

            using (EditingScope scope = context.Services.GetRequiredService<ModelTreeManager>().CreateEditingScope(StringResourceDictionary.Instance.GetString("InvokeMethodParameterEditing"), true))
            {
                if (DynamicArgumentDialog.ShowDialog(activityModelItem, inputData, context, activityModelItem.View, options))
                {
                    scope.Complete();
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:28,代码来源:ArgumentCollectionPropertyEditor.cs


示例16: GetPreviousInTabOrder

        /// <summary>
        /// Gets the next element in tab order.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns>The next element in tab order.</returns>
        public static IInputElement GetPreviousInTabOrder(IInputElement element)
        {
            Contract.Requires<ArgumentNullException>(element != null);

            var container = element.GetVisualParent<IInputElement>();

            if (container != null)
            {
                var mode = KeyboardNavigation.GetTabNavigation((InputElement)container);

                switch (mode)
                {
                    case KeyboardNavigationMode.Continue:
                        return GetPreviousInContainer(element, container) ??
                               GetLastInPreviousContainer(element);
                    case KeyboardNavigationMode.Cycle:
                        return GetPreviousInContainer(element, container) ??
                               GetDescendents(container).LastOrDefault();
                    default:
                        return GetLastInPreviousContainer(container);
                }
            }
            else
            {
                return GetDescendents(element).LastOrDefault();
            }
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:32,代码来源:KeyboardNavigationHandler.cs


示例17: Execute

 public new void Execute(object parameter, IInputElement element)
 {
     if (_func != null)
         _func(parameter, element);
     else if (_funcObj != null)
         _funcObj(parameter);
 }
开发者ID:nickhodge,项目名称:MahTweets.LawrenceHargrave,代码行数:7,代码来源:SendMessageCommand.cs


示例18: Register

        /// <summary>
        ///   Register the access key binding to the element that is the accesskey.
        /// </summary>
        /// <param name="key">When the key is pressed the element OnAccessKey method is called</param>
        /// <param name="element">The registration element</param>
        public static void Register(string key, IInputElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            key = NormalizeKey(key);

            AccessKeyManager akm = AccessKeyManager.Current;

            lock (akm._keyToElements)
            {
                ArrayList elements = (ArrayList)akm._keyToElements[key];

                if (elements == null)
                {
                    elements = new ArrayList(1);
                    akm._keyToElements[key] = elements;
                }
                else
                {
                    // There were some elements there, remove dead ones
                    PurgeDead(elements, null);
                }

                elements.Add(new WeakReference(element));
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:33,代码来源:AccessKeyManager.cs


示例19: ToolBarButtonVM

		public ToolBarButtonVM(ICommand command, IInputElement commandTarget, string header, string toolTip, ImageReference? imageReference) {
			Command = command;
			CommandTarget = commandTarget;
			Header = string.IsNullOrEmpty(header) ? null : header;
			ToolTip = string.IsNullOrEmpty(toolTip) ? null : toolTip;
			ImageReference = imageReference ?? default(ImageReference);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:ToolBarButtonVM.cs


示例20: SetFocusedElement

        public void SetFocusedElement(
            IInputElement element, 
            NavigationMethod method,
            InputModifiers modifiers)
        {
            if (element != FocusedElement)
            {
                var interactive = FocusedElement as IInteractive;

                interactive?.RaiseEvent(new RoutedEventArgs
                {
                    RoutedEvent = InputElement.LostFocusEvent,
                });

                FocusedElement = element;
                interactive = element as IInteractive;

                interactive?.RaiseEvent(new GotFocusEventArgs
                {
                    RoutedEvent = InputElement.GotFocusEvent,
                    NavigationMethod = method,
                    InputModifiers = modifiers,
                });
            }
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:25,代码来源:KeyboardDevice.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IInputField类代码示例发布时间:2022-05-24
下一篇:
C# IInputContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap