private void TextKeyWizardFromHotKey2() { // Create the wizard window TextKeyWizardWindow win = new TextKeyWizardWindow(); //win.Owner = MainWindow.Instance; win.ShowInTaskbar = true; win.ClipboardBackup = clipboardBackup; MainWindow.Instance.Hide(); bool ok = false; if (win.ShowDialog() == true) { ok = HandleWizardInput(win.TextKeyText.Text, win.TranslationText.Text); } MainWindow.Instance.Show(); // Activate the window we're initially coming from WinApi.SetForegroundWindow(fgWin); if (ok) { // Send Ctrl+V keys to paste the new Tx call with the text key, // directly replacing the literal string that was selected before WinApi.INPUT[] inputs = new WinApi.INPUT[] { new WinApi.INPUT() { type = WinApi.INPUT_KEYBOARD, ki = new WinApi.KEYBDINPUT() { wVk = (short) WinApi.VK.CONTROL } }, new WinApi.INPUT() { type = WinApi.INPUT_KEYBOARD, ki = new WinApi.KEYBDINPUT() { wVk = (short) WinApi.KeyToVk(System.Windows.Forms.Keys.V) } }, new WinApi.INPUT() { type = WinApi.INPUT_KEYBOARD, ki = new WinApi.KEYBDINPUT() { wVk = (short) WinApi.KeyToVk(System.Windows.Forms.Keys.V), dwFlags = WinApi.KEYEVENTF_KEYUP } }, new WinApi.INPUT() { type = WinApi.INPUT_KEYBOARD, ki = new WinApi.KEYBDINPUT() { wVk = (short) WinApi.VK.CONTROL, dwFlags = WinApi.KEYEVENTF_KEYUP } }, }; uint ret = WinApi.SendInput((uint) inputs.Length, inputs, System.Runtime.InteropServices.Marshal.SizeOf(typeof(WinApi.INPUT))); } clipboardBackup = win.ClipboardBackup; if (clipboardBackup != null) { DelayedCall.Start(TextKeyWizardFromHotKey3, 200); } }
private void OnTextKeyWizard() { TextKeyWizardWindow win = new TextKeyWizardWindow(); win.Owner = MainWindow.Instance; if (win.ShowDialog() == true) { HandleWizardInput(win.TextKeyText.Text, win.TranslationText.Text); } }