You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
7.0 KiB
C#

using DevExpress.XtraBars.Navigation;
using DevExpress.XtraEditors;
using System.Configuration;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using ZJ_BYD.Untils;
using ZJ_BYD.UserControls;
using ZJ_BYD.UserControls.AHeadPara;
using ZJ_BYD.UserControls.MaskCode;
using ZJ_BYD.UserControls.PlcPoint;
using ZJ_BYD.UserControls.Station;
namespace ZJ_BYD
{
public partial class Index : XtraForm
{
public Index()
{
InitializeComponent();
this.Top = 0;
this.Left = 0;
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
}
private void Index_Load(object sender, System.EventArgs e)
{
lblLineName.Text = Program.LineName;
var logoFileName = ConfigurationManager.AppSettings["logofilename"];
var imgPath = Path.Combine(Application.StartupPath, "image/" + logoFileName);
sysLogo.Image = Image.FromFile(imgPath);
//首工位无须设置前置参数
var station = Program.stationInfos.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode);
if (station != null && station.IsShowOrderBtn && !station.IsShowPrintBtn)
{
foreach (AccordionControlElement item in accordionControl.Elements)
{
foreach (var elementItem in item.Elements)
{
if (elementItem.Name == "aheadpara")
{
elementItem.Visible = false;
}
}
}
}
}
private void lblClose_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void accordionControl_ElementClick(object sender, DevExpress.XtraBars.Navigation.ElementClickEventArgs e)
{
var elementName = e.Element.Name;
ChangePlane(elementName);
}
/// <summary>
/// 根据节点名称进行相应的展示
/// </summary>
/// <param name="name"></param>
private void ChangePlane(string name)
{
switch (name)
{
case "elementhome":
break;
//case "testitemconfig":
// splitcrol.Panel2.Controls.Clear();
// TestItems testItems = new TestItems
// {
// Dock = DockStyle.Fill
// };
// splitcrol.Panel2.Controls.Add(testItems);
// break;
case "baseconfig":
splitcrol.Panel2.Controls.Clear();
CurrentConfig baseConfig = new CurrentConfig
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(baseConfig);
break;
case "plcpointconfig":
var confirmPwd = new ConfirmPwd();
confirmPwd.ShowDialog();
var plcPwd = ConfigurationManager.AppSettings["plcpwd"];
if (!string.IsNullOrWhiteSpace(confirmPwd.inputPwd))
{
if (confirmPwd.inputPwd != plcPwd)
{
XtraMessageBox.Show("口令错误!");
return;
}
splitcrol.Panel2.Controls.Clear();
PlcPointConfig plcPointConfig = new PlcPointConfig
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(plcPointConfig);
}
break;
case "elementupdatepwd":
var confirmPwd1 = new ConfirmPwd();
confirmPwd1.ShowDialog();
if (!string.IsNullOrWhiteSpace(confirmPwd1.inputPwd))
{
if (confirmPwd1.inputPwd != Program.HightPwd)
{
XtraMessageBox.Show("口令错误!");
return;
}
splitcrol.Panel2.Controls.Clear();
ModifyPwd modifyPwd = new ModifyPwd
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(modifyPwd);
}
break;
case "msk":
splitcrol.Panel2.Controls.Clear();
MskCode mskConfig = new MskCode
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(mskConfig);
break;
//case "modelstation":
// splitcrol.Panel2.Controls.Clear();
// MachineTypeStation machineTypeStation = new MachineTypeStation
// {
// Dock = DockStyle.Fill
// };
// splitcrol.Panel2.Controls.Add(machineTypeStation);
// break;
case "aheadpara":
splitcrol.Panel2.Controls.Clear();
AheadParaConfig aheadParaConfig = new AheadParaConfig
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(aheadParaConfig);
break;
case "elementstation":
splitcrol.Panel2.Controls.Clear();
MstStation mstStation = new MstStation
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(mstStation);
break;
//case "elementmachinetype":
// splitcrol.Panel2.Controls.Clear();
// MachineType machineType = new MachineType
// {
// Dock = DockStyle.Fill
// };
// splitcrol.Panel2.Controls.Add(machineType);
// break;
case "changemachine":
splitcrol.Panel2.Controls.Clear();
ChangeMachineType changeMachineType = new ChangeMachineType
{
Dock = DockStyle.Fill
};
splitcrol.Panel2.Controls.Add(changeMachineType);
break;
}
}
/// <summary>
/// 打开软键盘
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_Keyboard_Click(object sender, System.EventArgs e)
{
TouchKeyBoardHelper.OpenKeyBoardFun();
}
}
}