static public void Initialize() { /* System.Diagnostics.Process[] pses = System.Diagnostics.Process..GetProcessesByName("TSioex"); if (pses.Length > 0) { System.Diagnostics.Process.GetCurrentProcess().Kill(); return; } */ Thread.Sleep(3000); try { StringResource.SetLanguage(); msgwnd = new MsgDlg(); app_cfg = new SqlConfig("app"); app_cfg.LoadConfigFromFile(); curr_cfg = app_cfg.Current; packers = new List<UIPacker>(); for (int i = 0; i < Int32.Parse(curr_cfg.Element("machine_number").Value); i++) { UIPacker p = new UIPacker(i); line++; p.InitConfig(); packers.Add(p); } line = 999; NodeMaster.Dummy(); line++; singlewnd = new SingleModeWnd(); line++; runwnd = new RunModeWnd(); line++; histwnd = new ProdHistory(); line++; kbdwnd = new kbdWnd(); line++; bottomwnd = new BottomWnd(); line++; alertwnd = new AlertWnd(); line++; alertwnd.UpdateUI(); //load alert configuration which is in app_config.xml too pwdwnd = new PwdWnd(); line++; engwnd = new EngWnd(); line++; configwnd = new ConfigMenuWnd(); line++; prodwnd = new ProdWnd(); line++; prodnum = new ProdNum(); line++; } catch (Exception e) { MessageBox.Show(e.Message); System.Diagnostics.Process.GetCurrentProcess().Kill(); } }
static public void Initialize() { /* * System.Diagnostics.Process[] pses = System.Diagnostics.Process..GetProcessesByName("TSioex"); * if (pses.Length > 0) * { * System.Diagnostics.Process.GetCurrentProcess().Kill(); * return; * } */ Thread.Sleep(3000); try { StringResource.SetLanguage(); msgwnd = new MsgDlg(); app_cfg = new SqlConfig("app"); app_cfg.LoadConfigFromFile(); curr_cfg = app_cfg.Current; packers = new List <UIPacker>(); for (int i = 0; i < Int32.Parse(curr_cfg.Element("machine_number").Value); i++) { UIPacker p = new UIPacker(i); line++; p.InitConfig(); packers.Add(p); } line = 999; NodeMaster.Dummy(); line++; singlewnd = new SingleModeWnd(); line++; runwnd = new RunModeWnd(); line++; histwnd = new ProdHistory(); line++; kbdwnd = new kbdWnd(); line++; bottomwnd = new BottomWnd(); line++; alertwnd = new AlertWnd(); line++; alertwnd.UpdateUI(); //load alert configuration which is in app_config.xml too pwdwnd = new PwdWnd(); line++; engwnd = new EngWnd(); line++; configwnd = new ConfigMenuWnd(); line++; prodwnd = new ProdWnd(); line++; prodnum = new ProdNum(); line++; } catch (Exception e) { MessageBox.Show(e.Message); System.Diagnostics.Process.GetCurrentProcess().Kill(); } }
public void RefreshRunNodeUI() //node ui update at run time { lbl_status.Text = ""; foreach (UIPacker pk in Program.packers) { foreach (byte naddr in pk.weight_nodes) { string param = "wei_node" + naddr.ToString(); byte n = (byte)(RunModeWnd.StringToId(param)); NodeCombination nc = pk.nc; double wt = NodeMaster.GetWeight(n); if (wt > -1000 && wt <= WeighNode.MAX_VALID_WEIGHT) { runPan1.SetText(n, wt.ToString("F1"), false); } if (NodeMaster.GetStatus(n) == NodeStatus.ST_LOST || NodeMaster.GetStatus(n) == NodeStatus.ST_DISABLED) { runPan1.SetStatus("weightbar", n, PanStatus.ERROR, false); } string err = NodeMaster.GetErrors(n); if (err != "" && AlertWnd.b_turnon_alert && AlertWnd.b_show_alert) { lbl_status.Text = n.ToString() + ":" + StringResource.str(err.Substring(0, err.IndexOf(';'))) + "\n"; } } if (pk.status == PackerStatus.RUNNING) { lbl_speed.Text = pk.speed.ToString(); lbl_lastweight.Text = pk.last_pack_weight.ToString("F1"); lbl_totalpack.Text = pk.total_packs.ToString(); RefreshVibUI(); } } if (lbl_status.Text.ToString() == "") { lbl_status.Text = StringResource.str("normal"); lbl_status.ForeColor = Color.Green; } else { lbl_status.ForeColor = Color.Red; if (AlertWnd.b_turnon_alert && AlertWnd.b_stop_onalert && (curr_packer.status == PackerStatus.RUNNING)) { btn_start_click(null, null); } } runPan1.ReDraw(); }
private void btn_restore_Click(object sender, EventArgs e) { RunModeWnd.Reset(); Program.MsgShow(StringResource.str("pwd_restore_done")); btn_return_Click(sender, e); }
public void KbdData(string param, string data) { XElement cfg = Program.curr_cfg; if (param == "entersys") { if (Password.compare_pwd("admin", data)) { Process app = new Process(); app.StartInfo.FileName = "Explorer.exe"; app.StartInfo.Arguments = ""; app.Start(); Thread.Sleep(2000); Program.kbdwnd.Hide(); // Type shellType = Type.GetTypeFromProgID("Shell.Application"); // object shellObject = System.Activator.CreateInstance(shellType); // shellType.InvokeMember("ToggleDesktop", System.Reflection.BindingFlags.InvokeMethod, null, shellObject, null); } return; } if (param == "quitlock") { if (Password.compare_pwd("lock", data)) { b_lockon = false; Password.set_pwd("lock", "0"); b_lockon = false; Program.runwnd.Disable(true); Program.singlewnd.Disable(true); UpdateDisplay(true); } } if (param == "enterlock") { //App should expire after desired packer number reached , data is the actual packer count Password.set_pwd("lock_on", data); DeleteRegist("lock_on"); WTRegedit("lock_on", data); Password.set_pwd("lock", data); Program.SaveAppConfig(); b_lockon = true; UpdateDisplay(false); } if (param.IndexOf("reg_") == 0) { SubNode n = null; if (curr_sel == -1) { return; } Byte i = Convert.ToByte(curr_sel); NodeMaster.SetNodeReg(i, new string[] { param.Remove(0, 4) }, new UInt32[] { UInt32.Parse(data) }); btn_refreshreg_Click(null, null); } if (param.IndexOf("chgnd_") == 0) { Byte oldaddr = Byte.Parse(param.Remove(0, 6)); Byte newaddr = Byte.Parse(data); NodeMaster.ChangeAddress(oldaddr, newaddr); } if (param != "cali0" && (param.IndexOf("cali") == 0)) //cali1 to cali10 { string msg = StringResource.str("put_poise") + "(" + data + StringResource.str("gram") + ")"; Program.MsgShow(msg); int i = RunModeWnd.StringToId(param) - 1; if (curr_sel >= 0) { NodeMaster.RefreshNodeReg((byte)curr_sel, new string[] { "cs_mtrl" }); UInt32 cs_mtrl_val = NodeMaster.GetNodeReg((byte)curr_sel, "cs_mtrl"); if (cs_mtrl_val <= WeighNode.MAX_VALID_WEIGHT) { if (i < 5) { NodeMaster.SetNodeReg((byte)curr_sel, new string[] { "poise_weight_gram" + i.ToString() }, new UInt32[] { cs_mtrl_val }); } else { NodeMaster.SetNodeReg((byte)curr_sel, new string[] { "cs_poise" + (i - 5).ToString() }, new UInt32[] { cs_mtrl_val }); } NodeMaster.Action(new byte[] { (byte)curr_sel }, "flash"); Program.MsgShow(StringResource.str("calidone")); label3_MouseLeftButtonUp(null, null); return; } Program.MsgShow(StringResource.str("tryagain")); } return; } }