Example #1
0
		public void Start()
		{
			communicator = new DriverCommunicator();

			contactHandler = new ContactHandler(IntPtr.Zero);
			contactHandler.Frame += contactHandler_Frame;
		}
Example #2
0
		void Window1_Loaded(object sender, RoutedEventArgs e)
		{
			WindowInteropHelper helper = new WindowInteropHelper(this);
			contactHandler = new ContactHandler(helper.Handle);
			contactHandler.Frame += HandleFrame;
			contactHandler.ReceiveImageType(ImageType.Binarized, true);
			contactHandler.ReceiveEmptyFrames = true;
		}
Example #3
0
		private void Form1_Load(object sender, EventArgs e)
		{
			contactHandler = new ContactHandler(Handle);
			contactHandler.NewContact += HandleContact;
			contactHandler.ContactRemoved += HandleContact;
			contactHandler.ContactMoved += HandleContact;
			contactHandler.Frame += HandleFrame;
			contactHandler.ReceiveImageType(ImageType.Normalized, true);
			contactHandler.ReceiveImageType(ImageType.Binarized, true);
			contactHandler.ReceiveEmptyFrames = true;
		}
Example #4
0
		public void UnregisterHandler(ContactHandler handler)
		{
			HashSet<ContactHandler> contactHandlers;
			if(windowsMap.TryGetValue(handler.Handle, out contactHandlers))
			{
				contactHandlers.Remove(handler);
				serviceCommunicator.RemoveWindowFromSession(handler.Handle);
				if (contactHandlers.Count == 0)
					windowsMap.Remove(handler.Handle);
				if(windowsMap.Count == 0)
					serviceCommunicator.RemoveSession();
			}
		}
		public MultitouchInputProvider(PresentationSource source)
		{
			this.source = source;
			contactsQueue = new Queue<RawMultitouchReport>();
			inputManagerProcessInput = InputManagerProcessInput;

            contactHandler = new ContactHandler(((HwndSource)source).Handle);
            contactHandler.ContactMoved += HandleContact;
            contactHandler.ContactRemoved += HandleContact;
            contactHandler.NewContact += HandleContact;

			inputManager = InputManager.Current;
			multitouchLogic = MultitouchLogic.Current;
		}
Example #6
0
		public void RegisterHandler(ContactHandler handler)
		{
			HashSet<ContactHandler> contactHandlers;
			if (windowsMap.TryGetValue(handler.Handle, out contactHandlers))
				contactHandlers.Add(handler);
			else
			{
				if (windowsMap.Count == 0)
					serviceCommunicator.CreateSession();
				contactHandlers = new HashSet<ContactHandler>();
				contactHandlers.Add(handler);
				windowsMap.Add(handler.Handle, contactHandlers);
				serviceCommunicator.AddWindowToSession(handler.Handle);
			}
		}
Example #7
0
        public void UnregisterHandler(ContactHandler handler)
        {
            HashSet <ContactHandler> contactHandlers;

            if (windowsMap.TryGetValue(handler.Handle, out contactHandlers))
            {
                contactHandlers.Remove(handler);
                serviceCommunicator.RemoveWindowFromSession(handler.Handle);
                if (contactHandlers.Count == 0)
                {
                    windowsMap.Remove(handler.Handle);
                }
                if (windowsMap.Count == 0)
                {
                    serviceCommunicator.RemoveSession();
                }
            }
        }
Example #8
0
        public void RegisterHandler(ContactHandler handler)
        {
            HashSet <ContactHandler> contactHandlers;

            if (windowsMap.TryGetValue(handler.Handle, out contactHandlers))
            {
                contactHandlers.Add(handler);
            }
            else
            {
                if (windowsMap.Count == 0)
                {
                    serviceCommunicator.CreateSession();
                }
                contactHandlers = new HashSet <ContactHandler>();
                contactHandlers.Add(handler);
                windowsMap.Add(handler.Handle, contactHandlers);
                serviceCommunicator.AddWindowToSession(handler.Handle);
            }
        }
Example #9
0
		public void Stop()
		{
			contactHandler.Frame -= contactHandler_Frame;
			contactHandler.Dispose();
			contactHandler = null;
		}
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);
            foreach (string photo in Directory.GetFiles("c://CRAP", "*.jpg").Take(1))
            {
                Photos.Add(photo);
            }
            WindowInteropHelper helper = new WindowInteropHelper(this);
            ContactHandler contactHandler = new ContactHandler(helper.Handle);
            //contactHandler.ContactRemoved += HandleContact;
            //contactHandler.NewContact += HandleContact;
               // contactHandler.Frame += HandleFrame;

            FileSystemWatcher fsw = new FileSystemWatcher();
            fsw.Path = "c:\\CRAP\\";
            fsw.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
            fsw.Changed += new FileSystemEventHandler(OnChanged);
            fsw.Created += new FileSystemEventHandler(OnChanged);
            fsw.EnableRaisingEvents = true;
        }