private void Next(IPowerShellInvocation invocation) { var section = new InvocationSection(this, invocation); this.Document.Blocks.Add(section); if (section.CanEditing) { this._currentSection = section; this.CaretPosition = section.Editor.ContentEnd; } }
public InvocationSection(PowerShellConsole owner, IPowerShellInvocation invocation) { if (invocation.Result == null) { this._owner = owner; this.Invocation = invocation; this.Invocation.PropertyChanged += this.HandleInvocationPropertyChanged; this.Prompt = $"[{invocation.Number}] > "; this.Editor = new Paragraph(); this.Editor.Inlines.Add(this.Prompt); this.Blocks.Add(this.Editor); this.CanEditing = invocation.Status == InvocationStatus.Ready; } else { this._owner = owner; this.Invocation = invocation; this.SetResult(invocation.Result); this.CanEditing = false; } }