@@ -91,21 +91,31 @@ private void ExecuteAction(Action<LoadingDialogInterface> action)
9191 public sealed class LoadingDialogInterface
9292 {
9393 private readonly LoadingDialog dialog ;
94+ private readonly bool silent ;
9495
9596 internal LoadingDialogInterface ( LoadingDialog dialog )
9697 {
9798 this . dialog = dialog ;
99+ this . silent = false ;
100+ }
101+
102+ /// <summary>Creates a silent (no-UI) progress reporter for headless/background operations.</summary>
103+ internal LoadingDialogInterface ( )
104+ {
105+ this . silent = true ;
98106 }
99107
100108 public bool IsCancelled { get ; internal set ; }
101109
102110 public void CloseDialog ( )
103111 {
112+ if ( silent ) return ;
104113 dialog . dialog . Dispatcher . BeginInvoke ( new Action ( ( ) => dialog . dialog . Hide ( ) ) ) ;
105114 }
106115
107116 public void SetMaximum ( int value )
108117 {
118+ if ( silent ) return ;
109119 dialog . progressBar . Dispatcher . Invoke ( ( ) =>
110120 {
111121 dialog . progressBar . IsIndeterminate = false ;
@@ -115,6 +125,7 @@ public void SetMaximum(int value)
115125
116126 public void SetMinimum ( int value )
117127 {
128+ if ( silent ) return ;
118129 dialog . progressBar . Dispatcher . Invoke ( ( ) =>
119130 {
120131 dialog . progressBar . IsIndeterminate = false ;
@@ -124,6 +135,7 @@ public void SetMinimum(int value)
124135
125136 public void SetProgress ( int value , string description = "..." )
126137 {
138+ if ( silent ) return ;
127139 try
128140 {
129141 dialog . progressBar . Dispatcher . Invoke ( ( ) =>
@@ -153,11 +165,13 @@ public void SetProgress(int value, string description = "...")
153165
154166 public void SetTitle ( string newTitle )
155167 {
168+ if ( silent ) return ;
156169 dialog . dialog . Dispatcher . Invoke ( ( ) => dialog . dialog . Title = newTitle ) ;
157170 }
158171
159172 internal void WaitTillDialogIsReady ( )
160173 {
174+ if ( silent ) return ;
161175 dialog . readyEvent . Wait ( ) ;
162176 }
163177 }
0 commit comments