315 lines
9.0 KiB
C#
315 lines
9.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Project
|
|
{
|
|
public partial class fMain : Form
|
|
{
|
|
string SearchKey = string.Empty;
|
|
public fMain()
|
|
{
|
|
InitializeComponent();
|
|
this.KeyDown += (s1, e1) =>
|
|
{
|
|
if (e1.KeyCode == Keys.Escape) this.Close();
|
|
else if (e1.KeyCode == Keys.F12) btSetting.PerformClick();
|
|
else if (e1.KeyCode == Keys.F11) btLog.PerformClick();
|
|
else if (e1.KeyCode == Keys.F1 && e1.Control && e1.Shift)
|
|
{
|
|
Dialog.fDebug f = new Dialog.fDebug();
|
|
f.Show();
|
|
}
|
|
else if (e1.KeyCode == Keys.F2 && e1.Control && e1.Shift)
|
|
{
|
|
var f = new fLog();
|
|
f.Show();
|
|
}
|
|
|
|
if (DateTime.Now > Pub.LastInputTime) Pub.LastInputTime = DateTime.Now;
|
|
};
|
|
|
|
this.MouseMove += (s1, e1) => { if (DateTime.Now > Pub.LastInputTime) Pub.LastInputTime = DateTime.Now; };
|
|
this.FormClosing += __Closing;
|
|
}
|
|
|
|
private void __Closing(object sender, FormClosingEventArgs e)
|
|
{
|
|
MessageWindow.CloseAll();
|
|
var rlt = Util.MsgQ(Lang.Question_Exit);
|
|
if (rlt != DialogResult.Yes)
|
|
{
|
|
e.Cancel = true;
|
|
return;
|
|
}
|
|
Pub.log.Add("Program Close");
|
|
Pub.log.Flush();
|
|
bBW = false; //backgroundWorker
|
|
if (bw.IsBusy) bw.CancelAsync();
|
|
}
|
|
|
|
private void __Load(object sender, EventArgs e)
|
|
{
|
|
this.Text = Application.ProductName + " v" + Application.ProductVersion;
|
|
Pub.init();
|
|
_SetLang();
|
|
if (Pub.setting.FullScreen) this.WindowState = FormWindowState.Maximized;
|
|
else this.WindowState = FormWindowState.Normal;
|
|
this.Show();
|
|
Application.DoEvents();
|
|
|
|
Pub.barcode = new Device.Barcode();
|
|
if (!Pub.setting.Barcode.isEmpty()) Pub.barcode.PortName = Pub.setting.Barcode;
|
|
Pub.barcode.ReceiveData += barcode_ReceiveData;
|
|
|
|
UpdateControls();
|
|
|
|
tmDisplay.Start(); //display timer
|
|
|
|
bw.RunWorkerAsync(); //background worker
|
|
|
|
Dialog.fLogin flog = new Dialog.fLogin();
|
|
if (flog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
|
Application.ExitThread();
|
|
|
|
sbLogin.Text = string.Format("{0} {1}", FCOMMON.info.Login.no, FCOMMON.info.Login.name);
|
|
Pub.log.Add("Program Start");
|
|
}
|
|
|
|
|
|
void _SetLang()
|
|
{
|
|
btSetting.Text = Lang.Setting;
|
|
}
|
|
|
|
void barcode_ReceiveData(object sender, Device.Barcode.ReceiveDataEventArgs e)
|
|
{
|
|
#region "invoke"
|
|
if(this.InvokeRequired)
|
|
{
|
|
this.BeginInvoke( new EventHandler<Device.Barcode.ReceiveDataEventArgs>(barcode_ReceiveData),new object[]{sender,e} );
|
|
return;
|
|
}
|
|
#endregion
|
|
Pub.log.Add("BCD", "Rx:"+e.StrValue);
|
|
}
|
|
|
|
void Menu_Log()
|
|
{
|
|
var f = new fLog();
|
|
f.TopMost = true;
|
|
f.Show();
|
|
}
|
|
|
|
void Menu_Setting()
|
|
{
|
|
fSetting f = new fSetting();
|
|
if (f.ShowDialog() == DialogResult.OK)
|
|
{
|
|
Pub.setting.Save();
|
|
Pub.log.AddI("Setting Save");
|
|
Pub.log.Add(Pub.setting.ToString());
|
|
UpdateControls();
|
|
}
|
|
}
|
|
|
|
|
|
#region "util"
|
|
|
|
void UpdateControls()
|
|
{
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void settingToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
Menu_Setting();
|
|
}
|
|
|
|
private void logToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
Menu_Log();
|
|
}
|
|
|
|
private void historyToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void modelToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void listToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
menu_projecT_list();
|
|
}
|
|
void menu_projecT_list()
|
|
{
|
|
var f = new FPJ0000.fProjectList();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void helpToolStripButton_Click(object sender, EventArgs e)
|
|
{
|
|
menu_projecT_list();
|
|
}
|
|
|
|
private void itemsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
var f = new FCM0000.fItems();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void inventoryToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void lineCodesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
private void equipmentToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void importEquipmentToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void equipmentReportToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void lineCodeToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
_Management.fLineCode f = new _Management.fLineCode();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void staffGridToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
_Info.fInfo_Staff f = new _Info.fInfo_Staff();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void dataToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
FEQ0000.fEquipment f = new FEQ0000.fEquipment(FEQ0000.fEquipment.eTabletype.BUMP);
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void importToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void reportToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void dataMoldEOLToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
FEQ0000.fEquipment f = new FEQ0000.fEquipment(FEQ0000.fEquipment.eTabletype.MOLD);
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void dataFOLToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
var f = new FEQ0000.fEquipment(FEQ0000.fEquipment.eTabletype.FOL);
|
|
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void userToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void codeToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void userInfoToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
if (FCOMMON.info.Login.level >= 10)
|
|
{
|
|
var f = new _Common.fUserList();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
else
|
|
{
|
|
var f = new _Common.fUserInfo();
|
|
f.ShowDialog();
|
|
}
|
|
}
|
|
|
|
private void cascadeToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.Cascade);
|
|
}
|
|
|
|
private void tileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.TileVertical);
|
|
}
|
|
|
|
private void tileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.TileHorizontal);
|
|
}
|
|
|
|
private void closeAllToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (Form childForm in MdiChildren)
|
|
{
|
|
childForm.Close();
|
|
}
|
|
}
|
|
|
|
private void arrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.ArrangeIcons);
|
|
}
|
|
|
|
private void personalInventoryToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
var f = new FCM0000.fInventory();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
private void minutesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
var f = new FBS0000.fMinutes();
|
|
f.MdiParent = this;
|
|
f.Show();
|
|
}
|
|
|
|
}
|
|
}
|