Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
Well, I'm making progress. I found this issue - Lines lost when logging in combination with AnsiConsole.Live - which helped to point me in the right direction for getting my log messages to actually print on the screen by adding an Sub Main(args As String())
Dim header As New Layout("head")
Dim logging As New Layout("logs")
Dim feedback As New Layout("feedback")
Dim headPanel As New Panel("Application Title Goes Here")
Dim logPanel As New Panel("logPanel Test")
Dim feedbackPanel As New Panel("feedbackPanel Test")
With headPanel
.Expand = True
.NoBorder
.Height = 5
End With
With feedbackPanel
.Expand = True
.RoundedBorder
.Height = 3
.Padding = New Padding(0, 0)
End With
With logPanel
.Expand = True
.Height = Console.WindowHeight - headPanel.Height - feedbackPanel.Height
.NoBorder
End With
header.Update(headPanel)
logging.Update(logPanel)
feedback.Update(feedbackPanel)
RootLayout.SplitRows({header, logging, feedback})
AnsiConsole.Write(RootLayout)
AnsiConsole.Live(logPanel).StartAsync(Async Function(ctx)
For i As Integer = 0 To 50
Thread.Sleep(100)
WriteLogMessage($"Testing. Testing. One, two... {i}?", ctx)
Next i
End Function)
Console.ReadKey(True)
End Sub Now, at least, I'm getting this:
I definitely feel like I'm on the right path here, but I just haven't quite found the right mix. TBH, I'm kinda using this "Q&A" post to document my own progress as much as to request any guidance that might help me minimize the learning curve. The good news, as it were, is that, if I increase the iterations in the |
Beta Was this translation helpful? Give feedback.
-
I just found this repo and I'm super excited to start playing with SpectreConsole as the main CLI display for a "bot" I'm building. I'm reading through the documentation and playing with some of the examples, but I still have some questions about the capabilities and implementations. I'm probably just being dense as I haven't been working with it too much yet but, at this point, I'm just curious to know if what I want to build is going to be possible (and feasible) with this library, or if I'm going to need to either build it from the ground up myself or just abandon my lofty goals.
I've already re-invented the wheel on some of this stuff before I found this beauty, and I have some of it working the way that I want, but my application is going to have a sort of a "setup wizard" that will check for and/or create a database with all the necessary structure for the bot to operate, get user credentials/tokens, etc. The attached screenshot shows what the application is currently doing, but it doesn't have enough "log" lines to fill up and push things off screen.
MY INTENT
What I'd like to be able to do is to have a persistent "header" always visible at the top of the console, have all of the logged activity (from Async methods and such) scrolling and displaying directly underneath that, and then a bottom section that would be reserved for status updates (such as progress bars or notifications) and/or user input.
Using the screenshot above for reference, the purple header would always be visible. The timestamped logs would scroll by underneath that. At the very bottom of the screen would be where I would display any prompts or progress information to the user. I'm guessing that the
Panel
object is probably going to play a big role in overall layout but, in my testing, I've not yet figured out how to keep that in place while updating things from the console logging.Beta Was this translation helpful? Give feedback.
All reactions