public static ShortcutItemDAO ShortcutItemToDao(ShortcutItem item) { ShortcutItemDAO result = new ShortcutItemDAO(); result.Id = item.Id; result.Name = item.Name; result.Strength = item.Strength; return result; }
public static ShortcutItem DaoToShortcutItem(ShortcutItemDAO dao) { ShortcutItem result = new ShortcutItem(); result.Id = dao.Id; result.Name = dao.Name; result.Strength = dao.Strength; return result; }
public ShortcutDefinition() { Idx = 0; Active = true; ProcessName = String.Empty; GestureMap = new Dictionary<InteractionGesture, ShortcutItem>(); foreach (InteractionGesture gesture in Enum.GetValues(typeof(InteractionGesture))) { ShortcutItem item = new ShortcutItem(); item.ShortcutType = gesture; GestureMap.Add(gesture, item); } }
public void SendKeyToProcess(String name, ShortcutItem item) { using (Process process = Process.GetProcessesByName(name).FirstOrDefault()) { if (null != process) { IntPtr h2 = process.MainWindowHandle; SetForegroundWindow(h2); int style = GetWindowLong(process.MainWindowHandle, GWL_STYLE); if ((style & WS_MINIMIZE) == WS_MINIMIZE) { ShowWindow(h2, 4); } for (int i = 0; i < item.Strength; ++i) { SendKeys.SendWait(item.ShortcutString); } SendKeys.Flush(); } } }