@@ -43,6 +43,7 @@ public partial class App : Application
4343
4444 public static string HaUrl { get ; set ; }
4545 public static string HaToken { get ; set ; }
46+ public static string SplashScreen { get ; set ; }
4647
4748 public static bool IsShuttingDown { get ; set ; }
4849
@@ -132,8 +133,8 @@ protected override void OnStartup(StartupEventArgs evtArgs)
132133
133134 //if (!createdNew)
134135 //{
135- //app is already running! Exiting the application
136- //Current.Shutdown();
136+ //app is already running! Exiting the application
137+ //Current.Shutdown();
137138 //}
138139
139140 GetExePath ( ) ;
@@ -150,6 +151,7 @@ protected override void OnStartup(StartupEventArgs evtArgs)
150151 {
151152 HaUrl = appSection [ "haUrl" ] ;
152153 HaToken = appSection [ "haToken" ] ;
154+ SplashScreen = appSection [ "SplashScreen" ] ;
153155 }
154156
155157 if ( ! string . IsNullOrEmpty ( HaUrl ) && ! string . IsNullOrEmpty ( HaToken ) &&
@@ -183,8 +185,14 @@ protected override void OnStartup(StartupEventArgs evtArgs)
183185 _notifyIcon . IconSource = new BitmapImage ( new Uri ( "pack://application:,,,/fipha;component/fipha.ico" ) ) ;
184186 _notifyIcon . ToolTipText = "fipha" ;
185187
188+ var showSplashScreen = ! string . IsNullOrEmpty ( SplashScreen ) && SplashScreen . ToLower ( ) . Contains ( "true" ) ;
189+
186190 var splashScreen = new SplashScreenWindow ( ) ;
187- splashScreen . Show ( ) ;
191+
192+ if ( showSplashScreen )
193+ {
194+ splashScreen . Show ( ) ;
195+ }
188196
189197 Task . Run ( async ( ) =>
190198 {
@@ -203,8 +211,12 @@ protected override void OnStartup(StartupEventArgs evtArgs)
203211 "System.Collections.Generic"
204212 }*/
205213 } ;
206- splashScreen . Dispatcher . Invoke ( ( ) =>
207- splashScreen . ProgressText . Text = "Loading cshtml templates..." ) ;
214+
215+ if ( showSplashScreen )
216+ {
217+ splashScreen . Dispatcher . Invoke ( ( ) =>
218+ splashScreen . ProgressText . Text = "Loading cshtml templates..." ) ;
219+ }
208220
209221 Engine . Razor = RazorEngineService . Create ( config ) ;
210222
@@ -219,7 +231,11 @@ protected override void OnStartup(StartupEventArgs evtArgs)
219231 CssData = TheArtOfDev . HtmlRenderer . WinForms . HtmlRender . ParseStyleSheet (
220232 File . ReadAllText ( Path . Combine ( ExePath , "Templates\\ styles.css" ) ) , true ) ;
221233
222- splashScreen . Dispatcher . Invoke ( ( ) => splashScreen . ProgressText . Text = "Getting data from HA..." ) ;
234+ if ( showSplashScreen )
235+ {
236+ splashScreen . Dispatcher . Invoke ( ( ) =>
237+ splashScreen . ProgressText . Text = "Getting data from HA..." ) ;
238+ }
223239
224240 try
225241 {
@@ -257,7 +273,11 @@ protected override void OnStartup(StartupEventArgs evtArgs)
257273
258274 if ( EntityClient != null )
259275 {
260- splashScreen . Dispatcher . Invoke ( ( ) => splashScreen . ProgressText . Text = "Initializing FIP..." ) ;
276+ if ( showSplashScreen )
277+ {
278+ splashScreen . Dispatcher . Invoke ( ( ) => splashScreen . ProgressText . Text = "Initializing FIP..." ) ;
279+ }
280+
261281 if ( ! FipHandler . Initialize ( ) )
262282 {
263283 Current . Shutdown ( ) ;
@@ -272,7 +292,10 @@ protected override void OnStartup(StartupEventArgs evtArgs)
272292 window ? . Hide ( ) ;
273293 } ) ;
274294
275- Dispatcher . Invoke ( ( ) => { splashScreen . Close ( ) ; } ) ;
295+ if ( showSplashScreen )
296+ {
297+ Dispatcher . Invoke ( ( ) => { splashScreen . Close ( ) ; } ) ;
298+ }
276299
277300 var haMediaPlayerToken = _haMediaPlayerTokenSource . Token ;
278301
@@ -423,7 +446,7 @@ protected override void OnStartup(StartupEventArgs evtArgs)
423446 {
424447 _hwInfoTask = Task . Run ( async ( ) =>
425448 {
426- await MQTT . Connect ( ) ;
449+ await MQTT . Connect ( ) ;
427450
428451 Log . Info ( $ "HWInfo task started, polling interval { MQTT . MqttPollingInterval } ms") ;
429452
0 commit comments