/// <summary> /// check if process is valid /// </summary> /// <returns>true: valid, false: otherwise</returns> private bool IsProcessValid() { if (null == this._process) { return(false); } bool result = !this._process.HasExited; if (!result) { AppCommon.DebugLog("process is invalid"); } return(result); }
/// <summary> /// add tab /// </summary> private void AddTab() { if (Constant.MaxTabCount <= this._consoleList.Count) { AppCommon.DebugLog("can't add new tab any more"); return; } this.AddConsole(); this.cTab.SelectTab(this._consoleList.Count - 1); foreach (var console in this._consoleList) { if (this._currentConsole == console) { console.Visibility = Visibility.Visible; } else { console.Visibility = Visibility.Collapsed; } } }
private void Command_KeyDown(object sender, KeyEventArgs e) { AppCommon.DebugLog("key" + e.Key.ToString()); if (Common.IsModifierPressed(ModifierKeys.Control) && e.Key == Key.B) { e.Handled = true; this._cmd.Break(); return; } switch (e.Key) { case Key.Enter: if (0 == this.cCommand.Text.Length) { return; } e.Handled = true; if (this._commandBuf.Contains(this.cCommand.Text)) { this._commandBuf.Remove(this.cCommand.Text); this._commandBuf.Insert(0, this.cCommand.Text); } else { this._commandBuf.Add(this.cCommand.Text); if (Constant.MaxCommandBuff < this._commandBuf.Count) { this._commandBuf.RemoveAt(0); } } //if (this.cCommand.Text.StartsWith("git")) { // git = new GitWrap(this, @"E:\UserData\my-dic\books\「わかりやすい」文章を書く全技術100"); // git.CmdOutputDataReceived += (line) => { // this.AddLine(line); // }; // git.CmdErrorDataReceived += (line) => { // this.AddLine(line); // }; // git.Start(); // // git.SendCommand(this.cCommand.Text); //} else { // this._cmd.SendCommand(this.cCommand.Text); //} this._cmd.SendCommand(this.cCommand.Text); this.cCommand.Text = ""; break; case Key.Up: if (Common.IsModifierPressed(ModifierKeys.Control)) { e.Handled = true; if (0 < this._commandBuf.Count) { this.ShowCommandLine?.Invoke(this._commandBuf); } } else { this._buffIndex++; if (this.SetBufferCommand()) { e.Handled = true; } } break; case Key.Down: this._buffIndex--; if (this.SetBufferCommand()) { e.Handled = true; } break; default: this._buffIndex = 0; break; } }