/// <summary> /// Invoked when the selects a window in the switch windows scanner. /// Set focus to the selected window and quit the agent. /// </summary> /// <param name="sender"></param> /// <param name="windowInfo"></param> private void _switchWindowsScanner_EvtActivateWindow(object sender, EnumWindows.WindowInfo windowInfo) { _windowInfo = windowInfo; Windows.ActivateWindow(_windowInfo.Handle); closeScanner(); Close(); }
/// <summary> /// User selected a window to switch to. Trigger an event /// to indicate this. /// </summary> /// <param name="wInfo">Window info of the window selected</param> private void handleWindowSelect(EnumWindows.WindowInfo wInfo) { if (!User32Interop.IsWindow(wInfo.Handle) || !User32Interop.IsWindowVisible(wInfo.Handle)) { DialogUtils.ShowTimedDialog(this, R.GetString("WindowNotFound")); } else if (DialogUtils.ConfirmScanner(String.Format(R.GetString("ConfirmSwitchToWindow"), wInfo.Title))) { if (EvtActivateWindow != null) { EvtActivateWindow.BeginInvoke(this, wInfo, null, null); } } }
/// <summary> /// User selected a window to switch to. Trigger an event /// to indicate this. /// </summary> /// <param name="wInfo">Window info of the window selected</param> private void handleWindowSelect(EnumWindows.WindowInfo wInfo) { if (!User32Interop.IsWindow(wInfo.Handle) || !User32Interop.IsWindowVisible(wInfo.Handle)) { DialogUtils.ShowTimedDialog(this, Resources.WindowDoesNotExist); } else if (DialogUtils.ConfirmScanner(string.Format(Resources.SwitchTo, wInfo.Title))) { if (EvtActivateWindow != null) { EvtActivateWindow.BeginInvoke(this, wInfo, null, null); } } }
/// <summary> /// User selected a window to switch to. Trigger an event /// to indicate this. /// </summary> /// <param name="wInfo">Window info of the window selected</param> private void handleWindowSelect(EnumWindows.WindowInfo wInfo) { if (!User32Interop.IsWindow(wInfo.Handle) || !User32Interop.IsWindowVisible(wInfo.Handle)) { DialogUtils.ShowTimedDialog(this, "Window does not exist"); } else if (DialogUtils.ConfirmScanner("Switch to " + wInfo.Title + "?")) { if (EvtActivateWindow != null) { EvtActivateWindow.BeginInvoke(this, wInfo, null, null); } } }
/// <summary> /// Invoked when the Functional agent is activated. This is /// the entry point. /// </summary> /// <returns>true on success</returns> public override bool Activate() { _windowInfo = null; ExitCode = CompletionCode.ContextSwitch; _switchWindowsScanner = Context.AppPanelManager.CreatePanel("SwitchWindowsScanner") as SwitchWindowsScanner; if (_switchWindowsScanner != null) { subscribeToEvents(); _switchWindowsScanner.FilterByProcessName = FilterByProcessName; Context.AppPanelManager.ShowDialog(_switchWindowsScanner); } return(true); }
/// <summary> /// Invoked when the Functional agent is activated. This is /// the entry point. /// </summary> /// <returns>true on success</returns> public override bool Activate() { _windowInfo = null; ExitCode = CompletionCode.ContextSwitch; _switchWindowsScanner = Context.AppPanelManager.CreatePanel("SwitchWindowsScanner") as SwitchWindowsScanner; if (_switchWindowsScanner != null) { _switchWindowsScanner.FormClosing += _form_FormClosing; _switchWindowsScanner.EvtDone += _form_EvtDone; _switchWindowsScanner.EvtActivateWindow += _switchWindowsScanner_EvtActivateWindow; _switchWindowsScanner.FilterByProcessName = FilterByProcessName; Context.AppPanelManager.ShowDialog(_switchWindowsScanner); } return(true); }
/// <summary> /// Invoked when the selects a window in the switch windows scanner. /// Set focus to the selected window and quit the agent. /// </summary> /// <param name="sender"></param> /// <param name="windowInfo"></param> private void _switchWindowsScanner_EvtActivateWindow(object sender, EnumWindows.WindowInfo windowInfo) { _windowInfo = windowInfo; IsClosing = true; IsActive = false; if (Windows.IsDesktopWindow(_windowInfo.Handle)) { Context.AppAgentMgr.Keyboard.Send(Keys.LWin, Keys.D); } else { Windows.ActivateWindow(_windowInfo.Handle); EnumWindows.RestoreFocusToTopWindowOnDesktop(); } closeScanner(); Close(); }
public ItemTag(EnumWindows.WindowInfo info) { DataType = ItemType.Window; WInfo = info; }