public RxConfigWnd() { InitializeComponent(); btn_quit.Text = StringResource.str("quit"); btn_quit.BackColor = this.BackColor; btn_quit.Style = MyButtonType.roundButton; btn_quit.ValidClick += new EventHandler((s, e) => { if (!Rx.bEnabled) { Rx.bSelected = false; } Program.SwitchWindow("mainconfig"); //Program.mainwnd.Invoke(new Action<bool>(Program.mainwnd.ReDraw), new object[] { false }); }); RectButton[] kbdbtns = new RectButton[] { btn_measdelay, btn_meastimes, btn_rtp, btn_coefa, btn_coefb, btn_coefc, btn_serial }; //keyboard input buttons foreach (RectButton rb in kbdbtns) { rb.Style = MyButtonType.rectButton; rb.BackColor = this.BackColor; Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label; lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", "")); rb.ValidClick += new EventHandler((s, e) => { string regname = (s as Control).Name.Remove(0, 4); kbdWnd.Init(StringResource.str("input") + StringResource.str(regname), regname, false, KbdData); }); } //choice buttons RectButton[] choicebtns = new RectButton[] { btn_prbtype, btn_current, btn_range, btn_serial_select }; foreach (RectButton rb in choicebtns) { rb.Style = MyButtonType.rectButton; rb.BackColor = this.BackColor; Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label; lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", "")); rb.ValidClick += new EventHandler((s, e) => { string regname = (s as Control).Name.Remove(0, 4); ChoiceWnd.Init(StringResource.str("choose") + StringResource.str(regname), regname, StringResource.str("lst_" + regname).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), 0, null, KbdData); }); } //toggle buttons RectButton[] togglebtns = new RectButton[] { btn_sqrt, btn_enable }; foreach (RectButton rb in togglebtns) { rb.Style = MyButtonType.rectButton; rb.BackColor = this.BackColor; //Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label; //lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", "")); rb.ValidClick += new EventHandler((s, e) => { string regname = (s as Control).Name.Remove(0, 4); KbdData(regname, ""); }); } InitDisplay(); }
public RunWnd() { InitializeComponent(); runstate = new RunState(); task = new TaskMachine(); task.StatusChanged += new StrEventHandler(UpdateStatusBar); uiTimer = new System.Windows.Forms.Timer(); uiTimer.Tick += new EventHandler(uiTimer_Tick); uiTimer.Interval = 250; //250ms for UI update uiTimer.Enabled = true;; #region set status bar style SetButtonType(btn_aux1, StringResource.str("val_" + aux1_mode.ToString().ToLower())); SetButtonType(btn_aux2, StringResource.str("val_" + aux2_mode.ToString().ToLower())); SetButtonType(btn_bigdisp, StringResource.str("val_" + bigdisp_mode.ToString().ToLower())); btn_menu.Enabled = true; SetButtonType(btn_menu, "menu"); btn_menu.ValidClick += new EventHandler((o, e) => { if (task.bRunning || task.bPaused) { statusBar1_PauseResumeClick(o, e); } else { Program.SwitchWindow("mainconfig"); } }); btn_dispchan.Enabled = true; SetButtonType(btn_dispchan, "CH1"); graphPane2.channels = new string[] { "1" }; btn_dispchan.ValidClick += new EventHandler((o, e) => { if (StringResource.str("lst_rxchan").Trim(new char[] { '|' }).IndexOf('|') > 0) { ChoiceWnd.Init(StringResource.str("choose") + StringResource.str("channel"), "dispchan", StringResource.str("lst_rxchan").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), -1, null, KbdData); } }); btn_dispmode.Enabled = true; SetButtonType(btn_dispmode, StringResource.str("disp_graph")); btn_dispmode.ValidClick += new EventHandler((o, e) => { if (Program.sysinfo.iDispMode == RXDISP_MODE.GRID) { Program.sysinfo.iDispMode = RXDISP_MODE.GRAPH; } else { Program.sysinfo.iDispMode = RXDISP_MODE.GRID; } btn_dispmode.Invalidate(); ReDraw(true); }); #endregion bt_run.Text = StringResource.str("start"); bt_run.Click += new EventHandler((o, e) => { statusBar1_StartStopClick(o, e); }); SetGridStyle(); AddValue("1", 1, 1.000000, 0, 0); AddValue("1", 2, 1.000002, 0, 0); AddValue("1", 3, 1.000001, 0, 0); PointPair.datamode = RXDATA_MODE.RX; graphPane2.Invalidate(); this.Load += new EventHandler(RunWnd_Load); }
public static extern bool SetLocalTime(ref SystemTime sysTime); //设置本地时 public SysConfigWnd() { InitializeComponent(); lbl_sysconfig.Text = StringResource.str("sysconfig"); btn_quit.Text = StringResource.str("quit"); btn_quit.BackColor = this.BackColor; btn_quit.Style = MyButtonType.roundButton; btn_quit.ValidClick += new EventHandler((s, e) => { Program.SwitchWindow("mainwnd"); Program.mainwnd.Invoke(new Action <bool>(Program.mainwnd.ReDraw), new object[] { false }); }); RectButton[] kbdbtns = new RectButton[] { btn_ktt, btn_measdelay, btn_meastimes, btn_shifttimes, btn_newdate, btn_sampletimes, btn_fltlength }; //keyboard input buttons foreach (RectButton rb in kbdbtns) { rb.Style = MyButtonType.rectButton; rb.colorTop = Color.Beige; rb.BackColor = this.BackColor; Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label; lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", "")); rb.ValidClick += new EventHandler((s, e) => { string regname = (s as Control).Name.Remove(0, 4); kbdWnd.Init(StringResource.str("input") + StringResource.str(regname), regname, false, KbdData); }); } //choice buttons RectButton[] choicebtns = new RectButton[] { btn_flttype, btn_navmeter, btn_rxscanner, btn_rsscanner }; foreach (RectButton rb in choicebtns) { rb.Style = MyButtonType.rectButton; rb.colorTop = Color.Beige; rb.BackColor = this.BackColor; Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label; lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", "")); rb.ValidClick += new EventHandler((s, e) => { string regname = (s as Control).Name.Remove(0, 4); ChoiceWnd.Init(StringResource.str("choose") + StringResource.str(regname), regname, StringResource.str("lst_" + regname).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), 0, null, KbdData); }); } //toggle buttons RectButton[] togglebtns = new RectButton[] { btn_throw }; foreach (RectButton rb in togglebtns) { rb.Style = MyButtonType.rectButton; rb.colorTop = Color.Beige; rb.BackColor = this.BackColor; Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label; lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", "")); rb.ValidClick += new EventHandler((s, e) => { string regname = (s as Control).Name.Remove(0, 4); KbdData(regname, ""); }); } InitDisplay(); }