private async void SetForeground() { Topmost = false; Topmost = true; WinAPI.ShowWindow(Handle, 5); InputEditText.Focus(); }
private void Init() { root = new Root(this); outputBuilder = new StringBuilder(); autoCompleteManager = new AutoCompleteManager(this); recentCmdManager = new RecentCmdManager(); soundPlayer = new SoundPlayer(Properties.Resources.Keyboard_EnterClick); CmdProc = new CMDProcess(); FindHandle(); ClearInput(); LoadPlugin(); UpdateResolution(); RegisterEvent(); CmdProc.ExecuteUpdateWorkingDirectory(); void FindHandle() { Window window = Window.GetWindow(this); var wih = new WindowInteropHelper(window); Handle = wih.Handle; } void ClearInput() { InputEditText.Text = ""; InputEditText.Focus(); } void LoadPlugin() { //Left = 0d; //Top = 0d; //Width = 1920d; //OutputTextView.Text = "결과 출력 디스플레이\nExecute...\n존-새 밥오."; TestPlugin testPlugin = new TestPlugin(); root.pluginManager.registerPlugin(testPlugin); } void RegisterEvent() { InputEditText.KeyDown += OnKeyDown_InputEditText; InputEditText.PreviewKeyDown += OnPreviewKeyDown_InputEditText; CmdProc.OnOutputReceived += OnOutputReceived_CMDProc; InputContext.MouseDown += OnMouseDown_InputContext; Closing += OnClosing; root.loopEngine.AddLoopAction(OnTick); } }
private void OnMouseDown_InputContext(object sender, MouseButtonEventArgs e) { InputEditText.Focus(); e.Handled = false; }