Skip to content
This repository was archived by the owner on Oct 5, 2025. It is now read-only.

Commit 1858a94

Browse files
committed
add SplashScreen option to appsettings.config
1 parent 013bcf9 commit 1858a94

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

fipha/App.xaml.cs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

fipha/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.0.1.8")]
35-
[assembly: AssemblyFileVersion("0.0.1.8")]
34+
[assembly: AssemblyVersion("0.0.1.9")]
35+
[assembly: AssemblyFileVersion("0.0.1.9")]
3636

3737
[assembly: log4net.Config.XmlConfigurator(Watch = true)]

fipha/appsettings.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<add key="EnableWindowsFormsHighDpiAutoResizing" value="false" />
44
<add key="haUrl" value ="http://192.168.2.34:8123/" />
55
<add key="haToken" value ="awsdfljhsdjkfhs...........3zFHM" />
6+
<add key="SplashScreen" value="true" />
67
</appSettings>

0 commit comments

Comments
 (0)