1010using System . Runtime . Versioning ;
1111using Kantan . Net . Utilities ;
1212using Kantan . Text ;
13+ using Microsoft . Extensions . Logging ;
1314using Microsoft . VisualBasic . FileIO ;
1415using Novus . FileTypes ;
1516using Novus . Win32 ;
1617using NStack ;
1718using SmartImage . App ;
1819using SmartImage . Lib ;
1920using SmartImage . Lib . Results ;
21+ using SmartImage . Lib . Utilities ;
2022using SmartImage . Mode . Shell . Assets ;
2123using SmartImage . Utilities ;
2224using Terminal . Gui ;
@@ -83,7 +85,7 @@ static ShellMode() { }
8385 X = Pos . Right ( Lbl_InputOk ) + 1 ,
8486 Y = Pos . Y ( Tf_Input ) ,
8587 ColorScheme = UI . Cs_Btn1x ,
86-
88+ Enabled = false
8789 } ;
8890
8991 private static readonly Button Btn_Browse = new ( "Browse" )
@@ -496,8 +498,12 @@ private void OnComplete(object sender, SearchResult[] results)
496498 [ SupportedOSPlatform ( Compat . OS ) ]
497499 private void OnCompleteWin ( object sender , SearchResult [ ] results )
498500 {
499- Player . Play ( ) ;
500- Native . FlashWindow ( ConsoleUtil . HndWindow ) ;
501+
502+ if ( ! Config . Silent ) {
503+ Player . Play ( ) ;
504+ Native . FlashWindow ( ConsoleUtil . HndWindow ) ;
505+
506+ }
501507
502508 /*var u = m_results.SelectMany(r => r.Results).ToArray();
503509 var di = (await SearchClient.GetDirectImagesAsync(u)).ToArray();
@@ -562,10 +568,15 @@ internal void SetInputText(ustring s)
562568
563569 }
564570
571+ private static readonly ILogger Logger = LogUtil . Factory . CreateLogger ( nameof ( ShellMode ) ) ;
572+
565573 private async Task < bool > SetQuery ( ustring text )
566574 {
575+ Btn_Run . Enabled = false ;
576+
567577 if ( IsQueryReady ( ) && Query . Uni . Value as string == text ) {
568578 Debug . WriteLine ( $ "Already loaded { text } ", nameof ( SetQuery ) ) ;
579+ Btn_Run . Enabled = true ;
569580 return true ;
570581 }
571582
@@ -584,7 +595,7 @@ private async Task<bool> SetQuery(ustring text)
584595
585596 sq = await SearchQuery . TryCreateAsync ( text . ToString ( ) ) ;
586597
587- Btn_Run . Enabled = true ;
598+ // Btn_Run.Enabled = false ;
588599
589600 Pbr_Status . Pulse ( ) ;
590601 }
@@ -617,6 +628,7 @@ private async Task<bool> SetQuery(ustring text)
617628 Debug . WriteLine ( $ "{ e . Message } ", nameof ( SetQuery ) ) ;
618629 Lbl_InputInfo . Text = $ "Error: { e . Message } ";
619630 Lbl_Status2 . Text = ustring . Empty ;
631+ Btn_Run . Enabled = false ;
620632
621633 }
622634
@@ -625,7 +637,7 @@ private async Task<bool> SetQuery(ustring text)
625637 Lbl_InputInfo . Text = "Error: invalid input" ;
626638
627639 UI . SetLabelStatus ( Lbl_InputOk , false ) ;
628- Btn_Run . Enabled = true ;
640+ Btn_Run . Enabled = false ;
629641 Lbl_QueryUpload . Text = ustring . Empty ;
630642 Pbr_Status . Fraction = 0 ;
631643 Lbl_Status2 . Text = ustring . Empty ;
0 commit comments