本文整理汇总了C#中System.Windows.Input.InputEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# InputEventArgs类的具体用法?C# InputEventArgs怎么用?C# InputEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputEventArgs类属于System.Windows.Input命名空间,在下文中一共展示了InputEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInput
protected override void OnInput(object sender, InputEventArgs e)
{
if (this._gestureStarted)
{
base.OnInput(sender, e);
}
}
示例2: Matches
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
var args = inputEventArgs as KeyEventArgs;
if ((args == null) || !IsDefinedKey(args.Key))
{
return false;
}
Debug.WriteLine("Modifiers: " + Keyboard.Modifiers);
if (IsTooLongFromLastKey() || IsWrongModifiers() || IsWrongKey(args.Key))
{
currentKeyIndex = 0;
return false;
}
++currentKeyIndex;
if (IsMatchingContinued())
{
lastPress = DateTime.Now;
inputEventArgs.Handled = true;
return false;
}
currentKeyIndex = 0;
Debug.WriteLine("Match completed!");
return true;
}
示例3: Matches
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
if (this._index >= this._gestures.Count) this._index = 0;
KeyEventArgs e = inputEventArgs as KeyEventArgs;
if (e == null || IsIgnorableKey(e.Key, e.KeyboardDevice.Modifiers))
{
return false;
}
if (this._index > 0 && (DateTime.Now - this._lastKeyPress) > _keyPressInterval)
{
this._index = 0;
}
if (this._gestures[this._index].Matches(targetElement, inputEventArgs))
{
this._lastKeyPress = DateTime.Now;
this._index++;
inputEventArgs.Handled = true;
return (this._index == this._gestures.Count);
}
else
{
this._index = 0;
return false;
}
}
示例4: Button_PreviewCSEDown
private void Button_PreviewCSEDown(object sender, InputEventArgs e)
{
items.IndexOf(files[0]);
MainLibraryStack.SelectedIndex = items.IndexOf(files[0]);
//items.Remove(files[1]);
//items.Insert(0, files[1]);
}
示例5: Matches
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
var args = inputEventArgs as KeyEventArgs;
// Don't execute input binding in case focus is on a textbox
if ((inputEventArgs.Device.Target is TextBoxBase || inputEventArgs.Device.Target is WebBrowser)
&& !(modifers == ModifierKeys.Control || modifers == ModifierKeys.Alt))
return false;
if (args == null)
return false;
bool match;
if (useModifiers)
match = args.Key == key && args.KeyboardDevice.Modifiers == modifers;
else
{
match = (args.Key == key && args.KeyboardDevice.Modifiers == ModifierKeys.None);
// To not interfere with multiple key gestures
if (previous == Key.G || previous == Key.N || previous == Key.A)
match = false;
}
previous = args.Key;
return match;
}
示例6: IsDeviceValid
protected override bool IsDeviceValid(bool? wasValid, InputEventArgs args)
{
var motionDevice = args.Device as MotionTrackingDevice;
if (motionDevice != null)
motionDevice.ShouldPromoteToTouch = true;
return true;
}
示例7: Matches
///
/// When overridden in a derived class, determines whether the specified matches the input associated with the specified object.
///
/// The target of the command.
/// The input event data to compare this gesture to.
///
/// true if the gesture matches the input; otherwise, false.
///
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
KeyEventArgs args = inputEventArgs as KeyEventArgs;
if (args != null)
return (Key == args.Key);
else
return false;
}
示例8: LeftSlideClick
private void LeftSlideClick(object sender, InputEventArgs e)
{
imageIndex--;
if (imageIndex < 1) {
imageIndex = 8;
}
SlideShow(imageIndex);
timer.Interval = new TimeSpan(0, 0, 4);
}
示例9: RightSlideClick
private void RightSlideClick(object sender, InputEventArgs e)
{
imageIndex++;
if (imageIndex > 8) {
imageIndex = 1;
}
SlideShow(imageIndex);
timer.Interval = new TimeSpan(0, 0, 4);
}
示例10: Matches
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
var action = GetExtendedMouseAction(inputEventArgs);
if (action != null && extendedMouseAction == action.Value)
{
return Modifiers == Keyboard.Modifiers;
}
return base.Matches(targetElement, inputEventArgs);
}
示例11: PushInput
public StagingAreaInputItem PushInput(InputEventArgs input,
StagingAreaInputItem promote) // Note: this should be a bool, and always use the InputItem available on these args.
{
if(!_allowAccessToStagingArea)
{
throw new InvalidOperationException(SR.Get(SRID.NotAllowedToAccessStagingArea));
}
return this.UnsecureInputManager.PushInput(input, promote);
}
示例12: LayoutRoot_TouchDown
private void LayoutRoot_TouchDown(object sender, InputEventArgs e)
{
var yi = DataContext as YearItem;
if (yi == null)
return;
yi.Orientation = e.Device.GetOrientation(null) + 90;
yi.Position = e.Device.GetPosition(null);
yi.Position.X -= 100;
yi.Position.Y -= 50;
(DataContext as YearItem).ShowText = true;
}
示例13: badgeDoubleTap
public void badgeDoubleTap(object sender, InputEventArgs e)
{
RaiseEvent(new RoutedEventArgs(RequestLargeViewEvent));
if(e!=null)
e.Handled = true;
//var ap = DataContext as ArgPoint;
//var id = ap.Id;
//var zoomedAp = DbCtx.Get().ArgPoint.FirstOrDefault(ap0 => ap0.Id == id);
//var zoom = new ZoomWindow(zoomedAp);
//zoom.ShowDialog();
}
示例14: Matches
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
if (m_hackMode)
{
KeyEventArgs args = inputEventArgs as KeyEventArgs;
return args != null && Keyboard.Modifiers == ModifierKeys.None && this.Key == args.Key;
}
else
{
return base.Matches(targetElement, inputEventArgs);
}
}
示例15: Matches
public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
{
// Don't execute input binding in case focus is on a textbox
if ((inputEventArgs.Device.Target is TextBoxBase || inputEventArgs.Device.Target is WebBrowser)
&& !(modifiers == ModifierKeys.Control || modifiers == ModifierKeys.Alt))
return false;
var args = inputEventArgs as KeyEventArgs;
if ((args == null) || !IsDefinedKey(args.Key))
{
return false;
}
if (_currentKeyIndex != 0 && ((DateTime.Now - _lastKeyPress) > _maximumDelayBetweenKeyPresses))
{
//took too long to press next key so reset
_currentKeyIndex = 0;
return false;
}
//the modifier only needs to be held down for the first keystroke, but you could also require that the modifier be held down for every keystroke
if (_currentKeyIndex == 0 && Modifiers != Keyboard.Modifiers)
{
//wrong modifiers
_currentKeyIndex = 0;
return false;
}
if (_keys[_currentKeyIndex] != args.Key)
{
//wrong key
_currentKeyIndex = 0;
return false;
}
++_currentKeyIndex;
if (_currentKeyIndex != _keys.Count)
{
//still matching
_lastKeyPress = DateTime.Now;
inputEventArgs.Handled = true;
return false;
}
//match complete
_currentKeyIndex = 0;
return true;
}