202 lines
9.3 KiB
C#
202 lines
9.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using SmartX;
|
|
using ITC81DB_0H.Forms;
|
|
|
|
namespace ITC81DB_0H.Controls
|
|
{
|
|
public partial class ControlBottomSystem : UserControl
|
|
{
|
|
#region Field
|
|
private FormMenu m_ParentForm;
|
|
|
|
private DataStore.MenuBottomSystem CurrentMenu;
|
|
private Collection<SmartButton> CollectionButtonMenu;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public ControlBottomSystem(FormMenu parent)
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.ParentForm = parent;
|
|
|
|
this.InitializeDesign();
|
|
this.DefaultSetting();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public FormMenu ParentForm
|
|
{
|
|
get { return this.m_ParentForm; }
|
|
private set { this.m_ParentForm = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
public void InitializeDesign()
|
|
{
|
|
}
|
|
private void DefaultSetting()
|
|
{
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.Help;
|
|
|
|
this.CollectionButtonMenu = new Collection<SmartButton>();
|
|
this.CollectionButtonMenu.Clear();
|
|
this.CollectionButtonMenu.Add(this.buttonHelp);
|
|
this.CollectionButtonMenu.Add(this.buttonCalibration);
|
|
this.CollectionButtonMenu.Add(this.buttonJudgmentSetting);
|
|
this.CollectionButtonMenu.Add(this.buttonSorter);
|
|
this.CollectionButtonMenu.Add(this.buttonExternalOutput);
|
|
this.CollectionButtonMenu.Add(this.buttonIOTest);
|
|
}
|
|
|
|
public void CurrentControlEnable(bool enable)
|
|
{
|
|
foreach (SmartButton button in this.CollectionButtonMenu)
|
|
button.Enabled = enable;
|
|
}
|
|
|
|
public void UpdateDisplayMenuButton(DataStore.MenuBottomSystem menu)
|
|
{
|
|
switch (menu)
|
|
{
|
|
case DataStore.MenuBottomSystem.Calibration:
|
|
if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
|
|
this.buttonCalibration.ButtonDown();
|
|
if (this.buttonExternalOutput.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonExternalOutput.ButtonUp();
|
|
if (this.buttonHelp.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonHelp.ButtonUp();
|
|
if (this.buttonIOTest.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonIOTest.ButtonUp();
|
|
if (this.buttonJudgmentSetting.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonJudgmentSetting.ButtonUp();
|
|
if (this.buttonSorter.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonSorter.ButtonUp();
|
|
break;
|
|
case DataStore.MenuBottomSystem.ExternalOutput:
|
|
if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonCalibration.ButtonUp();
|
|
if (this.buttonExternalOutput.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
|
|
this.buttonExternalOutput.ButtonDown();
|
|
if (this.buttonHelp.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonHelp.ButtonUp();
|
|
if (this.buttonIOTest.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonIOTest.ButtonUp();
|
|
if (this.buttonJudgmentSetting.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonJudgmentSetting.ButtonUp();
|
|
if (this.buttonSorter.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonSorter.ButtonUp();
|
|
break;
|
|
case DataStore.MenuBottomSystem.Help:
|
|
if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonCalibration.ButtonUp();
|
|
if (this.buttonExternalOutput.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonExternalOutput.ButtonUp();
|
|
if (this.buttonHelp.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
|
|
this.buttonHelp.ButtonDown();
|
|
if (this.buttonIOTest.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonIOTest.ButtonUp();
|
|
if (this.buttonJudgmentSetting.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonJudgmentSetting.ButtonUp();
|
|
if (this.buttonSorter.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonSorter.ButtonUp();
|
|
break;
|
|
case DataStore.MenuBottomSystem.IOTest:
|
|
if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonCalibration.ButtonUp();
|
|
if (this.buttonExternalOutput.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonExternalOutput.ButtonUp();
|
|
if (this.buttonHelp.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonHelp.ButtonUp();
|
|
if (this.buttonIOTest.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
|
|
this.buttonIOTest.ButtonDown();
|
|
if (this.buttonJudgmentSetting.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonJudgmentSetting.ButtonUp();
|
|
if (this.buttonSorter.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonSorter.ButtonUp();
|
|
break;
|
|
case DataStore.MenuBottomSystem.JudgmentSetting:
|
|
if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonCalibration.ButtonUp();
|
|
if (this.buttonExternalOutput.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonExternalOutput.ButtonUp();
|
|
if (this.buttonHelp.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonHelp.ButtonUp();
|
|
if (this.buttonIOTest.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonIOTest.ButtonUp();
|
|
if (this.buttonJudgmentSetting.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
|
|
this.buttonJudgmentSetting.ButtonDown();
|
|
if (this.buttonSorter.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonSorter.ButtonUp();
|
|
break;
|
|
case DataStore.MenuBottomSystem.SorterSetting:
|
|
if (this.buttonCalibration.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonCalibration.ButtonUp();
|
|
if (this.buttonExternalOutput.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonExternalOutput.ButtonUp();
|
|
if (this.buttonHelp.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonHelp.ButtonUp();
|
|
if (this.buttonIOTest.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonIOTest.ButtonUp();
|
|
if (this.buttonJudgmentSetting.ButtonStatus != SmartButton.BUTSTATUS.UP)
|
|
this.buttonJudgmentSetting.ButtonUp();
|
|
if (this.buttonSorter.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
|
|
this.buttonSorter.ButtonDown();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void DisplayRefresh(SystemStatus status)
|
|
{
|
|
this.buttonHelp.ButtonDown();
|
|
this.buttonCalibration.ButtonUp();
|
|
this.buttonJudgmentSetting.ButtonUp();
|
|
this.buttonIOTest.ButtonUp();
|
|
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.Help;
|
|
this.ParentForm.DisplayBottomSystem(this.CurrentMenu);
|
|
}
|
|
#endregion
|
|
|
|
#region Event Handler
|
|
private void buttonMenu_Click(object sender, EventArgs e)
|
|
{
|
|
SmartButton button = sender as SmartButton;
|
|
|
|
if (button == null)
|
|
return;
|
|
|
|
if (button == this.buttonHelp)
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.Help;
|
|
else if (button == this.buttonCalibration)
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.Calibration;
|
|
else if (button == this.buttonJudgmentSetting)
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.JudgmentSetting;
|
|
else if (button == this.buttonSorter)
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.SorterSetting;
|
|
else if (button == this.buttonExternalOutput)
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.ExternalOutput;
|
|
else if (button == this.buttonIOTest)
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.IOTest;
|
|
else
|
|
this.CurrentMenu = DataStore.MenuBottomSystem.Help;
|
|
|
|
this.ParentForm.DisplayBottomSystem(this.CurrentMenu);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|