'Starting the system' message on start-up before MainWnd opens, ver. 3.6.2035

This commit is contained in:
Milan Hanajik 2023-04-06 10:54:18 +02:00
parent 6b582bea64
commit 91b55eb19c

View File

@ -1,9 +1,10 @@
/// ///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s. /// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using log4net; using log4net;
using Common; using Common;
@ -228,6 +229,8 @@ namespace TBF
bool retryLogin = true; /// true = stay in a login loop bool retryLogin = true; /// true = stay in a login loop
do do
{ {
LoadingConfigEnd();
LoginDlgWithBenchSelection loginDlgBench; LoginDlgWithBenchSelection loginDlgBench;
if (LocalSettings.LastBenchName != null) if (LocalSettings.LastBenchName != null)
{ {
@ -252,6 +255,7 @@ namespace TBF
{ {
log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName); log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName);
LoadingConfigStart();
CurrentUser.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings; CurrentUser.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
CurrentUser.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings; CurrentUser.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
@ -488,11 +492,12 @@ namespace TBF
try try
{ {
/// Open the main application window /// Open the main application window
log.Info("Creating the main window"); log.Info("Creating the main window");
MainWnd = new UI.MainWnd(); MainWnd = new UI.MainWnd();
log.Info("Opening the main window"); log.Info("Opening the main window");
Application.Run(MainWnd); LoadingConfigEnd();
Application.Run(MainWnd);
log.Info("The main window was closed"); log.Info("The main window was closed");
} }
catch (Exception e) catch (Exception e)
@ -527,5 +532,35 @@ namespace TBF
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace); log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
log.Fatal("--------------------------------------"); log.Fatal("--------------------------------------");
} }
static UI.Shared.ModelessActivityForm form;
static System.Threading.Thread formThread;
static void LoadingConfigStart()
{
form = new UI.Shared.ModelessActivityForm()
{
Message = Strings.Starting_system,
FontFamily = "Arial",
FontSize = 24,
FontStyle = FontStyle.Regular,
BackgroundColor = Color.LightBlue,
};
formThread = new System.Threading.Thread(() => form.ShowDialog());
formThread.Start();
System.Threading.Thread.Sleep(500);
}
static void LoadingConfigEnd()
{
if (form != null && formThread != null)
{
form.CloseForm(null, new EventArgs());
formThread.Join();
}
form = null;
formThread = null;
}
} }
} }