Ejemplo n.º 1
0
		public IPreviewResult Handle(IContact contact)
		{
			Point transformedCoordinates;
			IntPtr hWnd = desktop.GetWindowAt(new Point((int)contact.X, (int)contact.Y), out transformedCoordinates);

			if (new SystemWindow(hWnd).WindowState == FormWindowState.Normal)
			{
				switch (contact.State)
				{
					case ContactState.New:
						OnNewContact(hWnd, contact);
						break;
					case ContactState.Removed:
						OnContactRemoved(hWnd, contact);
						break;
					case ContactState.Moved:
						OnContactMoved(hWnd, contact);
						break;
					default:
						throw new ArgumentOutOfRangeException();
				}
			}
			TransformedContact newContact = new TransformedContact(contact);
			newContact.X = transformedCoordinates.X;
			newContact.Y = transformedCoordinates.Y;
			return new Result(hWnd, newContact);
		}
Ejemplo n.º 2
0
        public IPreviewResult Handle(IContact contact)
        {
            Point  transformedCoordinates;
            IntPtr hWnd = desktop.GetWindowAt(new Point((int)contact.X, (int)contact.Y), out transformedCoordinates);

            if (new SystemWindow(hWnd).WindowState == FormWindowState.Normal)
            {
                switch (contact.State)
                {
                case ContactState.New:
                    OnNewContact(hWnd, contact);
                    break;

                case ContactState.Removed:
                    OnContactRemoved(hWnd, contact);
                    break;

                case ContactState.Moved:
                    OnContactMoved(hWnd, contact);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            TransformedContact newContact = new TransformedContact(contact);

            newContact.X = transformedCoordinates.X;
            newContact.Y = transformedCoordinates.Y;
            return(new Result(hWnd, newContact));
        }