Esempio n. 1
0
        public void UpdateSysConfigUI()
        {
            UIPacker pack = curr_packer;

            this.input_uvar.Text = pack.curr_cfg.upper_var.ToString() + StringResource.str("gram");

            this.input_dvar.Text = pack.curr_cfg.lower_var.ToString() + StringResource.str("gram");

            this.lbl_weight.Text = pack.curr_cfg.target.ToString() + StringResource.str("gram");

            this.prd_no.Text = pack.curr_cfg.product_no.ToString();

            this.operator_no.Text = Program.oper;

            this.prd_desc.Text = pack.curr_cfg.product_desc.ToString();


            //load the corresponding picture.
            if (prdBmp != null)
            {
                prdBmp.Dispose();
            }


            string path_to_jpg;

            path_to_jpg = ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + pack.curr_cfg.product_desc.ToString() + ".jpg";
            if (!File.Exists(path_to_jpg))
            {
                path_to_jpg = ProdNum.baseDir + "\\prodpic\\default.jpg";
            }
            prdBmp = new Bitmap(path_to_jpg);

            prd_picture.Image = (Image)prdBmp;
        }
Esempio n. 2
0
 //public static string baseDir = "\\Storage Card\\TSioex";
 public ProdNum()
 {
     InitializeComponent();
     imglist                  = new List <string>();
     idlist                   = new List <string>();
     img_pglast.Click        += new EventHandler(lbl_pglast_MouseLeftButtonUp);
     img_pgnext.Click        += new EventHandler(lbl_pgnext_MouseLeftButtonUp);
     this.lbl_title.Text      = StringResource.str("selectprodnum");
     btn_ret_run.Click       += new EventHandler(btn_ret_run_Click_1);
     schemeItem1.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem2.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem3.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem4.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem5.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem6.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem7.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem8.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem9.ValidClick  += new EventHandler(ImageRect_MouseLeftButtonUp);
     schemeItem1.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem2.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem3.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem4.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem5.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem6.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem7.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem8.DeleteClick += new EventHandler(Delbtn_Click);
     schemeItem9.DeleteClick += new EventHandler(Delbtn_Click);
 }
Esempio n. 3
0
 public ProdWnd()
 {
     InitializeComponent();
     imglist = new List <string>();
     if (Directory.Exists(ProdNum.baseDir + "\\prodpic" + StringResource.language + "\\"))
     {
         Directory.CreateDirectory(ProdNum.baseDir + "\\prodpic" + StringResource.language + "\\");
     }
     foreach (string f in Directory.GetFiles(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\", "*.jpg"))
     {
         totalNum++;
         FileInfo fi = new FileInfo(f);
         string   nm = fi.Name.Remove(fi.Name.Length - 4, 4).Replace(' ', '_');
         imglist.Add(nm);
     }
     schemeItem1.ValidClick += new EventHandler(ImageSelected);
     schemeItem2.ValidClick += new EventHandler(ImageSelected);
     schemeItem3.ValidClick += new EventHandler(ImageSelected);
     schemeItem4.ValidClick += new EventHandler(ImageSelected);
     schemeItem5.ValidClick += new EventHandler(ImageSelected);
     schemeItem6.ValidClick += new EventHandler(ImageSelected);
     schemeItem7.ValidClick += new EventHandler(ImageSelected);
     schemeItem8.ValidClick += new EventHandler(ImageSelected);
     schemeItem9.ValidClick += new EventHandler(ImageSelected);
     btn_ret_run.Click      += new EventHandler(btn_ret_run_Click);
     img_pglast.Click       += new EventHandler(lbl_pglast_MouseLeftButtonUp);
     img_pgnext.Click       += new EventHandler(lbl_pgnext_MouseLeftButtonUp);
     this.lbl_title.Text     = StringResource.str("selectprod");
     UpdateDisplay();
 }
Esempio n. 4
0
        private void btnClrAll_Click(object sender, EventArgs e)
        {
            string txtUpdate = "delete from mains";

            ExecuteQuery(txtUpdate);
            Program.MsgShow(StringResource.str("done"));
        }
Esempio n. 5
0
        void uiTimer_Tick(object sender, EventArgs e)
        {
            if (!bootup.Join(10)) //still under bootup cycle
            {
                return;
            }
            uiTimer.Enabled = false;
            if (boot_ok == 0)
            {
                Program.MsgShow(StringResource.str("bootfail"));
                bootmsg.Text = "";
                bootup       = new Thread(PackerBoot);

                bootup.IsBackground = false;

                bootup.Start();
                uiTimer.Enabled = true;
            }
            else
            {
                StringResource.SetLanguage();

                Program.SwitchTo("runmode");
                this.Visible = false;
                this.bgPicture.Dispose();
            }
        }
Esempio n. 6
0
        private void lbl_sub_Click(object sender, EventArgs e)
        {
            Control b = sender as Control;


            if (b.Name == "btn_pwd")
            {
                Program.SwitchTo("password");
            }
            if (b.Name == "btn_eng")
            {
                Program.kbdwnd.Init(StringResource.str("enter_singlemode_pwd"), "engmode", true, KbdData);
                return;
            }
            if (b.Name == "btn_product")
            {
                Program.SwitchTo("product");
            }
            if (b.Name == "btn_bottom")
            {
                Program.SwitchTo("bottom");
            }
            if (b.Name == "btn_history")
            {
                Program.SwitchTo("history");
            }
            if (b.Name == "btn_alert")
            {
                Program.SwitchTo("alert");
            }
            Hide();
        }
Esempio n. 7
0
 private void ToggleStartStop()
 {
     if (curr_packer.status == PackerStatus.RUNNING)
     {
         curr_packer.StopRun();
         this.btn_allstart.Text = StringResource.str("all_start");
         btn_allstart.SetStyle(Color.Green, MyButtonType.round2RectButton);
         //show cursor;
         uiTimer.Enabled   = false;
         uiTimer.Interval  = 100;
         uiTimer.Enabled   = true;
         tm_cursor.Enabled = false;
         ShowCursor(1);
         bShowCursor = true;
     }
     else
     {
         curr_packer.bSimulate = false;
         uiTimer.Enabled       = false;
         uiTimer.Interval      = 10;
         uiTimer.Enabled       = true;
         curr_packer.StartRun();
         this.btn_allstart.Text = StringResource.str("all_stop");
         btn_allstart.SetStyle(Color.BlueViolet, MyButtonType.round2RectButton);
     }
 }
Esempio n. 8
0
 private void operator_no_Click(object sender, EventArgs e)
 {
     if (curr_packer.status != PackerStatus.RUNNING)
     {
         Program.kbdwnd.Init(StringResource.str("enter_operator_no"), "run_operator", false, KbdData);
     }
 }
Esempio n. 9
0
 private void btn_modify_Click(object sender, EventArgs e)
 {
     if ((dataGrid1.CurrentRowIndex >= 0) && (dataGrid1.CurrentRowIndex < reg_dt.Rows.Count))
     {
         Program.kbdwnd.Init(StringResource.str("enter_newvalue"), "reg_" + reg_dt.Rows[dataGrid1.CurrentRowIndex][0], false, KbdData);
     }
 }
Esempio n. 10
0
        private void passbar_MouseLeftButtonUp(int sid)
        {
            if (curr_packer.status == PackerStatus.RUNNING)
            {
                return;
            }
            if (!AlertWnd.b_manual_reset || !AlertWnd.b_turnon_alert) //auto reset or alert off
            {
                return;
            }

            byte id = (byte)sid;

            curr_node = id;
            if (AlertWnd.b_turnon_alert && AlertWnd.b_show_alert)
            {
                if ((NodeMaster.GetStatus(id) == NodeStatus.ST_LOST) || (NodeMaster.GetStatus(id) == NodeStatus.ST_DISABLED))
                {
                    lbl_alert3.Text = StringResource.str("alert_enable");
                }
                else
                {
                    lbl_alert3.Text = StringResource.str("alert_disable");
                }
                UpdateAlertWindow(true);
            }
        }
Esempio n. 11
0
        private void btn_modify_Click(object sender, EventArgs e)
        {
            string user = "";

            if (0 == usr_input.SelectedIndex)
            {
                user = "******";
            }

            if (1 == usr_input.SelectedIndex)
            {
                user = "******";
            }
            if (Password.compare_pwd(user, this.old_pwd_input_pwd))
            {
                if (new_pwd_input1_pwd == new_pwd_input2_pwd)
                {
                    Password.set_pwd(user, new_pwd_input1_pwd);
                    Program.MsgShow(StringResource.str("pwd_done"));

                    btn_return_Click(sender, e);
                }
                else
                {
                    Program.MsgShow(StringResource.str("notsame_pwd"));
                }
            }
            else
            {
                Program.MsgShow(StringResource.str("invalid_pwd"));
            }
        }
Esempio n. 12
0
 private void node_reg(string regname)
 {
     if (curr_packer.status == PackerStatus.RUNNING)
     {
         return;
     }
     Program.kbdwnd.Init(StringResource.str("enter_" + regname), regname, false, KbdData);
 }
Esempio n. 13
0
 private void prd_no_selected(string item)
 {
     curr_packer.curr_cfg.product_no = item;
     curr_packer.SaveCurrentConfig(4);
     lastcall             = "UpdatePrdNo";
     txt_oper.Text        = StringResource.str("downloading");
     txt_oper.Visible     = true;
     btn_allstart.Visible = true;
 }
Esempio n. 14
0
        //going to config menu
        private void btn_singlemode_click(object sender, EventArgs e)
        {
            if (curr_packer.status == PackerStatus.RUNNING)
            {
                return;
            }

            Program.kbdwnd.Init(StringResource.str("enter_singlemode_pwd"), "singlemode", true, KbdData);
        }
Esempio n. 15
0
 public void UpdateDisplay()
 {
     btn_alert.Text   = StringResource.str("alert_config");
     btn_bottom.Text  = StringResource.str("bottom_config");
     btn_pwd.Text     = StringResource.str("password_config");
     btn_eng.Text     = StringResource.str("eng_config");
     btn_history.Text = StringResource.str("history");
     btn_product.Text = StringResource.str("product_config");
     lbl_title.Text   = StringResource.str("configpage");
 }
Esempio n. 16
0
 public void UpdateDisplay()
 {
     btnClr.Text        = StringResource.str("clearpack");
     btnClrAll.Text     = StringResource.str("emptyhistory");
     lbl_starttime.Text = StringResource.str("start_date");
     lbl_endtime.Text   = StringResource.str("end_date");
     lbl_oper.Text      = StringResource.str("operator");
     lbl_prodno.Text    = StringResource.str("product_no");
     lbl_prod.Text      = StringResource.str("product_desc");
 }
Esempio n. 17
0
        public void UpdateUI()
        {
            byte vn = curr_packer.vib_addr;

            if (curr_node_index < 0)
            {
                return;
            }

            sub_freq_input.Text   = NodeMaster.GetNodeReg((byte)curr_node_index, "magnet_freq").ToString();
            sub_amp_input.Text    = NodeMaster.GetNodeReg((byte)curr_node_index, "magnet_amp").ToString();
            sub_time_input.Text   = NodeMaster.GetNodeReg((byte)curr_node_index, "magnet_time").ToString();
            sub_filter_input.Text = NodeMaster.GetNodeReg((byte)curr_node_index, "cs_gain_wordrate").ToString();
            wei_otime_input.Text  = NodeMaster.GetNodeReg((byte)curr_node_index, "open_w").ToString();
            wei_dtime_input.Text  = NodeMaster.GetNodeReg((byte)curr_node_index, "delay_w").ToString();
            col_dtime_input.Text  = NodeMaster.GetNodeReg((byte)curr_node_index, "delay_s").ToString();
            col_otime_input.Text  = NodeMaster.GetNodeReg((byte)curr_node_index, "open_s").ToString();
            openwei_input.Text    = NodeMaster.GetNodeReg((byte)curr_node_index, "delay_f").ToString();


            motor_speed_input.Text = NodeMaster.GetNodeReg((byte)curr_node_index, "motor_speed").ToString();

            run_freq.Text     = NodeMaster.GetNodeReg(curr_packer.vib_addr, "magnet_freq").ToString();
            run_amp.Text      = NodeMaster.GetNodeReg(curr_packer.vib_addr, "magnet_amp").ToString();
            run_time.Text     = NodeMaster.GetNodeReg(curr_packer.vib_addr, "magnet_time").ToString();
            btn_prd_no.Text   = curr_packer.curr_cfg.product_no.ToString();
            btn_prd_desc.Text = curr_packer.curr_cfg.product_desc.ToString();
            btn_target.Text   = curr_packer.curr_cfg.target.ToString() + StringResource.str("gram");
            btn_uvar.Text     = curr_packer.curr_cfg.upper_var.ToString() + StringResource.str("gram");
            btn_dvar.Text     = curr_packer.curr_cfg.lower_var.ToString() + StringResource.str("gram");

            cb_autoamp.Checked = (curr_packer.curr_cfg.target_comb > 0);
            if (cb_autoamp.Checked)
            {
                cb_autoamp.Text = StringResource.str("autoamp_on") + curr_packer.curr_cfg.target_comb.ToString();
            }
            else
            {
                cb_autoamp.Text = StringResource.str("autoamp_off");
            }

            lbl_node.Text = StringResource.str("bucketsetting") + "(" + (curr_node_index).ToString() + ")";

            //load the corresponding pictiure.
            string path_to_jpg;

            path_to_jpg = ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\" + this.curr_packer.curr_cfg.product_desc.ToString() + ".jpg";
            if (!File.Exists(path_to_jpg))
            {
                path_to_jpg = ProdNum.baseDir + "\\prodpic\\default.jpg";
            }
            prdBmp = new Bitmap(path_to_jpg);

            ellipseWithImageBrush.Image = (Image)prdBmp;
        }
Esempio n. 18
0
        private void main_input_click(object sender, EventArgs e)
        {
            if (curr_packer.status == PackerStatus.RUNNING)
            {
                //Program.MsgShow("is_running");
                return;
            }
            string regname = (sender as Label).Name;

            Program.kbdwnd.Init(StringResource.str("enter_" + regname), regname, false, KbdData);
        }
Esempio n. 19
0
        public void UpdateUI()
        {
            XElement cfg = Program.curr_cfg;

            b_turnon_alert = (cfg.Element("turnon_alert").Value == "ON");
            b_show_alert   = (cfg.Element("show_alert").Value == "ON");
            b_stop_onalert = (cfg.Element("stop_onalert").Value == "ON");
            b_manual_reset = (cfg.Element("manual_reset").Value == "ON");

            lbl_title.Text        = StringResource.str("alertpage");
            btn_manual_reset.Text = StringResource.str("manual_reset");
            btn_show_alert.Text   = StringResource.str("show_alert");
            btn_stop_onalert.Text = StringResource.str("stop_onalert");
            btn_turnon_alert.Text = StringResource.str("turnon_alert");

            btn_turnon_alert.bEnabled = b_turnon_alert;
            btn_show_alert.bEnabled   = b_show_alert;
            btn_stop_onalert.bEnabled = b_stop_onalert;
            btn_manual_reset.bEnabled = b_manual_reset;
            if (b_manual_reset)
            {
                btn_manual_reset.SetStyle(Color.LightGreen, MyButtonType.round2RectButton);
            }
            else
            {
                btn_manual_reset.SetStyle(Color.Gray, MyButtonType.round2RectButton);
            }
            if (b_turnon_alert)
            {
                btn_turnon_alert.SetStyle(Color.LightGreen, MyButtonType.round2RectButton);
            }
            else
            {
                btn_turnon_alert.SetStyle(Color.Gray, MyButtonType.round2RectButton);
            }
            if (b_show_alert)
            {
                btn_show_alert.SetStyle(Color.LightGreen, MyButtonType.round2RectButton);
            }
            else
            {
                btn_show_alert.SetStyle(Color.Gray, MyButtonType.round2RectButton);
            }

            if (b_stop_onalert)
            {
                btn_stop_onalert.SetStyle(Color.LightGreen, MyButtonType.round2RectButton);
            }
            else
            {
                btn_stop_onalert.SetStyle(Color.Gray, MyButtonType.round2RectButton);
            }
            this.Invalidate();
        }
Esempio n. 20
0
 public SchemeItem2()
 {
     InitializeComponent();
     txtBox.GotFocus += new EventHandler(txtBox_GotFocus);
     this.BackColor   = Color.Gray;
     this.ForeColor   = Color.Gray;
     txtBox.BackColor = Color.Gray;
     delBtn.bgColor   = Color.Gray;
     picBox.Click    += new EventHandler(picBox_Click);
     delBtn.Text      = StringResource.str("delete");
     delBtn.SetStyle(Color.Goldenrod, MyButtonType.roundButton);
     delBtn.ValidClick += new EventHandler(delBtn_ValidClick);
 }
Esempio n. 21
0
 private void btn_start_click(object sender, EventArgs e)
 {
     lastcall = "StartStop";
     if (curr_packer.status == PackerStatus.RUNNING)
     {
         lbl_status.Text = StringResource.str("stopping");
     }
     else
     {
         lbl_status.Text   = StringResource.str("starting");
         tm_cursor.Enabled = true;
     }
 }
Esempio n. 22
0
        private void btn_locksys_Click(object sender, EventArgs e)
        {
            XElement cfg = Program.curr_cfg;

            if (b_lockon)
            {
                Program.kbdwnd.Init(StringResource.str("enter_unlocknum"), "quitlock", false, KbdData);
            }
            else
            {
                Program.kbdwnd.Init(StringResource.str("enter_locknum"), "enterlock", false, KbdData);
            }
        }
Esempio n. 23
0
        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();
        }
Esempio n. 24
0
 public void new_prd_no_input(string param, string data)
 {
     if (curr_packer.pkg_confs.Keys.Contains <string>(data))
     {
         Program.MsgShow(StringResource.str("used_prdno"));
         lastcall = "select_prdno";
     }
     else
     {
         curr_packer.DuplicateCurrentConfig(data);
         ShowStatus("loading");
         lastcall = "UpdateUI";
     }
 }
Esempio n. 25
0
        public void UpdateDataGrid(object sender, EventArgs e)
        {
            SetConnection();
            sql_con.Open();

            sql_cmd = sql_con.CreateCommand();
            string   cols        = "select start_date, end_date, operator, product_no, product_desc, target, upper_var, lower_var, weight, pack_num from  mains ";
            DateTime s_dt        = mc_starttime.SelectionStart;
            DateTime e_dt        = mc_endtime.SelectionEnd;
            string   CommandText = cols + String.Format("where start_date>='{0}-{1}-{2} 00:00:00' and end_date<='{3}-{4}-{5} 23:59:59'",
                                                        s_dt.Year, s_dt.Month.ToString("D2"), s_dt.Day.ToString("D2"), e_dt.Year, e_dt.Month.ToString("D2"), e_dt.Day.ToString("D2"));

            if (lb_oper.SelectedIndex >= 0 && lb_oper.SelectedItem.ToString() != "*")
            {
                CommandText += String.Format(" and operator='{0}'", lb_oper.SelectedItem.ToString());
            }
            if (lb_prod.SelectedIndex >= 0 && lb_prod.SelectedItem.ToString() != "*")
            {
                CommandText += String.Format(" and product_desc='{0}'", lb_prod.SelectedItem.ToString());
            }
            if (lb_prodno.SelectedIndex >= 0 && lb_prodno.SelectedItem.ToString() != "*")
            {
                CommandText += String.Format(" and product_no='{0}'", lb_prodno.SelectedItem.ToString());
            }

            DB = new SQLiteDataAdapter(CommandText, sql_con);
            DS.Reset();
            DB.Fill(DS);
            DT = DS.Tables[0];
            double total_sum  = 0;
            UInt32 total_pack = 0;

            foreach (DataRow dr in DT.Rows)
            {
                total_pack += UInt32.Parse(dr["pack_num"].ToString());
                total_sum  += Double.Parse(dr["weight"].ToString());
            }
            this.dataGridView1.DataSource = DT;

            /*tofix
             * foreach (DataGridViewColumn dcol in dataGridView1.Columns)
             * {
             *  dcol.HeaderText = StringResource.str(dcol.Name);
             *  dcol.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
             *
             * }*/
            this.lbl_summary.Text = String.Format("{0}:{1}{6} , {2}:{3} , {4}:{5}{6}", StringResource.str("totalweight"), total_sum.ToString("F1"),
                                                  StringResource.str("totalpacknum"), total_pack.ToString(), StringResource.str("avgweight"), (total_pack == 0 ? "0" :(total_sum / total_pack).ToString("F1")), StringResource.str("gram"));
            sql_con.Close();
        }
Esempio n. 26
0
        public void UpdateDisplay()
        {
            lbl_title.Text = StringResource.str("pwdpage");
            usr_label.Text = StringResource.str("account");
            usr_input.Items.Clear();
            usr_input.Items.Add(StringResource.str("admin"));
            usr_input.Items.Add(StringResource.str("user"));

            label1.Text      = StringResource.str("org_password");
            label2.Text      = StringResource.str("new_password");
            label3.Text      = StringResource.str("new_password2");
            btn_modify.Text  = StringResource.str("modify_password");
            btn_restore.Text = StringResource.str("find_password");
        }
Esempio n. 27
0
 private void cb_autoamp_Click(object sender, EventArgs e)
 {
     if (curr_node_index < 0)
     {
         return;
     }
     if (!cb_autoamp.Checked)
     {
         KbdData("autoamp", "0");
     }
     else
     {
         Program.kbdwnd.Init(StringResource.str("enter_autoamp"), "autoamp", false, KbdData);
     }
 }
Esempio n. 28
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            string llimit = StringResource.str(param + "_llimit");
            string ulimit = StringResource.str(param + "_ulimit");

            if (data.ToString() == "")
            {
                Program.MsgShow(StringResource.str("emptydata"));
                return;
            }
            try
            {
                if (llimit == "Invalid String Key") //no limits setting
                {
                    kbdhandler(param, data.ToString());
                    Hide();
                    return;
                }

                if (llimit.IndexOf(".") < 0) //int case
                {
                    Int32 ll = Int32.Parse(llimit);
                    Int32 hl = Int32.Parse(ulimit);

                    if (Int32.Parse(data.ToString()) < ll || Int32.Parse(data.ToString()) > hl)
                    {
                        throw new Exception("input out of range");
                    }
                }
                else
                {
                    double ll = double.Parse(llimit);
                    double hl = double.Parse(ulimit);
                    if (double.Parse(data.ToString()) < ll || double.Parse(data.ToString()) > hl)
                    {
                        throw new Exception("input out of range");
                    }
                }
                kbdhandler(param, data.ToString());
            }
            catch (Exception err)
            {
                Program.MsgShow(err.Message);
                return;
            }

            Hide();
        }
Esempio n. 29
0
 static public void Action(byte[] addrs, string action)
 {
     actmsg.action = action;
     actmsg.addrs  = addrs;
     WaitEvent.Set();
     OverEvent.WaitOne();
     OverEvent.Reset();
     if (actmsg.action == "retry")
     {
         Program.MsgShow(StringResource.str("tryagain"));
     }
     if (actmsg.action == "fail")
     {
         throw new Exception("Critical Action failed.");
     }
 }
Esempio n. 30
0
        private void trypanel2(int i)
        {
            Program.kbdwnd.Init(StringResource.str("enter_newdate"), "newdate", false, KbdData);
            return;

            /*
             * Process app = new Process();
             * app.StartInfo.FileName = "ctlpnl.exe";
             * app.StartInfo.Arguments = "\\Windows\\cplmain.cpl," + i.ToString();
             * app.StartInfo.UseShellExecute = true;
             * //app.StartInfo.FileName = "rundll32.exe";
             * //app.StartInfo.Arguments = "shell32.dll,Control_RunDLL timedate.cpl,,1";
             * app.Start();
             * Thread.Sleep(2000);
             */
        }