Пример #1
0
        private static bool ProcessRawInput(IntPtr hRawInput)
        {
            if (RawInput != null)
            {
                RawInputEventArgs args;

                try
                {
                    args = new RawInputEventArgs(hRawInput);
                }
                catch
                {
#if DEBUG
                    throw;
#else
                    return(false);
#endif // DEBUG
                }

                RawInput(null, args);
                return(true);
            }

            return(false);
        }
Пример #2
0
		void RawDevice_RawInput(object sender, RawInputEventArgs e)
		{
			if (devices.Contains(e.Handle))
			{
				DeviceStatus state = devices[e.Handle];
				MouseData mouseData = e.GetRawData() as MouseData;
				if (mouseData != null)
					UpdateMouse(mouseData, state);
				else
				{
					DeviceData deviceData = e.GetRawData() as DeviceData;
					if (deviceData != null)
						UpdatePen(deviceData, state);
				}

				if(state.ButtonState == DeviceState.None)
					return;

				MouseContact contact = null;
				if (state.ButtonState == DeviceState.Down)
				{
					contact = new MouseContact(state);
					//Debug.WriteLine("Down: " + contact);
					contacts.Add(contact);
				}
				else if ((state.ButtonState == DeviceState.Move || state.ButtonState == DeviceState.Up) && contacts.Contains(e.Handle))
				{
					contact = contacts[e.Handle];
					//Debug.WriteLine("Move: " + contact);
					contact.Update(state);
				}
				if (contact != null)
					inputProvider.EnqueueContact(contact);
				if (state.ButtonState == DeviceState.Up)
				{
					contact = contacts[e.Handle];
					contact.Update(state);
					//Debug.WriteLine("Up: " + contact);
					contacts.Remove(e.Handle);
				}
			}
		}
Пример #3
0
		private static bool ProcessRawInput(IntPtr hRawInput)
		{
			if (RawInput != null)
			{
				RawInputEventArgs args;

				try
				{
					args = new RawInputEventArgs(hRawInput);
				}
				catch
				{
#if DEBUG
					throw;
#else
                    return false;
#endif // DEBUG
				}

				RawInput(null, args);
				return true;
			}

			return false;
		}