Ejemplo n.º 1
0
        private GesturesCollection GetRecognizedGestures(string name)
        {
            GesturesCollection recognizedGestures = new GesturesCollection();

            m_hwndWindowToUse = GetWindowToUse(m_cursorPosition);
            IntPtr hwnd = m_hwndWindowToUse;// GetWindowToUse(m_cursorPosition); //m_hwndWndToUse;

            //if (Config.User.handleWndUnderCursor)
            //    hwnd = m_mouse.ActiveWindow;
            //else
            //    hwnd = m_hwndWndToUse;
            foreach (MyGesture gesture in learntGestures.MatchedGestures(name))
            {
                if (gesture.IsActive(hwnd))
                {
                    recognizedGestures.Add(gesture);
                    if (gesture.ExecutionType == ExecuteType.Implicit || gesture.IsImplicitOnly)
                    {
                        recognizedGestures.Clear();
                        recognizedGestures.Add(gesture);
                        break;
                    }
                }
            }
            return(recognizedGestures);
        }
Ejemplo n.º 2
0
        public static GesturesCollection LoadGestures()
        {
            GesturesCollection gestures = new GesturesCollection();
            Stream             stream   = null;

            try
            {
                stream = File.Open(Config.Default.FilesLocation + GESTURES, FileMode.Open);
                BinaryFormatter bFormatter = new BinaryFormatter();
                gestures = (GesturesCollection)bFormatter.Deserialize(stream);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                gestures.Add(MyGesture.GlobalGroup);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }
            return(gestures);
        }