private static BaseActionClass InitializeAction(string category, string actionName)
 {
     BaseActionClass action = null;
     switch (category)
     {
         case InternetOptions.NAME:
             if (category != actionName)
                 action = new InternetOptions(actionName);
             else
                 action = new InternetOptions();
             break;
         case WinampOptions.NAME:
             if (category != actionName)
                 action = new WinampOptions(actionName);
             else
                 action = new WinampOptions();
             break;
         case MediaControl.NAME:
             if (category != actionName)
                 action = new MediaControl(actionName);
             else
                 action = new MediaControl();
             break;
         case WindowOptions.NAME:
             if (category != actionName)
                 action = new WindowOptions(actionName);
             else
                 action = new WindowOptions();
             break;
         case WindowsShell.NAME:
             if (category != actionName)
                 action = new WindowsShell(actionName);
             else
                 action = new WindowsShell();
             break;
         case KeystrokesOptions.NAME:
             if (category != actionName)
                 action = new KeystrokesOptions(actionName);
             else
                 action = new KeystrokesOptions();
             break;
         case SpecialOptions.NAME:
             if (category != actionName)
                 action = new SpecialOptions(actionName);
             else
                 action = new SpecialOptions();
             break;
         case AppGroupOptions.NAME:
             if (category != actionName)
                 action = new AppGroupOptions(actionName);
             else
                 action = new AppGroupOptions();
             break;
         case ExtrasOptions.NAME:
             if (category != actionName)
                 action = new ExtrasOptions(actionName);
             else
                 action = new ExtrasOptions();
             break;
         case VolumeOptions.NAME:
             if (category != actionName)
                 action = new VolumeOptions(actionName);
             else
                 action = new VolumeOptions();
             break;
         default:
             //if (category != actionName)
             //    action = new BaseActionClass(actionName);
             //else
                 action = new BaseActionClass();
             break;
     }
     return action;  
 }
示例#2
0
 private void ExecuteImplicitOnlyAction(BaseActionClass action, KeystrokesOptions.MouseAction mouse, bool selectWnd)
 {
     Debug.WriteLine(string.Format("ExecuteImplicitOnlyAction - Action: {0}, Mouse: {1}, SelectWindow: {2} Handle WndUnderCursor: {3}", action.Name, mouse, selectWnd, Config.User.HandleWndUnderCursor));
     IntPtr hwnd = m_hwndWindowToUse;//GetWindowToUse(m_cursorPosition);
     //if (Config.User.handleWndUnderCursor)
     //    hwnd = m_mouse.ActiveWindow;
     //else
     //    hwnd = m_hwndWndToUse;
     Point location = new Point(m_cursorPosition.X, m_cursorPosition.Y);
     lock (this)
     {
         m_mouse.StartSimulation();
         action.ExecuteKeyScript(mouse, hwnd, selectWnd, location);
         m_mouse.StopSimulation();
     }
 }
 public KeystrokesOptions(KeystrokesOptions action) : base(action) { }