本文整理汇总了C#中IMouse类的典型用法代码示例。如果您正苦于以下问题:C# IMouse类的具体用法?C# IMouse怎么用?C# IMouse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMouse类属于命名空间,在下文中一共展示了IMouse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
stubKeyboard = MockRepository.GenerateStub<IKeyboard>();
stubMouse = MockRepository.GenerateStub<IMouse>();
stubKeyMapping = MockRepository.GenerateStub<IKeyMapping>();
gameInput = new GameInput(stubKeyMapping, stubKeyboard, stubMouse);
}
示例2: MouseButton
public MouseButton(IMouse mouse, MouseButtonLabel button)
{
this.mouse = mouse;
this.button = button;
prevPressed = false;
nowPressed = false;
}
示例3: Initialize
public static void Initialize(
IConsole console,
ISurface surface,
IStyle style,
IDrawings drawing,
IShapes shapes,
IImages images,
IControls controls,
ISounds sounds,
IKeyboard keyboard,
IMouse mouse,
ITimer timer,
IFlickr flickr,
ISpeech speech,
CancellationToken token)
{
TextWindow.Init(console);
Desktop.Init(surface);
GraphicsWindow.Init(style, surface, drawing, keyboard, mouse);
Shapes.Init(shapes);
ImageList.Init(images);
Turtle.Init(surface, drawing, shapes);
Controls.Init(controls);
Sound.Init(sounds);
Timer.Init(timer);
Stack.Init();
Flickr.Init(flickr);
Speech.Init(speech);
Program.Init(token);
}
示例4: Before
public void Before()
{
this.mouse = A.Fake<IMouse>(wrapped => wrapped.Wrapping(this.CreateMouse()));
A.CallTo(() => this.mouse.LeftDown()).Invokes(_ => { });
A.CallTo(() => this.mouse.LeftDown(A<Coordinate>._)).Invokes(_ => { });
Logger.Debug = Console.WriteLine;
}
示例5: MoveMouseAction
/// <summary>
/// Initializes a new instance of the <see cref="MoveMouseAction"/> class.
/// </summary>
/// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
/// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
public MoveMouseAction(IMouse mouse, ILocatable actionTarget)
: base(mouse, actionTarget)
{
if (actionTarget == null)
{
throw new ArgumentException("Must provide a location for a move action.", "actionTarget");
}
}
示例6: WindowRelativeMouse
internal WindowRelativeMouse(IntPtr parenthWnd, IntPtr hWnd, IMouse mouse, INativeMethodWrapper nativeMethodWrapper, IRetrier retry, Settings settings = null)
{
this.parenthWnd = parenthWnd;
this.hWnd = hWnd;
this.absoluteMouse = mouse;
this.nativeMethodWrapper = nativeMethodWrapper;
this.retry = retry;
this.settings = settings ?? new Settings();
}
示例7: Before
public void Before()
{
this.hWnd = new IntPtr(1337);
this.innerMouse = A.Fake<IMouse>();
this.nativeMethodWrapper = A.Fake<INativeMethodWrapper>();
this.retrierFactory = new NRetryTimerFactory(0);
this.retrier = new Retrier(this.retrierFactory);
this.windowRelativeMouse = new WindowRelativeMouse(this.hWnd, this.hWnd, this.innerMouse, this.nativeMethodWrapper, this.retrier);
}
示例8: SingleKeyAction
/// <summary>
/// Initializes a new instance of the <see cref="SingleKeyAction"/> class.
/// </summary>
/// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
/// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
/// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
/// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
protected SingleKeyAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
: base(keyboard, mouse, actionTarget)
{
if (!ModifierKeys.Contains(key))
{
throw new ArgumentException("key must be a modifier key (Keys.Shift, Keys.Control, or Keys.Alt)", "key");
}
this.key = key;
}
示例9: OnMouseClick
public void OnMouseClick(IMouse mouse, Point location)
{
switch (_state)
{
case State.WaitLineBeginPoint:
_begin = location;
_state = State.WaitLineEndPoint;
break;
case State.WaitLineEndPoint:
_end = location;
_state = State.WaitLineBeginPoint;
mouse.DrawPad.Add(new Line(_begin, _end));
break;
}
}
示例10: Init
internal static void Init(
IStyle style,
ISurface surface,
IDrawings graphics,
IKeyboard keyboard,
IMouse mouse)
{
_surface = surface;
_drawings = graphics;
_keyboard = keyboard;
_style = style;
_mouse = mouse;
PenWidth = 2.0;
BrushColor = "purple";
PenColor = "black";
FontSize = 12;
FontName = "Tahoma";
}
示例11: KeyDownAction
/// <summary>
/// Initializes a new instance of the <see cref="KeyDownAction"/> class.
/// </summary>
/// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
/// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
/// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
/// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
public KeyDownAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
: base(keyboard, mouse, actionTarget, key)
{
}
示例12: Init
public void Init(IMaze maze, IMouse mouse)
{
Maze = maze;
Mouse = mouse;
}
示例13: FindCheese
/*
* code reference:
* http://blogs.msdn.com/b/mattwar/archive/2005/02/11/371274.aspx
*
* julia's comment:
* 1. try to identify the cycle detection / back tracking code
* 2. Try to understand code.
*/
public static bool FindCheese(IMouse mouse, int rows, int cols)
{
Cell[,] grid = new Cell[rows, cols];
int r = 0;
int c = 0;
// set terminal, so we don't backtrack past the origin
grid[r, c].prev = 4;
while (!mouse.IsCheeseHere()) {
byte d = grid[r,c].next;
if (d < 4) {
// increment so we know what to try next
grid[r,c].next++;
// determine next relative position
int nr = (r + dr[d] + rows) % rows;
int nc = (c + dc[d] + cols) % cols;
// only try to move to cells we have not already visited
if (grid[nr,nc].next == 0 && mouse.Move((Direction)d)) {
r = nr;
c = nc;
// remember how to get back
grid[r, c].prev = (byte)((d + 2) % 4);
}
}
else {
// backtrack
d = grid[r, c].prev;
if (d == 4)
return false;
mouse.Move((Direction)d);
r = (r + dr[d] + rows) % rows;
c = (c + dc[d] + cols) % cols;
}
}
return true;
}
示例14: Actions
/// <summary>
/// Initializes a new instance of the <see cref="Actions"/> class.
/// </summary>
/// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param>
public Actions(IWebDriver driver)
{
IHasInputDevices inputDevicesDriver = driver as IHasInputDevices;
if (inputDevicesDriver == null)
{
IWrapsDriver wrapper = driver as IWrapsDriver;
while (wrapper != null)
{
inputDevicesDriver = wrapper.WrappedDriver as IHasInputDevices;
if (inputDevicesDriver != null)
{
break;
}
wrapper = wrapper.WrappedDriver as IWrapsDriver;
}
}
if (inputDevicesDriver == null)
{
throw new ArgumentException("The IWebDriver object must implement or wrap a driver that implements IHasInputDevices.", "driver");
}
this.keyboard = inputDevicesDriver.Keyboard;
this.mouse = inputDevicesDriver.Mouse;
}
示例15: Start
void Start()
{
Mouse = MouseManager.Instance;
//Gamepads = GamepadsManager.Instance;
DestinationDistance = 100;
introTrack = GetComponentsInChildren<AudioSource>()[1];
}