[assembly: AssemblyVersion("2.6.8.*")]

This commit is contained in:
Stoyan Zlatev 2024-02-20 13:36:34 +01:00
parent d9d435cc6b
commit 694bdb0fa7
2 changed files with 20 additions and 44 deletions

View File

@ -14,5 +14,5 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.6.7.*")]
[assembly: AssemblyFileVersion("2.6.7.0")]
[assembly: AssemblyVersion("2.6.8.*")]
[assembly: AssemblyFileVersion("2.6.8.0")]

View File

@ -12,6 +12,7 @@
using Ctls;
using Infrastructure;
using Utils.Logging;
using System.Collections.Generic;
internal delegate void UpdateLayout();
@ -393,12 +394,23 @@
/// </summary>
private void HideContent()
{
foreach (var control in Controls)
var controlsToRemove = new List<Control>();
foreach (Control control in Controls)
{
if (control is GroupBox groupBox)
{
groupBox.Hide();
}
else if (control is IIdentityForm _ )
{
controlsToRemove.Add(control);
}
}
foreach (var control in controlsToRemove)
{
this.Controls.Remove(control);
}
}
@ -407,7 +419,7 @@
/// </summary>
private void SetSoftwareFunctions()
{
// changePassword.Tag = SoftwareFunctions.LAA_ADMIN;
changePassword.Enabled = Software.IsAutenticated;
btnSetup.Tag = SoftwareFunctions.GENERAL_SETUP;
btnAlarm.Tag = SoftwareFunctions.GENERAL_ALARM;
@ -545,17 +557,7 @@
{
Software.Logout();
foreach (var control in Controls)
{
if (control is LoginForm loginForm)
{
Controls.Remove(loginForm);
break;
}
}
ShowAvailableSoftwareFunctions();
InitializeFormState();
}
private void OnLoginClick(Object sender, EventArgs args)
@ -576,43 +578,17 @@
if (!hasLoginForm)
{
var loginForm = new LoginForm(LoginFormSubmitted);
loginForm.OnCancellation += OnControlCancellation;
var loginForm = new LoginForm(this.OnControlCancellation);
Controls.Add(loginForm);
}
}
/// <summary>
/// Callback method that is called when user enters valid username and password.
/// </summary>
/// <param name="username">Not null or empty string.</param>
/// <param name="password">Not null or empty string.</param>
/// <param name="sender">Is the LoginForm from witch is this method called.</param>
private void LoginFormSubmitted(String username, String password, Object sender)
{
if (sender is LoginForm loginForm)
{
if (Software.Login(username, password))
{
Controls.Remove(loginForm);
ShowAvailableSoftwareFunctions();
optionsMenuItem.Text = Software.UserName;
}
else
{
loginForm.ShowError("Invalid login attempt");
}
}
}
private void OnChangePasswordClick(Object _, EventArgs _1)
{
this.HideContent();
var control = new ChangePassword(this.OnControlCancellation);
control.OnCancellation += this.OnControlCancellation;
this.Controls.Add(control);
}
@ -621,9 +597,9 @@
{
if (control != null)
{
this.HideContent();
Software.Initialize();
this.Controls.Remove(control);
}
this.InitializeFormState();