public kbdWnd() { InitializeComponent(); btn_backspace.SetStyle(btColor, MyButtonType.round2Button); btn_clr.SetStyle(btColor, MyButtonType.round2Button); btn_quit.SetStyle(btColor, MyButtonType.round2Button); btn_ok.SetStyle(btColor, MyButtonType.round2Button); btn_num0.SetStyle(btColor, MyButtonType.round2Button); btn_num1.SetStyle(btColor, MyButtonType.round2Button); btn_num2.SetStyle(btColor, MyButtonType.round2Button); btn_num3.SetStyle(btColor, MyButtonType.round2Button); btn_num4.SetStyle(btColor, MyButtonType.round2Button); btn_num5.SetStyle(btColor, MyButtonType.round2Button); btn_num6.SetStyle(btColor, MyButtonType.round2Button); btn_num7.SetStyle(btColor, MyButtonType.round2Button); btn_num8.SetStyle(btColor, MyButtonType.round2Button); btn_num9.SetStyle(btColor, MyButtonType.round2Button); btn_numN.SetStyle(btColor, MyButtonType.round2Button); btn_numP.SetStyle(btColor, MyButtonType.round2Button); roundRect1.SetStyle(Color.Beige, MyButtonType.roundRect); btn_backspace.ValidClick += new EventHandler(btn_backspace_Click); btn_clr.ValidClick += new EventHandler(btn_clr_Click); btn_quit.ValidClick += new EventHandler(btn_quit_Click); btn_ok.ValidClick += new EventHandler(btn_ok_Click); btn_num0.ValidClick += new EventHandler(btn_num0_Click); btn_num1.ValidClick += new EventHandler(btn_num1_Click); btn_num2.ValidClick += new EventHandler(btn_num2_Click); btn_num3.ValidClick += new EventHandler(btn_num3_Click); btn_num4.ValidClick += new EventHandler(btn_num4_Click); btn_num5.ValidClick += new EventHandler(btn_num5_Click); btn_num6.ValidClick += new EventHandler(btn_num6_Click); btn_num7.ValidClick += new EventHandler(btn_num7_Click); btn_num8.ValidClick += new EventHandler(btn_num8_Click); btn_num9.ValidClick += new EventHandler(btn_num9_Click); btn_numN.ValidClick += new EventHandler(btn_numN_Click); btn_numP.ValidClick += new EventHandler(btn_numP_Click); btn_backspace.Text = StringResource.str("backspace"); btn_clr.Text = StringResource.str("clr"); btn_quit.Text = StringResource.str("quit"); btn_ok.Text = StringResource.str("ok"); btn_num0.Text = "0"; btn_num1.Text = "1"; btn_num2.Text = "2"; btn_num3.Text = "3"; btn_num4.Text = "4"; btn_num5.Text = "5"; btn_num6.Text = "6"; btn_num7.Text = "7"; btn_num8.Text = "8"; btn_num9.Text = "9"; btn_numN.Text = "-"; btn_numP.Text = "."; data = new StringBuilder("", 10); note = "Note"; TopMost = true; password = false; Hide(); }
private void UpdateText() { if (_status == RUN_STATE.IDLE) { bt_run.Text = StringResource.str("start"); bt_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.White; bt_run.Width = progress_width; } if (_status == RUN_STATE.ERROR) { bt_run.Text = StringResource.str("error") + message; bt_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.MediumVioletRed; bt_run.Width = progress_width; } if (_status == RUN_STATE.DISABLED) { bt_run.Text = StringResource.str("initialize"); bt_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.LightGray; bt_run.Width = progress_width; } if (_status == RUN_STATE.INITIALIZING) { bt_run.Text = String.Format("{0} {1}s", StringResource.str("initialize"), waiting); bt_run.BackColor = Color.LightYellow; } if (_status == RUN_STATE.STOPPING) { bt_run.Text = StringResource.str("stopping"); bt_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.LightYellow; bt_run.Width = progress_width; } if (_status == RUN_STATE.SEARCHING) { bt_run.Text = String.Format("{0} {1}s", StringResource.str("searching"), waiting); bt_run.BackColor = Color.LightYellow; } if (_status == RUN_STATE.READING) { bt_run.Text = String.Format("{0} {1}s", StringResource.str("reading"), waiting); bt_run.BackColor = Color.LightYellow; } if (_status == RUN_STATE.TRACKING) { bt_run.Text = String.Format("{0} ({1}/{2}) {3}s", StringResource.str("tracking"), count, total, waiting); bt_run.BackColor = Color.LightYellow; } if ((_status == RUN_STATE.TRACKING) || (_status == RUN_STATE.SEARCHING) || (_status == RUN_STATE.INITIALIZING)) { // if (total > 0) // this.bt_run.Width = _count * (progress_width - 140) / total + 140; // else // this.bt_run.Width = progress_width; } }
public bool CheckError() { lbl_error.Text = ""; lbl_error.Visible = false; RxInfo rx = Program.lst_rxinfo[Program.mainwnd.selectedRx]; RsInfo rs = Program.lst_rsinfo[Program.mainwnd.selectedRs]; if ((rs.dValue / rx.dRxInput) > 1023.1) { lbl_error.Text = StringResource.str("rs_2big") + "," + StringResource.str(String.Format("help_std{0}", rx.iRRange)); lbl_error.Visible = true; return(true); } if ((rs.dValue / rx.dRxInput) < 0.000977) //=1/1023.1 { lbl_error.Text = StringResource.str("rs_2small") + "," + StringResource.str(String.Format("help_std{0}", rx.iRRange)); lbl_error.Visible = true; return(true); } /*if ((rx.iRRange == ActionMgr.RNG_10K && rx.bSqrt) || (rx.iRRange == ActionMgr.RNG_100K && rx.bSqrt)) * { * lbl_error.Text = StringResource.str("nox2_4big"); * lbl_error.Visible = true; * return true; * }*/ return(false); }
static public bool IsInAction() { if (actmsg.action == "" || actmsg.action == null) { return(false); } if (!OverEvent.WaitOne(30, false)) { return(true); } OverEvent.Reset(); if ((actmsg.action != "retry") && (actmsg.action != "fail")) { actmsg.action = ""; return(false); } if (actmsg.action == "retry") { throw new Exception(StringResource.str("tryagain")); } if (actmsg.action == "fail") { throw new Exception("Critical Action failed."); } return(false); }
public void InitDisplay() { btn_ktt.Label = Program.sysinfo.iKTT.ToString(); btn_measdelay.Label = Program.sysinfo.iMeasDelay.ToString(); btn_meastimes.Label = Program.sysinfo.iMeasTimes.ToString(); btn_shifttimes.Label = Program.sysinfo.iShiftTimes.ToString(); btn_sampletimes.Label = Program.sysinfo.iSampleTimes.ToString(); btn_fltlength.Label = Program.sysinfo.iFilter.ToString(); btn_newdate.Label = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); btn_flttype.Label = Program.sysinfo.sFilterType; btn_navmeter.Label = Program.sysinfo.sNavmeter; btn_rxscanner.Label = Program.sysinfo.sRxscanner; btn_rsscanner.Label = Program.sysinfo.sRsscanner; if (Program.sysinfo.iKTT <= 0) { btn_ktt.Label = StringResource.str("off"); } if (Program.sysinfo.bThrow) { btn_throw.Label = StringResource.str("on"); } else { btn_throw.Label = StringResource.str("off"); } this.Invalidate(); }
void btn_quit_ValidClick(object sender, EventArgs e) { if (bMultiSelect) { if (bNo0Choice && (states.Count(x => x) <= 0)) { Program.msg.Init(StringResource.str("atleast1choice")); return; } choice_handler(param, "done"); } else { choice_handler(param, "quit"); } deep--; if (deep <= 0) { Hide(); } else { Invalidate(); } }
private void SetButtonType(RectButton btn, string type) { btn.BackColor = this.BackColor; btn.Style = MyButtonType.rectButton; btn.colorTop = Color.LightBlue; btn.colorShadow = this.BackColor; btn.Label = StringResource.str(type); }
public void KbdData(string param, string data) { try { if (param == "serial") { Rs.sSerial = data; } if (param == "rvalue") { Rs.dValue = Convert.ToDouble(data); } if (param == "ralpha") { Rs.dAlpha = Convert.ToDouble(data); } if (param == "rbeta") { Rs.dBeta = Convert.ToDouble(data); } if (param == "maxcurr") { Rs.dMaxCurr = Convert.ToDouble(data); } if (param == "enable") { Rs.bEnabled = !Rs.bEnabled; } if (param == "rtp") { Rs.dRtp = Convert.ToDouble(data); } if (param == "ceofa") { Rs.dCoefA = Convert.ToDouble(data); } if (param == "ceofb") { Rs.dCoefB = Convert.ToDouble(data); } if (param == "ceofc") { Rs.dCoefC = Convert.ToDouble(data); } if (param == "prbtype") { Rs.sPTType = Util.FindStringValue(Int32.Parse(data), StringResource.str("lst_" + param)); } if (param == "range") { Rs.tRange = (TempRange)Convert.ToInt32(data); } InitDisplay(); } catch { } }
public void ReDraw() { lbl_reading.Text = GetData(config.iMainData); lbl_aux1.Text = GetData(config.iAux1Data); lbl_aux2.Text = GetData(config.iAux2Data); btn_aux1.Text = StringResource.str("val_" + config.iAux1Data.ToString().ToLower()); btn_aux2.Text = StringResource.str("val_" + config.iAux2Data.ToString().ToLower()); btn_bigdisp.Text = StringResource.str("val_" + config.iMainData.ToString().ToLower()); }
void btn_export_ValidClick(object sender, EventArgs e) { if (!Directory.Exists("\\Hard Disk")) { Program.msg.Init(StringResource.str("noharddisk")); return; } Program.kbd.Init(StringResource.str("enter_exportdate"), "exportdate", false, KbdData); }
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()); } else { 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(StringResource.str("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(StringResource.str("out_of_range")); } } kbdhandler(param, data.ToString()); } } catch (Exception err) { Program.MsgShow(err.Message); return; } deep--; if (deep <= 0) { Hide(); } else { Invalidate(); } }
public void ReDraw(bool newmode) { if (newmode) { /* * lbl_aux1.Top = this.ClientRectangle.Top + 50; * lbl_aux1.Left = this.ClientRectangle.Left + 10; * btn_aux1.Top = lbl_aux1.Top; * btn_aux1.Left = lbl_aux1.Left + 80; * * lbl_aux2.Top = this.ClientRectangle.Top + 50; * lbl_aux2.Left = this.ClientRectangle.Left + 110; * btn_aux2.Top = lbl_aux2.Top; * btn_aux2.Left = lbl_aux2.Left + 80; * * lbl_reading.Top = this.ClientRectangle.Top + 10; * lbl_reading.Left = this.lbl_reading.Left + 20; * btn_bigdisp.Top = lbl_reading.Top; * btn_bigdisp.Left = lbl_reading.Left + 200; */ if (config.iDataMode == RXDISP_MODE.GRAPH) { dataGrid2.Visible = false; graphPane2.Top = dataGrid2.Top; graphPane2.Height = 340; graphPane2.Visible = true; RefreshData(dt.Rows.Count); graphPane2.Refresh(); } if (config.iDataMode == RXDISP_MODE.GRID) { graphPane2.Visible = false; dataGrid2.Height = 340; dataGrid2.Visible = true; } if (config.iDataMode == RXDISP_MODE.MIXED) { dataGrid2.Height = 170; dataGrid2.Visible = true; graphPane2.Top = dataGrid2.Top + dataGrid2.Height + 5; graphPane2.Height = 170; graphPane2.Visible = true; RefreshData(dt.Rows.Count); graphPane2.Refresh(); } //arrange dialogs } lbl_reading.Text = GetData(config.iMainData); lbl_aux1.Text = GetData(config.iAux1Data); lbl_aux2.Text = GetData(RXDATA_MODE.VARIANCE); //GetData(config.iAux2Data); btn_aux1.Text = StringResource.str("val_" + config.iAux1Data.ToString().ToLower()); btn_aux2.Text = "不确定度"; // StringResource.str("val_" + config.iAux2Data.ToString().ToLower()); btn_bigdisp.Text = StringResource.str("val_" + config.iMainData.ToString().ToLower()); btn_dispmode.Text = StringResource.str("disp_" + config.iDataMode.ToString().ToLower()); }
void bt_menu_ValidClick(object sender, EventArgs e) { if (bt_menu.Text == StringResource.str("menu")) { MenuClick(sender, e); } else { PauseResumeClick(sender, e); } }
public MsgDlg() { InitializeComponent(); this.Location = new System.Drawing.Point(212, 183); this.BackColor = Color.Bisque; this.textBox1.BackColor = Color.Bisque; roundRect1.SetStyle(Color.Bisque, MyButtonType.roundRect); roundRect1.Refresh(); this.textBox1.BorderStyle = BorderStyle.None; this.Load += new EventHandler(MsgDlg_Load); button1.Text = StringResource.str("ok"); }
void statusBar1_PauseResumeClick(object sender, EventArgs e) { task.PauseResume(); if (!task.bPaused) { btn_menu.Label = StringResource.str("pause"); } else { btn_menu.Label = StringResource.str("continue"); } }
private void UpdateStatusBar() { if (status == RUN_STATE.IDLE) { bt_run.Text = StringResource.str("start"); btn_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.White; } if (status == RUN_STATE.ERROR) { bt_run.Text = StringResource.str("error"); btn_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.MediumVioletRed; } if (status == RUN_STATE.DISABLED) { bt_run.Text = StringResource.str("initialize"); btn_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.LightGray; } if (status == RUN_STATE.INITIALIZING) { bt_run.Text = String.Format("{0} {1}s", StringResource.str("initialize"), task.waiting); bt_run.BackColor = Color.LightYellow; } if (status == RUN_STATE.STOPPING) { bt_run.Text = StringResource.str("stopping"); btn_menu.Text = StringResource.str("menu"); bt_run.BackColor = Color.LightYellow; } if (status == RUN_STATE.SEARCHING) { bt_run.Text = String.Format("{0} {1}s", StringResource.str("searching"), task.waiting); bt_run.BackColor = Color.LightYellow; } if (status == RUN_STATE.READING) { bt_run.Text = String.Format("{0} {1}s", StringResource.str("reading"), task.waiting); bt_run.BackColor = Color.LightYellow; } if (status == RUN_STATE.TRACKING) { bt_run.Text = String.Format("{0} (继续第{1}个读数) {2}s", StringResource.str("tracking"), runstate.NumOfRunsLeft, task.waiting); bt_run.BackColor = Color.LightYellow; } }
private void UpdateStatusBar(object sender, string msg) { if (msg == "newvalue") { RX_VAR rv = task.currRx.var; AddValue(task.currRx.iChan.ToString(), task.iMeasCnt, rv.rRx, 0, 0); lbl_aux1.Text = UpdateDisplayReading(aux1_mode); lbl_aux2.Text = UpdateDisplayReading(aux2_mode); lbl_bigdisp.Text = UpdateDisplayReading(bigdisp_mode); DeviceMgr.ReportData(task.iMeasCnt, rv.rRx); LogData(task.iMeasCnt, rv.rRx); /* * statusBar1.total = syscfg.iMeasTimes; * statusBar1.count = task.iMeasCnt; */ } else if (msg == "complete") { if (runstate.NumOfRunsLeft > 0) { DoNextMeasure(); } else { if (Program.sysinfo.bThrow) { ThrowData(); } LogComplete(); bt_run.Text = StringResource.str("start"); btn_menu.Label = StringResource.str("menu"); } } else { string txt = StringResource.str(msg); if (txt == msg) { MsgDlg.Show(task.currRx.var.errMsg); } else { bt_run.Text = txt; } } }
public StatusBar() { InitializeComponent(); this.BackColor = Color.Black; uiTimer = new System.Windows.Forms.Timer(); uiTimer.Tick += new EventHandler(uiTimer_Tick); uiTimer.Interval = 1000; //250ms for UI update uiTimer.Enabled = true; bt_menu.bgColor = Color.Black; bt_menu.SetStyle(Color.LightBlue, MyButtonType.round2RectButton); bt_menu.Text = StringResource.str("menu"); bt_menu.ValidClick += new EventHandler(bt_menu_ValidClick); bt_run.Click += new EventHandler(bt_run_Click); this.Click += new EventHandler(StatusBar_DoubleClick); }
private void SetGridStyle() { DataGridTableStyle tblStyle = new DataGridTableStyle(); tblStyle.MappingName = "values"; DataGridColumnStyle col1 = new DataGridTextBoxColumn(); col1.MappingName = "id"; col1.HeaderText = StringResource.str("col_id"); col1.Width = 50; col1.NullText = string.Empty; DataGridColumnStyle col2 = new DataGridTextBoxColumn(); col2.MappingName = "data"; col2.HeaderText = StringResource.str("col_data"); col2.Width = 150; col2.NullText = string.Empty; DataGridColumnStyle col3 = new DataGridTextBoxColumn(); col3.MappingName = "ratio"; col3.HeaderText = StringResource.str("col_ratio"); col3.Width = 150; col3.NullText = string.Empty; DataGridColumnStyle col4 = new DataGridTextBoxColumn(); col4.MappingName = "time"; col4.HeaderText = StringResource.str("col_time"); col4.Width = 150; col4.NullText = string.Empty; DataGridColumnStyle col5 = new DataGridTextBoxColumn(); col5.MappingName = "excluded"; col5.HeaderText = StringResource.str("col_excluded"); col5.Width = 150; col5.NullText = string.Empty; tblStyle.GridColumnStyles.Add(col1); tblStyle.GridColumnStyles.Add(col2); tblStyle.GridColumnStyles.Add(col3); tblStyle.GridColumnStyles.Add(col4); tblStyle.GridColumnStyles.Add(col5); //dataGridView1.TableStyles.Add(tblStyple) }
private void SetGridStyle() { DataGridTableStyle tblStyle = new DataGridTableStyle(); tblStyle.MappingName = "values"; string[] cols = new string[] { "ch", "id", "excluded", "data", "ratio", "temp", "time" }; int[] colwidth = new int[] { 50, 50, 50, 150, 150, 150, 150 }; for (int i = 0; i < cols.Length; i++) { DataGridColumnStyle dgcs = new DataGridTextBoxColumn(); dgcs.MappingName = cols[i]; dgcs.HeaderText = StringResource.str("col_" + cols[i]); dgcs.Width = colwidth[i]; dgcs.NullText = string.Empty; tblStyle.GridColumnStyles.Add(dgcs); } //dataGridView1.TableStyles.Add(tblStyple) }
public void InitDisplay() { if (!(Rx is RxInfo)) { return; } lbl_rx_pos.Text = StringResource.str("standard") + "@" + StringResource.str("channel") + Rx.iChan.ToString(); btn_current.Label = Util.FindStringValue(Rx.iIx, StringResource.str("lst_current")); btn_serial.Label = Rx.sSerial; btn_prbtype.Label = Rx.sPTType; btn_measdelay.Label = Rx.iMeasDelay.ToString(); btn_meastimes.Label = Rx.iMeasTimes.ToString(); btn_rtp.Visible = btn_coefa.Visible = btn_coefb.Visible = btn_coefc.Visible = btn_range.Visible = Rx.bTempProbe; lbl_rtp.Visible = lbl_coefA.Visible = lbl_coefB.Visible = lbl_coefC.Visible = lbl_range.Visible = Rx.bTempProbe; btn_rtp.Label = Rx.dRtp.ToString(); btn_coefa.Label = Rx.dCoefA.ToString(); btn_coefb.Label = Rx.dCoefB.ToString(); btn_coefc.Label = Rx.dCoefC.ToString(); btn_range.Label = Util.FindStringValue((int)Rx.tRange, StringResource.str("lst_range")); if (Rx.bSqrt) { btn_sqrt.Label = "x2"; } else { btn_sqrt.Label = "x1"; } btn_enable.bOn = Rx.bEnabled; if (Rx.bEnabled) { btn_enable.Label = Util.FindStringValue(1, StringResource.str("lst_enable")); } else { btn_enable.Label = Util.FindStringValue(0, StringResource.str("lst_enable")); } this.Invalidate(); }
public void ReDraw(bool newmode) { if (newmode) { if (Program.sysinfo.iDispMode == RXDISP_MODE.GRAPH) { btn_dispmode.Label = StringResource.str("disp_graph"); dataGrid2.Visible = false; graphPane2.Visible = true; graphPane2.Refresh(); } else if (Program.sysinfo.iDispMode == RXDISP_MODE.GRID) { btn_dispmode.Label = StringResource.str("disp_grid"); graphPane2.Visible = false; dataGrid2.Visible = true; } btn_dispmode.Invalidate(); //arrange dialogs } }
void statusBar1_StartStopClick(object sender, EventArgs e) { if (task.bRunning) { btn_menu.Label = StringResource.str("menu"); bt_run.Text = StringResource.str("start"); status = RUN_STATE.STOPPING; task.Stop(); return; } btn_menu.Label = StringResource.str("pause"); runstate.LoadScheme(); if (runstate.NumOfRunsLeft <= 0) { MsgDlg.Show("No valid selection"); return; } DoNextMeasure(); Program.testdata.ClearAll(); }
void btn_export_ValidClick(object sender, EventArgs e) { if (!Directory.Exists("\\Hard Disk")) { MessageBox.Show(StringResource.str("noharddisk")); return; } try { string basedir = StringResource.str("basedir"); foreach (string fname in Directory.GetFiles(basedir, "20*.txt")) { FileInfo fi = new FileInfo(fname); File.Copy(Path.Combine(basedir, fi.Name), Path.Combine("\\Hard Disk\\", fi.Name)); } MessageBox.Show(StringResource.str("export_done")); } catch { MessageBox.Show(StringResource.str("export_fail")); return; } }
public void InitDisplay() { btn_flttype.Text = StringResource.str(RunWnd.syscfg.sFilterType); btn_fltlength.Text = RunWnd.syscfg.iFilter.ToString(); btn_measdelay.Text = RunWnd.syscfg.iMeasDelay.ToString(); btn_sampletimes.Text = RunWnd.syscfg.iSampleTimes.ToString(); btn_meastimes.Text = RunWnd.syscfg.iMeasTimes.ToString(); btn_date.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); btn_ktt.Text = RunWnd.syscfg.iKTT.ToString(); btn_navmeter.Text = RunWnd.syscfg.sNavmeter; if (RunWnd.syscfg.iKTT <= 0) { btn_ktt.Text = StringResource.str("off"); } if (RunWnd.syscfg.bThrow) { btn_throw.Text = StringResource.str("on"); } else { btn_throw.Text = StringResource.str("off"); } }
public ChoiceWnd() { InitializeComponent(); notelabel.ForeColor = this.ForeColor; this.BackColor = Color.White; btn_quit.bgColor = this.BackColor; btn_quit.SetStyle(Color.Beige, MyButtonType.round2Button); btn_quit.Text = StringResource.str("quit"); btn_quit.ValidClick += new EventHandler(btn_quit_ValidClick); bNo0Choice = true; RectButton btn; foreach (int x in Enumerable.Range(1, MAX_NUMBER)) { btn = find_btn(x); btn.bgColor = this.BackColor; btn.SetStyle(btColor, MyButtonType.round2RectButton); btn.ValidClick += new EventHandler(btn_ValidClick); } TopMost = true; Hide(); }
private void SetGridStyle() { dt = new DataTable("values"); dt.Columns.Add("id"); dt.Columns.Add("ch"); dt.Columns.Add("data"); dt.Columns.Add("temp"); dt.Columns.Add("ratio"); dt.Columns.Add("time"); dt.Columns.Add("excluded"); DataGridTableStyle tblStyle = new DataGridTableStyle(); tblStyle.MappingName = "values"; string[] cols = new string[] { "ch", "id", "excluded", "data", "ratio", "temp", "time" }; int[] colwidth = new int[] { 50, 50, 50, 150, 150, 150, 150 }; for (int i = 0; i < cols.Length; i++) { DataGridColumnStyle dgcs = new DataGridTextBoxColumn(); dgcs.MappingName = cols[i]; dgcs.HeaderText = StringResource.str("col_" + cols[i]); dgcs.Width = colwidth[i]; dgcs.NullText = string.Empty; tblStyle.GridColumnStyles.Add(dgcs); } //dataGridView1.TableStyles.Add(tblStyle); dataGrid2.DataSource = dt;// Program.testdata.PointList; dataGrid2.Click += new EventHandler(dataGrid2_Click); graphPane2.XAxisTicCount = 10; graphPane2.YAxisTicCount = 4; graphPane2.YAxisMax = 5; graphPane2.YAxisMin = -5; graphPane2.YAxisTitle = "PPM"; graphPane2.XAxisTicCount = 10; }
private static bool tmlock = false; //lock for timer handler void uiTimer_Tick(object sender, EventArgs e) { if (tmlock) { return; } tmlock = true; if (DeviceMgr.Loaded && statusBar1.status == RUN_STATE.DISABLED) { statusBar1.status = RUN_STATE.IDLE; } if (lastcall != "") { if (lastcall == "newtime") { lastcall = ""; Program.kbd.Init(StringResource.str("enter_newtime"), "newtime", false, KbdData); } tmlock = false; return; } else { if (task.bRunning) { task.Step(); statusBar1.pause = task.bPaused; statusBar1.waiting = task.waiting; if (!task.bRunning) { statusBar1.status = RUN_STATE.IDLE; DeviceMgr.Log("测量结束..."); } } } tmlock = false; }
public void InitDisplay() { if (!(Rs is RsInfo)) { return; } lbl_rs_pos.Text = StringResource.str("standard") + "@" + StringResource.str("channel") + Rs.iChan.ToString(); btn_rvalue.Label = Util.FormatData(Rs.dValue, 7); btn_ralpha.Label = Rs.dAlpha.ToString("F2"); btn_rbeta.Label = Rs.dBeta.ToString("F2"); btn_maxcurr.Label = Rs.dMaxCurr.ToString("F2"); btn_serial.Label = Rs.sSerial; btn_prbtype.Label = Rs.sPTType; btn_rtp.Visible = btn_coefa.Visible = btn_coefb.Visible = btn_coefc.Visible = btn_range.Visible = Rs.bTempProbe; lbl_rtp.Visible = lbl_coefA.Visible = lbl_coefB.Visible = lbl_coefC.Visible = lbl_range.Visible = Rs.bTempProbe; btn_rtp.Label = Rs.dRtp.ToString(); btn_coefa.Label = Rs.dCoefA.ToString(); btn_coefb.Label = Rs.dCoefB.ToString(); btn_coefc.Label = Rs.dCoefC.ToString(); btn_range.Label = Util.FindStringValue((int)Rs.tRange, StringResource.str("lst_range")); btn_enable.bOn = Rs.bEnabled; if (Rs.bEnabled) { btn_enable.Label = Util.FindStringValue(1, StringResource.str("lst_enable")); } else { btn_enable.Label = Util.FindStringValue(0, StringResource.str("lst_enable")); } this.Invalidate(); }
static public void MessageHandler() { Reset(); Loaded = true; while (true) { if (!WaitEvent.WaitOne(10, false)) { ScanPort(); continue; } WaitEvent.Reset(); try { #region navmeter action ActMessage msg = DeviceMgr.actmsg; if (msg.action == "navto30v" || msg.action == "navto1v" || msg.action == "navto120mv" || msg.action == "navto10mv") { if (msg.action == "navto1v") { // port.Write(NAV_INIT); //init port.Write(StringResource.str("NAV_1V_" + RunWnd.syscfg.sNavmeter)); //1v // DelayWrite(NAV_AFLTON); //slowmode and aflton } if (msg.action == "navto120mv") { port.Write(StringResource.str("NAV_120MV_" + RunWnd.syscfg.sNavmeter)); //120mv } if (msg.action == "navto10mv") { port.Write(StringResource.str("NAV_10MV_" + RunWnd.syscfg.sNavmeter)); //10mv } if (msg.action == "navto30v") { port.Write(StringResource.str("NAV_30V_" + RunWnd.syscfg.sNavmeter)); //10mv } Thread.Sleep(4000); actmsg.action = "done"; OverEvent.Set(); continue; } if (msg.action == "navread") { reading = -9999; port.DiscardInBuffer(); port.Write(StringResource.str("NAV_READ_" + RunWnd.syscfg.sNavmeter)); //1v Thread.Sleep(5); int timeout = 400; while ((timeout-- > 0) && (reading < -9000)) { ScanPort(); Thread.Sleep(5); } actmsg.action = "done"; OverEvent.Set(); continue; } if (msg.action == "turnk") { KState(msg.value); actmsg.action = "done"; OverEvent.Set(); continue; } if (msg.action.StartsWith("MEAS")) { string[] cmd = msg.action.Split(new char[] { '|' }); if (cmd.Length == 6) { RelayState(cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); } actmsg.action = "done"; OverEvent.Set(); continue; } #endregion if (actmsg.action != "") { throw new Exception("Invalid command " + actmsg.action); } } catch (Exception ex) { SysLog(ex.Message); Debug.WriteLine(ex.Message); actmsg.action = "fail"; OverEvent.Set(); } } }