initial commit
This commit is contained in:
224
Project/fMain.cs
Normal file
224
Project/fMain.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
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.F8) btHistory.PerformClick();
|
||||
else if (e1.KeyCode == Keys.F2) btModel.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();
|
||||
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}",Pub.Login.no,Pub.Login.name);
|
||||
Pub.log.Add("Program Start");
|
||||
}
|
||||
|
||||
|
||||
void _SetLang()
|
||||
{
|
||||
btModel.Text = Lang.ModelEdit;
|
||||
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()
|
||||
{
|
||||
Prj.fProjectList f = new Prj.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)
|
||||
{
|
||||
_Common.fItems f = new _Common.fItems();
|
||||
f.MdiParent = this;
|
||||
f.Show();
|
||||
}
|
||||
|
||||
private void inventoryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Common.fInventory f = new _Common.fInventory();
|
||||
f.MdiParent = this;
|
||||
f.Show();
|
||||
}
|
||||
|
||||
private void lineCodesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void equipmentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Management.fEquipment f = new _Management.fEquipment();
|
||||
f.MdiParent = this;
|
||||
f.Show();
|
||||
}
|
||||
|
||||
private void importEquipmentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Management.fImpEquipment f = new _Management.fImpEquipment();
|
||||
f.MdiParent = this;
|
||||
f.Show();
|
||||
}
|
||||
|
||||
private void equipmentReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Management.rpt_equipment f = new _Management.rpt_equipment();
|
||||
//f.MdiParent = this;
|
||||
f.Show();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user