Ejemplo n.º 1
0
        private static void ConfigureComponents()
        {
            #region Create Components

            intentFinder = new Win32GestrueIntentFinder(intentStore);
            var pathTracker = new Win32MousePathTracker2();
            gestureParser = new GestureParser(pathTracker, intentFinder);

            gestureView = new CanvasWindowGestureView(gestureParser);

            componentsToDispose.Add(gestureParser);
            componentsToDispose.Add(gestureView);
            componentsToDispose.Add(pathTracker);
            #endregion

            #region pathTracker
            pathTracker.DisableInFullscreen             = config.Get(ConfigKeys.PathTrackerDisableInFullScreen, true);
            pathTracker.PreferWindowUnderCursorAsTarget = config.Get(ConfigKeys.PathTrackerPreferCursorWindow, false);
            pathTracker.TriggerButton            = (Win32MousePathTracker2.GestureTriggerButton)config.Get(ConfigKeys.PathTrackerTriggerButton, Win32MousePathTracker2.GestureTriggerButton.Right);
            pathTracker.InitialValidMove         = config.Get(ConfigKeys.PathTrackerInitialValidMove, 4);
            pathTracker.StayTimeout              = config.Get(ConfigKeys.PathTrackerStayTimeout, true);
            pathTracker.StayTimeoutMillis        = config.Get(ConfigKeys.PathTrackerStayTimeoutMillis, 500);
            pathTracker.InitialStayTimeout       = config.Get(ConfigKeys.PathTrackerInitialStayTimeout, true);
            pathTracker.InitialStayTimeoutMillis = config.Get(ConfigKeys.PathTrackerInitialStayTimoutMillis, 150);

            pathTracker.RequestPauseResume  += paused => menuItem_pause_Click(null, EventArgs.Empty);
            pathTracker.RequestShowHideTray += ToggleTrayIconVisibility;

            #endregion

            #region gestureView
            gestureView.ShowPath               = config.Get(ConfigKeys.GestureViewShowPath, true);
            gestureView.ShowCommandName        = config.Get(ConfigKeys.GestureViewShowCommandName, true);
            gestureView.ViewFadeOut            = config.Get(ConfigKeys.GestureViewFadeOut, true);
            gestureView.PathMainColor          = Color.FromArgb(config.Get(ConfigKeys.GestureViewMainPathColor, gestureView.PathMainColor.ToArgb()));
            gestureView.PathAlternativeColor   = Color.FromArgb(config.Get(ConfigKeys.GestureViewAlternativePathColor, gestureView.PathAlternativeColor.ToArgb()));
            gestureView.PathMiddleBtnMainColor = Color.FromArgb(config.Get(ConfigKeys.GestureViewMiddleBtnMainColor, gestureView.PathMiddleBtnMainColor.ToArgb()));
            #endregion


            #region GestureParser

            gestureParser.EnableHotCorners  = config.Get(ConfigKeys.GestureParserEnableHotCorners, true);
            gestureParser.Enable8DirGesture = config.Get(ConfigKeys.GestureParserEnable8DirGesture, true);

            #endregion
        }
Ejemplo n.º 2
0
        private static void ConfigureComponents()
        {
            #region Create Components

            intentFinder = new Win32GestrueIntentFinder(intentStore);
            var pathTracker = new Win32MousePathTracker2();
            gestureParser = new GestureParser(pathTracker, intentFinder);

            gestureView = new CanvasWindowGestureView(gestureParser);

            componentsToDispose.Add(gestureParser);
            componentsToDispose.Add(gestureView);
            componentsToDispose.Add(pathTracker);
            #endregion

            #region pathTracker
            //pathTracker.GestureButton = (Win32MousePathTracker2.GestureButtons)config.Get(ConfigKeys.PathTrackerGestureButton, 0);
            pathTracker.InitialValidMove         = config.Get(ConfigKeys.PathTrackerInitialValidMove, 4);
            pathTracker.StayTimeout              = config.Get(ConfigKeys.PathTrackerStayTimeout, true);
            pathTracker.StayTimeoutMillis        = config.Get(ConfigKeys.PathTrackerStayTimeoutMillis, 500);
            pathTracker.InitialStayTimeout       = config.Get(ConfigKeys.PathTrackerInitialStayTimeout, true);
            pathTracker.InitialStayTimeoutMillis = config.Get(ConfigKeys.PathTrackerInitialStayTimoutMillis, 150);

            pathTracker.RequestPauseResume += paused => menuItem_pause_Click(null, EventArgs.Empty);

            #endregion

            #region gestureView
            gestureView.ShowPath               = config.Get(ConfigKeys.GestureViewShowPath, true);
            gestureView.ShowCommandName        = config.Get(ConfigKeys.GestureViewShowCommandName, true);
            gestureView.ViewFadeOut            = config.Get(ConfigKeys.GestureViewFadeOut, true);
            gestureView.PathMainColor          = Color.FromArgb(config.Get(ConfigKeys.GestureViewMainPathColor, gestureView.PathMainColor.ToArgb()));
            gestureView.PathAlternativeColor   = Color.FromArgb(config.Get(ConfigKeys.GestureViewAlternativePathColor, gestureView.PathAlternativeColor.ToArgb()));
            gestureView.PathMiddleBtnMainColor = Color.FromArgb(config.Get(ConfigKeys.GestureViewMiddleBtnMainColor, gestureView.PathMiddleBtnMainColor.ToArgb()));

            #endregion


            #region GestureParser
            gestureParser.DisableInFullScreenMode = config.Get(ConfigKeys.GestureParserDisableInFullScreenMode, false);
            #endregion
        }
Ejemplo n.º 3
0
        static void ConfigureComponents()
        {
            #region Create Components
            intentFinder = new Win32GestrueIntentFinder(intentStore);
            var pathTracker = new Win32MousePathTracker2();
            gestureParser = new GestureParser(pathTracker, intentFinder);

            gestureView = new CanvasWindowGestureView(gestureParser);

            componentsToDispose.Add(gestureParser);
            componentsToDispose.Add(gestureView);
            componentsToDispose.Add(pathTracker);
            componentsToDispose.Add(hotkeyMgr);
            #endregion

            #region pathTracker
            pathTracker.DisableInFullscreen             = config.Get(ConfigKeys.PathTrackerDisableInFullScreen, true);
            pathTracker.PreferWindowUnderCursorAsTarget = config.Get(ConfigKeys.PathTrackerPreferCursorWindow, false);
            pathTracker.TriggerButton             = (GestureTriggerButton)config.Get(ConfigKeys.PathTrackerTriggerButton, GestureTriggerButton.Right);
            pathTracker.InitialValidMove          = config.Get(ConfigKeys.PathTrackerInitialValidMove, 4);
            pathTracker.StayTimeout               = config.Get(ConfigKeys.PathTrackerStayTimeout, true);
            pathTracker.StayTimeoutMillis         = config.Get(ConfigKeys.PathTrackerStayTimeoutMillis, 500);
            pathTracker.InitialStayTimeout        = config.Get(ConfigKeys.PathTrackerInitialStayTimeout, true);
            pathTracker.InitialStayTimeoutMillis  = config.Get(ConfigKeys.PathTrackerInitialStayTimoutMillis, 150);
            pathTracker.RequestPauseResume       += paused => menuItem_pause_Click(null, EventArgs.Empty);
            pathTracker.EnableWindowsKeyGesturing = config.Get(ConfigKeys.EnableWindowsKeyGesturing, false);
            pathTracker.RequestShowHideTray      += ToggleTrayIconVisibility;

            #endregion

            #region gestureView
            gestureView.ShowPath               = config.Get(ConfigKeys.GestureViewShowPath, true);
            gestureView.ShowCommandName        = config.Get(ConfigKeys.GestureViewShowCommandName, true);
            gestureView.ViewFadeOut            = config.Get(ConfigKeys.GestureViewFadeOut, true);
            gestureView.PathMainColor          = Color.FromArgb(config.Get(ConfigKeys.GestureViewMainPathColor, gestureView.PathMainColor.ToArgb()));
            gestureView.PathAlternativeColor   = Color.FromArgb(config.Get(ConfigKeys.GestureViewAlternativePathColor, gestureView.PathAlternativeColor.ToArgb()));
            gestureView.PathMiddleBtnMainColor = Color.FromArgb(config.Get(ConfigKeys.GestureViewMiddleBtnMainColor, gestureView.PathMiddleBtnMainColor.ToArgb()));
            gestureView.PathXBtnMainColor      = Color.FromArgb(config.Get(ConfigKeys.GestureViewXBtnPathColor, gestureView.PathXBtnMainColor.ToArgb()));
            #endregion

            #region GestureParser
            gestureParser.EnableHotCorners  = config.Get(ConfigKeys.GestureParserEnableHotCorners, true);
            gestureParser.Enable8DirGesture = config.Get(ConfigKeys.GestureParserEnable8DirGesture, true);
            gestureParser.EnableRubEdge     = config.Get(ConfigKeys.GestureParserEnableRubEdges, true);

            #endregion
            //HOt key
            hotkeyMgr.HotKeyPreview      += HotkeyMgr_HotKeyPreview;
            hotkeyMgr.HotKeyRegistered   += HotkeyMgr_Updated;
            hotkeyMgr.HotKeyUnRegistered += HotkeyMgr_Updated;
            byte[] pauseHotKey = null;

            //workaround for bug introduced last version
            try { pauseHotKey = config.Get <byte[]>(ConfigKeys.PauseResumeHotKey, null); } catch (InvalidCastException e)
            {
                Debug.WriteLine(e);
            }

            if (pauseHotKey != null && pauseHotKey.Length > 0)
            {
                var hotkey = GlobalHotKeyManager.HotKey.FromBytes(pauseHotKey);

                try
                {
                    hotkeyMgr.RegisterHotKey(ConfigKeys.PauseResumeHotKey, hotkey, null);
                }catch (InvalidOperationException e)
                {
                    Debug.WriteLine(e);

                    //ignore for now ?
                }
            }
        }