private void ReadPIDBalanceCar(SharedPreferences sp)
        {
            //直立PID
            textBox_Stand_P.Text = sp.GetString("Stand_P", "1.0");
            textBox_Stand_I.Text = sp.GetString("Stand_I", "1.0");
            textBox_Stand_D.Text = sp.GetString("Stand_D", "1.0");

            //速度PID
            textBox_Speed_P.Text = sp.GetString("Speed_P", "1.0");
            textBox_Speed_I.Text = sp.GetString("Speed_I", "1.0");
            textBox_Speed_D.Text = sp.GetString("Speed_D", "1.0");

            //方向PID
            textBox_Direction_P.Text = sp.GetString("Direction_P", "1.0");
            textBox_Direction_I.Text = sp.GetString("Direction_I", "1.0");
            textBox_Direction_D.Text = sp.GetString("Direction_D", "1.0");
        }
        private void ReadPIDFourWheel(SharedPreferences sp)
        {
            //舵机PID参数
            textBox_Steer_P.Text = sp.GetString("Steer_P", "1.0");
            textBox_Steer_I.Text = sp.GetString("Steer_I", "1.0");
            textBox_Steer_D.Text = sp.GetString("Steer_D", "1.0");

            //电机PID参数
            textBox_Motor_P.Text = sp.GetString("Motor_P", "1.0");
            textBox_Motor_I.Text = sp.GetString("Motor_I", "1.0");
            textBox_Motor_D.Text = sp.GetString("Motor_D", "1.0");
        }
        private void Init_pane_Scope()
        {
            var sp = new SharedPreferences(SavefileName);

            panel_Scope.AutoScroll = true;
            var total = ScopeNumber;
            for (var i = 0; i < total; i++)
            {
                var checkDrawing = new CheckBox();
                checkDrawing.Size = new Size(15, 15);
                checkDrawing.Location = new Point(20 + i%8*77, 10 + i/8*60);
                checkDrawing.Name = "checkBox_Def" + Convert.ToString(i + 1);
                checkDrawing.Text = "";

                var checkState = string.Format("SCOPE_CheckState{0}", i + 1);
                checkDrawing.Checked = sp.GetBoolean(checkState, false);
                checkDrawing.CheckedChanged += CheckDrawingOnCheckedChanged;

                var txtBoxName = new TextBox();
                txtBoxName.Size = new Size(50, 20); //textbox大小                   
                txtBoxName.Location = new Point(41 + i%8*77, 7 + i/8*60);
                txtBoxName.Name = "txtName" + Convert.ToString(i + 1);
                txtBoxName.TextAlign = HorizontalAlignment.Center;
                var txtName_CustomPara = string.Format("SCOPE_TextName{0}", i + 1);
                var getName = sp.GetString(txtName_CustomPara, @"波形" + Convert.ToString(i + 1));
                txtBoxName.Text = getName.Trim() != "" ? getName : string.Format("波形{0}", i + 1);
                txtBoxName.BackColor = _colorLine[i%8];
                txtBoxName.TextChanged += ScopeTextNameChanged;
                txtBoxName.Enabled = checkDrawing.Checked;

                var buttonNewForm = new Button();
                buttonNewForm.Size = new Size(66, 23);
                buttonNewForm.Location = new Point(25 + i%8*77, 34 + i/8*60);
                buttonNewForm.Name = "buttonDraw" + Convert.ToString(i + 1);
                buttonNewForm.Text = @"独立图像";
                buttonNewForm.Click += ButtonNewFormOnClick;
                buttonNewForm.Enabled = checkDrawing.Checked;

                panel_Scope.Controls.Add(checkDrawing);
                panel_Scope.Controls.Add(txtBoxName);
                panel_Scope.Controls.Add(buttonNewForm);
            }
        }
        private void InitzedGraph()
        {
            var myPane = zedGraph_local.GraphPane;
            myPane.Title.IsVisible = false;
            myPane.XAxis.Title.Text = "time";
            myPane.YAxis.Title.Text = "Value";

            //show grid
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;

            // Align the Y axis labels so they are flush to the axis
            myPane.YAxis.Scale.Align = AlignP.Inside;

            // Manually set the axis range
            myPane.XAxis.Scale.Min = _xminScale;
            myPane.XAxis.Scale.Max = _xmaxScale;
            myPane.YAxis.Scale.Min = _yminScale;
            myPane.YAxis.Scale.Max = _ymaxScale;

            // Fill the axis background with a gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);

            // OPTIONAL: Show tooltips when the mouse hovers over a point
            zedGraph_local.IsShowPointValues = true;
            zedGraph_local.PointValueEvent += MyPointValueHandler;

            for (var i = 0; i < ScopeNumber; i++)
            {
                zedGrpahNames[i] = new ZedGrpahName();
                coOb[i] = new CallObject();
            }

            var sp = new SharedPreferences(SavefileName);
            for (var i = 0; i < ScopeNumber; i++)
            {
                zedGrpahNames[i].listZed.Add(Convert.ToDouble(zedGrpahNames[i].x), 0);
                var curve = string.Format("波形{0}", i + 1);

                //自己定义的变量名称
                var txtName_CustomPara = string.Format("SCOPE_TextName{0}", i + 1);
                var getName = sp.GetString(txtName_CustomPara, @"波形" + Convert.ToString(i + 1));
                zedGraph_local.GraphPane.AddCurve(getName.Trim() != "" ? getName : curve, zedGrpahNames[i].listZed,
                    _colorLine[i%8],
                    SymbolType.None);
            }

            refleshZedPane(zedGraph_local);
        }
        private void DrawRealTimePannel(SharedPreferences sp, bool byInit)
        {
            panel_Electricity.AutoScroll = true;
            panel_Electricity.Controls.Clear();
            var total = int.Parse(textBox_Realtime_Number.Text);

            for (var i = 0; i < total; i++)
            {
                var labelElect = new TextBox();
                labelElect.Size = new Size(100, 20); //label大小                   
                labelElect.Location = new Point(30 + 120*0, 30*(i + 1));
                labelElect.Name = "txtElectName" + Convert.ToString(i + 1);
                labelElect.Text = @"实时变量" + Convert.ToString(i + 1);
                labelElect.TextAlign = HorizontalAlignment.Center;
                if (byInit)
                {
                    var elecName = string.Format("textElectName{0}", i + 1);
                    labelElect.Text = sp.GetString(elecName, "1.0");
                }

                var txtBoxValue = new TextBox();
                txtBoxValue.Size = new Size(50, 50);
                txtBoxValue.Location = new Point(30 + 120*1, 30*(i + 1));
                txtBoxValue.Name = "txtElectValue" + Convert.ToString(i + 1);
                txtBoxValue.TextAlign = HorizontalAlignment.Center;
                if (byInit)
                {
                    var elecValue = string.Format("txtElectValue{0}", i + 1);
                    txtBoxValue.Text = sp.GetString(elecValue, "1.0");
                }

                panel_Electricity.Controls.Add(labelElect);
                panel_Electricity.Controls.Add(txtBoxValue);
            }
        }
        private void AddControlsToPannel(SharedPreferences sp, int start, int end, bool byInit)
        {
            for (var i = start; i < end; i++)
            {
                var checkboxSelect = new CheckBox();
                checkboxSelect.Size = new Size(50, 20);
                checkboxSelect.Location = new Point(30 + 70*0, 30*(i + 1));
                checkboxSelect.Name = "checkBox_Def" + Convert.ToString(i + 1);
                checkboxSelect.Text = (i + 1).ToString();
                if (byInit)
                {
                    var checkState = string.Format("DIY_CheckState{0}", i + 1);
                    checkboxSelect.Checked = sp.GetBoolean(checkState, true);
                }
                checkboxSelect.CheckedChanged += CheckboxSelectOnCheckedChanged;

                var txtBoxName = new TextBox();
                txtBoxName.Size = new Size(50, 50); //textbox大小                   
                txtBoxName.Location = new Point(30 + 70*1, 30*(i + 1));
                txtBoxName.Name = @"txtName" + Convert.ToString(i + 1);
                txtBoxName.Text = @"Name" + Convert.ToString(i + 1);
                txtBoxName.TextAlign = HorizontalAlignment.Center;
                if (byInit)
                {
                    var txtName_CustomPara = string.Format("DIY_TextName{0}", i + 1);
                    txtBoxName.Text = sp.GetString(txtName_CustomPara, "数据");
                }
                else
                {
                    txtBoxName.Enabled = false;
                }

                var txtBoxValue = new TextBox();
                txtBoxValue.Size = new Size(50, 50); //textbox大小                   
                txtBoxValue.Location = new Point(30 + 70*2, 30*(i + 1));
                txtBoxValue.Name = "txtValue" + Convert.ToString(i + 1);
                txtBoxValue.Text = @"1.0";
                txtBoxValue.TextAlign = HorizontalAlignment.Center;
                if (byInit)
                {
                    var txtValue_CustomPara = string.Format("DIY_TextValue{0}", i + 1);
                    txtBoxValue.Text = sp.GetString(txtValue_CustomPara, "1.0");
                }
                else
                {
                    txtBoxValue.Enabled = false;
                }
                txtBoxValue.TextChanged += DIYTextboxValueChanged;

                var submitButton = new Button();
                submitButton.Size = new Size(50, 20); //textbox大小                   
                submitButton.Location = new Point(30 + 70*3, 30*(i + 1));
                submitButton.Name = "buttonSubmit" + Convert.ToString(i + 1);
                submitButton.Text = @"修改";
                submitButton.Click += SubmitButtonOnClick;
                if (!byInit)
                {
                    submitButton.Enabled = false;
                }

                if (!checkboxSelect.Checked)
                {
                    txtBoxName.Enabled = false;
                    txtBoxValue.Enabled = false;
                    submitButton.Enabled = false;
                }

                panel_add_DIYControls.Controls.Add(checkboxSelect);
                panel_add_DIYControls.Controls.Add(txtBoxName);
                panel_add_DIYControls.Controls.Add(txtBoxValue);
                panel_add_DIYControls.Controls.Add(submitButton);
            }
        }
 private void ReadRealTimeSetup(SharedPreferences sp)
 {
     textBox_Realtime_Number.Text = sp.GetString("RealtimeNum", "1");
 }