1919using Spectre . Console . Rendering ;
2020using System . Collections . Concurrent ;
2121using System . Diagnostics ;
22+ using Novus . Streams ;
23+ using SixLabors . ImageSharp . Processing ;
2224
2325namespace SmartImage . Rdx . Cli ;
2426
@@ -94,6 +96,9 @@ public async Task Interactive()
9496 var choices = new SelectionPrompt < string > ( )
9597 . Title ( "Engine" )
9698 . AddChoices ( select . Keys ) ;
99+
100+ choices . AddChoice ( "Quit" ) ;
101+ choices . AddChoice ( "..." ) ;
97102
98103 string prompt = null ;
99104 // AC.Write(m_resTable);
@@ -107,6 +112,26 @@ public async Task Interactive()
107112 AC . Write ( v . Table ) ;
108113
109114 }
115+ else {
116+ var stream = Query . Uni . Stream ;
117+ stream . TrySeek ( 0 ) ;
118+ // Create the layout
119+ var layout = new Layout ( "Root" )
120+ . SplitColumns (
121+ new Layout ( "Left" ) ,
122+ new Layout ( "Right" )
123+ . SplitRows (
124+ new Layout ( "Top" ) ,
125+ new Layout ( "Bottom" ) ) ) ;
126+
127+ // Update the left column
128+ layout [ "Left" ] . Update (
129+ new Panel ( new CanvasImage ( stream ) )
130+ . Expand ( ) ) ;
131+ AC . Clear ( ) ;
132+ AC . Write ( layout ) ;
133+
134+ }
110135 }
111136
112137 /*var fn = rows.GetType()
@@ -140,6 +165,7 @@ public override async Task<int> ExecuteAsync(CommandContext context, SearchComma
140165 var p = ctx . AddTask ( "Creating query" ) ;
141166 p . IsIndeterminate = true ;
142167 Query = await SearchQuery . TryCreateAsync ( settings . Query ) ;
168+
143169 p . Increment ( 50 ) ;
144170 ctx . Refresh ( ) ;
145171
@@ -214,12 +240,13 @@ void OnResultComplete(object sender, SearchResult sr)
214240 {
215241 var rm = new ResultModel ( sr ) { } ;
216242 m_results . Add ( rm ) ;
217- var i = ( int ) sr . Engine . EngineOption ;
243+ var i = ( int ) sr . Engine . EngineOption ;
218244
219245 grid . AddRow ( [
220246 new Text ( sr . Engine . Name ,
221- new Style ( Color . FromInt32 ( Math . Clamp ( i % ( int ) byte . MaxValue , byte . MinValue , byte . MaxValue ) ) ,
222- decoration : Decoration . Italic ) ) ,
247+ new Style (
248+ Color . FromInt32 ( Math . Clamp ( i % ( int ) byte . MaxValue , byte . MinValue , byte . MaxValue ) ) ,
249+ decoration : Decoration . Italic ) ) ,
223250
224251 new Text ( $ "{ sr . Results . Count } ",
225252 new Style ( Color . Wheat1 ,
0 commit comments