Beispiel #1
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (myHandle != IntPtr.Zero)
     {
         HTCNativeMethods.HTCSensorClose(myHandle);
         myHandle = IntPtr.Zero;
     }
 }
Beispiel #2
0
        public HTCNavSensor(Form form)
        {
            myHandler    = new WndProcHandler(WndProc);
            myForm       = form;
            myOldWndProc = SetWindowLong(form.Handle, WindowLong.GWL_WNDPROC, Marshal.GetFunctionPointerForDelegate(myHandler));
            int ret = HTCNativeMethods.HTCNavOpen(form.Handle, HTCNativeMethods.HTCNavOpenAPI);

            ret = HTCNativeMethods.HTCNavSetMode(form.Handle, HTCAPIMode.Gesture);
        }
Beispiel #3
0
        public static HTCGSensor Create()
        {
            IntPtr hEvent = CreateEvent(IntPtr.Zero, true, false, "HTC_GSENSOR_SERVICESTART");

            SetEvent(hEvent);
            CloseHandle(hEvent);
            IntPtr handle = HTCNativeMethods.HTCSensorOpen(HTCSensor.GSensor);

            return(new HTCGSensor(handle));
        }
Beispiel #4
0
 public void Dispose()
 {
     if (myOldWndProc != IntPtr.Zero && myForm != null)
     {
         SetWindowLong(myForm.Handle, WindowLong.GWL_WNDPROC, myOldWndProc);
         myOldWndProc = IntPtr.Zero;
     }
     HTCNativeMethods.HTCNavClose(HTCNativeMethods.HTCNavOpenAPI);
     myForm    = null;
     myRotated = null;
 }
Beispiel #5
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (myHandle != IntPtr.Zero)
            {
                HTCNativeMethods.HTCSensorClose(myHandle);
                myHandle = IntPtr.Zero;
            }

            // note: I noticed in Scott's code, on the shutdown he fires the "HTC_GSENSOR_SERVICESTART" event again.
            // I am guessing that is a bug in his code.
            // My theory is the service start/stop manage a reference count to the service.
            // Once it hits 0, the service is stopped.
            IntPtr hEvent = CreateEvent(IntPtr.Zero, true, false, "HTC_GSENSOR_SERVICESTOP");

            SetEvent(hEvent);
            CloseHandle(hEvent);
        }
Beispiel #6
0
 public static HTCLightSensor Create()
 {
     return(new HTCLightSensor(HTCNativeMethods.HTCSensorOpen(HTCSensor.Light)));
 }