private delegate void SetPromptTextClient(string val);//代理 /// <summary> /// 用异步的方式设置新提示信息并且打印 /// </summary> public void SetPromptText(string val) { //等待异步 if (this.InvokeRequired) { SetPromptTextClient c = new SetPromptTextClient(SetPromptText); this.Invoke(c, new object[1] { val }); //通过代理调用刷新方法 } else { _prompt = _isWin ? (val + "> ") : ("[" + val + "]$ "); PrintPrompt(); } }
private delegate void SetPromptTextClient(string val);//代理 /// <summary> /// 用异步的方式设置新提示信息并且打印 /// </summary> public void SetPromptText(string val) { //等待异步 if (this.InvokeRequired) { SetPromptTextClient c = new SetPromptTextClient(SetPromptText); this.Invoke(c, new object[1] { val });//通过代理调用刷新方法 } else { _prompt = _isWin ? (val + "> ") : ("[" + val + "]$ "); PrintPrompt(); } }