Exemple #1
0
        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);
        }