INT69DB_2A/INT69DB_2A/Forms/FormMenu.cs

637 lines
38 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using INT69DB_2A_ImageDll;
using INT69DB_2A.DialogForms;
using INT69DB_2A.Part11_UserManager;
namespace INT69DB_2A.Forms
{
public partial class FormMenu : Form
{
#region Field
private FormMain m_ParentForm;
#endregion
#region Costructor
public FormMenu(FormMain parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMain ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void InitializeDesign()
{
ImageDll images = new ImageDll();
if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean)
{
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
{
this.labelTitle.Text = "Menu";
this.buttonCalibration.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuCalibrationDisable));
this.buttonCalibration.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuCalibrationDown));
this.buttonCalibration.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuCalibrationUp));
this.buttonCommunication.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuCommunicationDisable));
this.buttonCommunication.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuCommunicationDown));
this.buttonCommunication.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuCommunicationUp));
this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuConfigurationDisable));
this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuConfigurationDown));
this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuConfigurationUp));
this.buttonDataBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuDataBackupDisable));
this.buttonDataBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuDataBackupDown));
this.buttonDataBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuDataBackupUp));
this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuEquipmentDisable));
this.buttonEquipment.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuEquipmentDown));
this.buttonEquipment.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuEquipmentUp));
this.buttonInformation.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuInformationDisable));
this.buttonInformation.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuInformationDown));
this.buttonInformation.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuInformationUp));
this.buttonInitialization.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuInitializationDisable));
this.buttonInitialization.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuInitializationDown));
this.buttonInitialization.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuInitializationUp));
this.buttonIOTest.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuIOTestDisable));
this.buttonIOTest.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuIOTestDown));
this.buttonIOTest.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuIOTestUp));
this.buttonMotor.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuMotorDisable));
this.buttonMotor.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuMotorDown));
this.buttonMotor.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuMotorUp));
this.buttonSystem.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuSystemDisable));
this.buttonSystem.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuSystemDown));
this.buttonSystem.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuSystemUp));
this.buttonTest.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuTestDisable));
this.buttonTest.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuTestDown));
this.buttonTest.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuTestUp));
this.buttonTime.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuTimeDisable));
this.buttonTime.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuTimeDown));
this.buttonTime.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuTimeUp));
this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuUpdateDisable));
this.buttonUpdate.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuUpdateDown));
this.buttonUpdate.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuUpdateUp));
this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuUserDisable));
this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuUserDown));
this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuUserUp));
this.buttonDataStatistics.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuStatisticsDisable));
this.buttonDataStatistics.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuStatisticsDown));
this.buttonDataStatistics.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuStatisticsUp));
this.buttonDataViewer.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuDataViewerDisable));
this.buttonDataViewer.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuDataViewerDown));
this.buttonDataViewer.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engFormMenuDataViewerUp));
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
{
this.labelTitle.Text = "菜单";
this.buttonCalibration.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuCalibrationDisable));
this.buttonCalibration.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuCalibrationDown));
this.buttonCalibration.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuCalibrationUp));
this.buttonCommunication.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuCommunicationDisable));
this.buttonCommunication.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuCommunicationDown));
this.buttonCommunication.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuCommunicationUp));
this.buttonConfiguration.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuConfigurationDisable));
this.buttonConfiguration.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuConfigurationDown));
this.buttonConfiguration.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuConfigurationUp));
this.buttonDataBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuDataBackupDisable));
this.buttonDataBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuDataBackupDown));
this.buttonDataBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuDataBackupUp));
this.buttonEquipment.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuEquipmentDisable));
this.buttonEquipment.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuEquipmentDown));
this.buttonEquipment.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuEquipmentUp));
this.buttonInformation.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuInformationDisable));
this.buttonInformation.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuInformationDown));
this.buttonInformation.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuInformationUp));
this.buttonInitialization.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuInitializationDisable));
this.buttonInitialization.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuInitializationDown));
this.buttonInitialization.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuInitializationUp));
this.buttonIOTest.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuIOTestDisable));
this.buttonIOTest.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuIOTestDown));
this.buttonIOTest.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuIOTestUp));
this.buttonMotor.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuMotorDisable));
this.buttonMotor.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuMotorDown));
this.buttonMotor.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuMotorUp));
this.buttonSystem.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuSystemDisable));
this.buttonSystem.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuSystemDown));
this.buttonSystem.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuSystemUp));
this.buttonTest.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuTestDisable));
this.buttonTest.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuTestDown));
this.buttonTest.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuTestUp));
this.buttonTime.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuTimeDisable));
this.buttonTime.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuTimeDown));
this.buttonTime.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuTimeUp));
this.buttonUpdate.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuUpdateDisable));
this.buttonUpdate.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuUpdateDown));
this.buttonUpdate.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuUpdateUp));
this.buttonUser.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuUserDisable));
this.buttonUser.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuUserDown));
this.buttonUser.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuUserUp));
this.buttonDataStatistics.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuStatisticsDisable));
this.buttonDataStatistics.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuStatisticsDown));
this.buttonDataStatistics.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuStatisticsUp));
this.buttonDataViewer.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuDataViewerDisable));
this.buttonDataViewer.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuDataViewerDown));
this.buttonDataViewer.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFormMenuDataViewerUp));
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
{
}
else
{
}
}
private void DefaultSetting()
{
if (this.ParentForm.SystemConfig.IsLogin == false)
{
this.labelUserID.Visible = false;
this.labelUserLevel.Visible = false;
this.labelExpireOfPassword.Visible = false;
this.buttonEquipment.Visible = false;
this.buttonUser.Visible = false;
this.buttonTest.Visible = false;
this.buttonTest.Location = new Point(339, 349);
this.buttonTest.BringToFront();
if (this.ParentForm.SystemConfig.IsPart11 == false)
{
this.buttonDataStatistics.Visible = false;
this.buttonDataViewer.Visible = false;
}
}
else
{
}
}
public void UpdateDisplayUser(UserItem user)
{
string id = "", group = "", expireDate = "";
switch (user.Group)
{
case DataStore.UserGroup.None:
break;
case DataStore.UserGroup.Level1:
id = user.ID;
group = this.ParentForm.SystemConfig.User_Level1_Name;
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuInformation;
this.buttonDataBackup.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuDataBackup;
this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuConfiguration;
this.buttonCommunication.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuStatistics;
this.buttonCalibration.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuCalibration;
this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuSystem;
this.buttonMotor.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuMotor;
this.buttonUpdate.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuUpdate;
this.buttonInitialization.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuInitialization;
this.buttonIOTest.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuIOTest;
this.buttonTime.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuTime;
this.buttonUser.Enabled = true;
this.buttonDataStatistics.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuStatistics;
this.buttonDataViewer.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMenuViewer;
this.buttonEquipment.Visible = false;
this.buttonTest.Visible = false;
break;
case DataStore.UserGroup.Level2:
id = user.ID;
group = this.ParentForm.SystemConfig.User_Level2_Name;
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuInformation;
this.buttonDataBackup.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuDataBackup;
this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuConfiguration;
this.buttonCommunication.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuStatistics;
this.buttonCalibration.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuCalibration;
this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuSystem;
this.buttonMotor.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuMotor;
this.buttonUpdate.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuUpdate;
this.buttonInitialization.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuInitialization;
this.buttonIOTest.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuIOTest;
this.buttonTime.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuTime;
this.buttonUser.Enabled = true;
this.buttonDataStatistics.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuStatistics;
this.buttonDataViewer.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMenuViewer;
this.buttonEquipment.Visible = false;
this.buttonTest.Visible = false;
break;
case DataStore.UserGroup.Level3:
id = user.ID;
group = this.ParentForm.SystemConfig.User_Level3_Name;
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuInformation;
this.buttonDataBackup.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuDataBackup;
this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuConfiguration;
this.buttonCommunication.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuStatistics;
this.buttonCalibration.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuCalibration;
this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuSystem;
this.buttonMotor.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuMotor;
this.buttonUpdate.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuUpdate;
this.buttonInitialization.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuInitialization;
this.buttonIOTest.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuIOTest;
this.buttonTime.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuTime;
this.buttonUser.Enabled = true;
this.buttonDataStatistics.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuStatistics;
this.buttonDataViewer.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuViewer;
this.buttonEquipment.Visible = false;
this.buttonTest.Visible = false;
break;
case DataStore.UserGroup.Admin:
id = user.ID;
if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German)
group = "Administrator";
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
group = "行政";
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
group = "Администратор";
else
group = "Administrator";
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuInformation;
this.buttonDataBackup.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuDataBackup;
this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuConfiguration;
this.buttonCommunication.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuStatistics;
this.buttonCalibration.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuCalibration;
this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuSystem;
this.buttonMotor.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuMotor;
this.buttonUpdate.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuUpdate;
this.buttonInitialization.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuInitialization;
this.buttonIOTest.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuIOTest;
this.buttonTime.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuTime;
this.buttonUser.Enabled = true;
this.buttonDataStatistics.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuStatistics;
this.buttonDataViewer.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMenuViewer;
this.buttonEquipment.Visible = false;
this.buttonTest.Visible = false;
break;
case DataStore.UserGroup.Developer:
id = user.ID;
if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German)
group = "Entwickler";
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
group = "开发商";
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
group = "Разработчик";
else
group = "Developer";
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.labelExpireOfPassword.Visible = true;
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonInformation.Enabled = true;
this.buttonDataBackup.Enabled = true;
this.buttonConfiguration.Enabled = true;
this.buttonCommunication.Enabled = true;
this.buttonCalibration.Enabled = true;
this.buttonSystem.Enabled = true;
this.buttonMotor.Enabled = true;
this.buttonUpdate.Enabled = true;
this.buttonInitialization.Enabled = true;
this.buttonIOTest.Enabled = true;
this.buttonEquipment.Enabled = true;
this.buttonTime.Enabled = true;
this.buttonUser.Enabled = true;
this.buttonDataStatistics.Enabled = true;
this.buttonDataViewer.Enabled = true;
this.buttonEquipment.Visible = true;
this.buttonTest.Visible = true;
break;
case DataStore.UserGroup.NotLogin:
this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInformation;
this.buttonDataBackup.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuDataBackup;
this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuConfiguration;
this.buttonCommunication.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuCommunication;
this.buttonCalibration.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuCalibration;
this.buttonSystem.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuSystem;
this.buttonMotor.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuMotor;
this.buttonUpdate.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuUpdate;
this.buttonInitialization.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInitialization;
this.buttonIOTest.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuIOTest;
this.buttonTime.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuTime;
this.buttonDataViewer.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuViewer;
this.buttonDataStatistics.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuStatistics;
this.buttonEquipment.Visible = false;
this.buttonTest.Visible = false;
this.buttonUser.Visible = false;
break;
case DataStore.UserGroup.LogOut:
if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German)
group = "Ausloggen";
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
group = "登出";
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
group = "Выйти.";
else
group = "Log out";
this.labelExpireOfPassword.Visible = false;
break;
default:
break;
}
if (this.ParentForm.SystemConfig.IsLogin == true)
{
if (this.ParentForm.SystemConfig.IsPart11 == true)
{
expireDate = this.ParentForm.ChildFormMainDisplay.DisplayExpireOfPassword(user.Group);
if (expireDate != "-")
{
int intExpireDate = int.Parse(expireDate);
if (intExpireDate == 0)
{
this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOff;
this.labelExpireOfPassword.Text = "D-0";
}
else if (intExpireDate < 0)
{
if (intExpireDate * -1 > this.ParentForm.SystemConfig.CurrentUser.ExpirePassword)
expireDate = "-" + (this.ParentForm.SystemConfig.CurrentUser.ExpirePassword - 1).ToString();
this.labelExpireOfPassword.Text = "D" + expireDate;
if (intExpireDate >= -10)
this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOff;
else
this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
}
else
{
this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Text = "D+" + expireDate;
}
}
else
{
// Administrator or Developer
this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Text = "-";
}
}
else
{
// Part11 미사용
this.labelExpireOfPassword.ForeColor = this.ParentForm.ColorLogOn;
this.labelExpireOfPassword.Text = "-";
}
}
if (this.labelUserID.Text != id)
this.labelUserID.Text = id;
if (this.labelUserLevel.Text != group)
this.labelUserLevel.Text = group;
}
public void DisplayRefresh()
{
if (this.ParentForm.SystemConfig.IsLogin == false)
this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.NotLogin;
this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
this.ParentForm.TransferData(CommunicationCommand.ModeNormal, CommunicationID.MainBoard);
this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormMenu;
}
#endregion
#region Event Handler
private void buttonMenu_Click(object sender, EventArgs e)
{
SmartX.SmartButton button = sender as SmartX.SmartButton;
if (button == null)
return;
if (button == this.buttonTime)
{
#region 시간설정
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormTimeSetting);
this.ParentForm.ChildFormTimeSetting.DisplayRefresh();
#endregion
}
else if (button == this.buttonInformation)
{
#region 시스템정보
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormInformation);
this.ParentForm.ChildFormInformation.DisplayRefresh();
#endregion
}
else if (button == this.buttonDataBackup)
{
#region 데이터백업
if (this.ParentForm.SystemConfig.IsPart11 == false)
{
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormDataBackup);
this.ParentForm.ChildFormDataBackup.DisplayRefresh();
}
else
{
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormDataBackup);
this.ParentForm.ChildFormDataBackup_Part11.DisplayRefresh();
}
#endregion
}
else if (button == this.buttonSystem)
{
#region 시스템설정
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormSystemSetting);
this.ParentForm.ChildFormSystemSetting.DisplayRefresh();
#endregion
}
else if (button == this.buttonCalibration)
{
#region 중량조정
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormCalibration);
this.ParentForm.ChildFormCalibration.DisplayRefresh();
#endregion
}
else if (button == this.buttonConfiguration)
{
#region 환경설정
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormConfiguration);
this.ParentForm.ChildFormConfiguration.DisplayRefresh();
#endregion
}
else if (button == this.buttonCommunication)
{
#region 통신설정
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormCommunication);
this.ParentForm.ChildFormCommunication.DisplayRefresh();
#endregion
}
else if (button == this.buttonMotor)
{
#region 모터설정
this.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._1104_ImpellerMotorIndividualDirection, "");
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMotorSetting);
this.ParentForm.ChildFormMotorSetting.DisplayRefresh();
#endregion
}
else if (button == this.buttonInitialization)
{
#region 공장초기화
DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 5);
DialogResult dr = myDlg.ShowDialog();
if (dr == DialogResult.Yes)
{
// Part 11
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Initialization, "");
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormFactory);
this.ParentForm.ChildFormFactoryInitialize.timer1.Enabled = true;
}
#endregion
}
else if (button == this.buttonUpdate)
{
#region 업데이트
DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 3);
DialogResult dr = myDlg.ShowDialog();
if (dr == DialogResult.Yes)
{
// Part 11
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Update, "");
this.ParentForm.ChildFormProgramUpdate.DisplayRefresh();
}
#endregion
}
else if (button == this.buttonEquipment)
{
#region 장비설정
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormEquipmentSetting);
this.ParentForm.ChildFormEquipmentSetting.DisplayRefresh();
#endregion
}
else if (button == this.buttonIOTest)
{
#region IO테스트
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormIOTest);
this.ParentForm.ChildFormIOTest.DisplayRefresh();
#endregion
}
else if (button == this.buttonTest)
{
#region 장비테스트
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormEquipmentTest);
this.ParentForm.ChildFormEquipmentTest.DisplayRefresh();
#endregion
}
else if (button == this.buttonUser)
{
#region 유저설정
if (this.ParentForm.ChildFormUserEditor != null)
{
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormUserEditor);
this.ParentForm.ChildFormUserEditor.DisplayRefresh();
}
#endregion
}
else if (button == this.buttonDataStatistics)
{
#region 데이터 집계
if (this.ParentForm.ChildFormDataStatistics != null)
{
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormDataStatistics);
this.ParentForm.ChildFormDataStatistics.DisplayRefresh();
}
#endregion
}
else if (button == this.buttonDataViewer)
{
#region 데이터 뷰어
if (this.ParentForm.ChildFormDataViewer != null)
{
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormDataViewer);
this.ParentForm.ChildFormDataViewer.DisplayRefresh();
}
#endregion
}
}
private void buttonBack_Click(object sender, EventArgs e)
{
this.ParentForm.ChildFormMainDisplay.DisplayRefresh();
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMainDisplay);
}
private void buttonFunction_Click(object sender, EventArgs e)
{
if (this.ParentForm.SystemConfig.IsLogin == false)
{
this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer;
this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser);
}
}
#endregion
}
}