GTB: - main: startup error messages

This commit is contained in:
Thomas Wiedebusch
2025-10-09 12:28:35 +02:00
parent 944bceac56
commit bb7fb7b813
+26 -23
View File
@@ -90,9 +90,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
catch (Exception ex)
{
MessageBox.Show(@"GenesisToolBox\n\n" +
@"Network Connection Error!\n\n" +
ex.Message);
var msg = "Unable to acquire a valid license for this GTB!\n\n" +
"Network access error! " +
"Please connect to the Xylem network or establish a VPN connection.\n\n" +
"Network feedback: ";
MessageBox.Show(msg + ex.Message, @"GenesisToolBox (GTB)", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close();
CheckConfigs();
@@ -107,9 +109,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
if (!access)
{
MessageBox.Show(@"GenesisToolBox\n\n" +
@"Your version licence is expired!\n\n" +
SoftwareVersion.Current);
var msg = $"The GTB {SoftwareVersion.Current} is out of support!\n\n" +
"Please check for versions on the SharePoint location.";
MessageBox.Show(msg, @"GenesisToolBox (GTB)", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close();
}
@@ -410,7 +412,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
foreach (var control in controlsToRemove)
{
this.Controls.Remove(control);
Controls.Remove(control);
}
}
@@ -486,13 +488,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
groupBox.Show();
}
else if (control is MenuStrip menu && menu.Items != null)
else if (control is MenuStrip menu)
{
foreach (var item in menu.Items)
{
if (item is ToolStripMenuItem toolStripMenuItem)
{
this.ShowAvailableMenuItems(toolStripMenuItem);
ShowAvailableMenuItems(toolStripMenuItem);
}
}
}
@@ -507,20 +509,21 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
return;
}
else if (toolStripMenuItem.Tag is SoftwareFunctions softwareFunction)
if (toolStripMenuItem.Tag is SoftwareFunctions softwareFunction)
{
toolStripMenuItem.Visible = Debugger.IsAttached || Software.IsEnabled(softwareFunction);
}
var dropdownItems = toolStripMenuItem.DropDownItems;
if (dropdownItems != null && dropdownItems.Count > 0)
if (dropdownItems.Count > 0)
{
foreach (var item in dropdownItems)
{
if (item is ToolStripMenuItem _toolStripMenuItem)
{
this.ShowAvailableMenuItems(_toolStripMenuItem);
ShowAvailableMenuItems(_toolStripMenuItem);
}
}
}
@@ -536,7 +539,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
Software.Initialize();
this.Controls.Remove(registerForm);
Controls.Remove(registerForm);
}
HideContent();
@@ -544,14 +547,14 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (Software.IsRegistrationPending)
{
registerForm = new RegisterLDAPUser(InitializeFormState);
registerForm.OnCancellation += this.OnControlCancellation;
registerForm.OnCancellation += OnControlCancellation;
this.menu.Hide();
this.Controls.Add(registerForm);
mainMenu.Hide();
Controls.Add(registerForm);
}
else
{
this.menu.Show();
mainMenu.Show();
SetSoftwareFunctions();
ShowAvailableSoftwareFunctions();
}
@@ -582,7 +585,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (!hasLoginForm)
{
var loginForm = new LoginForm(this.OnControlCancellation);
var loginForm = new LoginForm(OnControlCancellation);
Controls.Add(loginForm);
}
@@ -590,23 +593,23 @@ namespace Xylem.Common.Ui.GenesisToolBox
private void OnChangePasswordClick(Object _, EventArgs _1)
{
this.HideContent();
HideContent();
var control = new ChangePassword(this.OnControlCancellation);
var control = new ChangePassword(OnControlCancellation);
this.Controls.Add(control);
Controls.Add(control);
}
private void OnControlCancellation(Control control)
{
if (control != null)
{
this.HideContent();
HideContent();
// Software.Initialize();
}
this.InitializeFormState();
InitializeFormState();
}
#endregion Form initialization