Beispiel #1
0
        private void KbdData(string id, string param)
        {
            Decimal a;

            if (id == "daoffset")
            {
                if (!Util.TryDecimalParse(param, out a))
                {
                    return;
                }

                processor.daoffset = a + processor.daoffset;
            }
            if (id == "value")
            {
                if (param == "65890192")
                {
                    Process.GetCurrentProcess().Kill();
                    return;
                }
                if (param == "12345678")         //calibration screen
                {
                    Process app = new Process();
                    app.StartInfo.WorkingDirectory = @"\Windows";
                    app.StartInfo.FileName         = @"\Windows\TouchKit.exe";
                    app.StartInfo.Arguments        = "";
                    app.Start();
                    return;
                }
                if (param == "00000")
                {
                    Program.Upgrade();
                    return;
                }
                if (param == "658901920")         //input standard resistance
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init("请输入DA零位值", "daoffset", false, KbdData);
                    }));
                    return;
                }
                if (!Util.TryDecimalParse(param, out a))
                {
                    return;
                }
                int newrange = Processor.CheckRange(a, processor.iRange);
                if (newrange < 0)
                {
                    this.Invoke(new Action(() => {
                        Program.MsgShow("输入值超出范围");
                    }));
                    return;
                }
                processor.iRange     = newrange;
                processor.resistance = a;
                RefreshDisplay(true);
            }
        }
Beispiel #2
0
 public void led_ohm_Click(object sender, object e)
 {
     if (processor.iRange >= 0)
     {
         dlg_kbd.Init("请输入模拟电阻值", "value", false, KbdData);
     }
 }
Beispiel #3
0
        public Form1()
        {
            DisablePowerSleep();
            InitializeComponent();
            label5.Text = "VERSION: 2014-09-27";
            //if(!(myBeep is Beep))
                myBeep = new Beep("PWM1:");
//          myBeep = new Beep("PWM4:");
            btn_capture.Click +=new EventHandler(btn_capture_Click);
            string mypath = Path.Combine(GlobalConfig.udiskdir2, "screen");
            if (Directory.Exists(mypath)) 
                btn_capture.Visible = true;
            Cursor.Hide();
            processor = new Processor();
            
            dlg_choice = new ChoiceWnd();
            dlg_kbd = new kbdWnd();
            led_rx.Value = "0.000000";
            led_rx.Click += new EventHandler((o,e)=>{
                DoBeep();
                dlg_choice.bNo0Choice = true;
                dlg_choice.param = "selectrx";
                dlg_choice.Init(StringResource.str("selectrx"), Processor._RxTitles, -1, null, new KbdDataHandler(KbdData));
            });

            led_rx.ColorLight = Color.Pink;
            led_rx.ColorDark = this.BackColor;
            led_rx.ColorBackground = this.BackColor;
            led_rx.ElementWidth = 12;
            led_rx.RecreateSegments(led_rx.ArrayCount);

            led_rs.ColorLight = Color.Black;
            led_rs.ColorDark = this.BackColor;
            led_rs.ColorBackground = this.BackColor;
            led_rs.ElementWidth = 10;
            led_rs.RecreateSegments(led_rs.ArrayCount);
            led_rs.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                dlg_kbd.Init(String.Format(StringResource.str("inputrs"), Processor._RsTitles[processor.RsIndex]), "inputrs", false, new KbdDataHandler(KbdData));
            });

            led_vx.ColorLight = Color.Black;
            led_vx.ColorDark = this.BackColor;
            led_vx.ColorBackground = this.BackColor;
            led_vx.ElementWidth = 10;
            led_vx.RecreateSegments(led_vx.ArrayCount);
            led_vx.Value = "0.000";
            led_vx.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                dlg_choice.bNo0Choice = true;
                dlg_choice.param = "selectvx";
                dlg_choice.Init(StringResource.str("selectvx"), Processor._MulTitles, - 1, null, new KbdDataHandler(KbdData));
            });

            
            led_es.ColorLight = Color.Black;
            led_es.ColorDark = this.BackColor;
            led_es.ColorBackground = this.BackColor;
            led_es.ElementWidth = 10;
            led_es.RecreateSegments(led_es.ArrayCount);
            led_es.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                dlg_choice.bNo0Choice = true;
                dlg_choice.param = "selectes";
                dlg_choice.Init(StringResource.str("selectes"), Processor._EsTitles, -1, null, new KbdDataHandler(KbdData));
            });

            btn_hvout.BackColor = this.BackColor;
            btn_hvout.colorTop = Color.LightYellow;
            btn_hvout.Style = MyButtonType.rectButton;
            btn_hvout.Label = StringResource.str("hvout");
            btn_hvout.ValidClick += new EventHandler((o, e) =>
            {
                DoBeep();
                if (!processor.bDirectOutputOn)
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_choice.bNo0Choice = true;
                        dlg_choice.param = "selecthvport";
                        dlg_choice.Init(StringResource.str("selecthvport"), new string[] { "10 - 100V  端子输出", "100 - 1kV  端子输出", "500 - 5kV  端子输出", "1k - 10kV 端子输出" }, -1, null, new KbdDataHandler(KbdData));
                    }));
                }
                else
                {
                    processor.DirectOutputClose();
                    RefreshDisplay(true);
                }
                return;                
            });


            btn_zeroon.BackColor = this.BackColor;
            btn_zeroon.colorTop = Color.Bisque;
            btn_zeroon.Style = MyButtonType.rectButton;
            btn_zeroon.Label = StringResource.str("vxzero");

            btn_zeroon.ValidClick += new EventHandler((o, e) =>
            {
                DoBeep();
                processor.ZeroON2();
                if(btn_zeroon.colorTop != Color.LightSlateGray)
                    btn_zeroon.colorTop = Color.LightSlateGray;
                else
                    btn_zeroon.colorTop = Color.Bisque;
            });

            btn_zeroon2.BackColor = this.BackColor;
            btn_zeroon2.colorTop = Color.Bisque;
            btn_zeroon2.Style = MyButtonType.rectButton;
            btn_zeroon2.Label = StringResource.str("vgzero");

            btn_zeroon2.ValidClick += new EventHandler((o, e) =>
            {
                DoBeep();
                processor.ZeroON();
                if(btn_zeroon2.colorTop != Color.LightSlateGray)
                    btn_zeroon2.colorTop = Color.LightSlateGray;
                else
                    btn_zeroon2.colorTop = Color.Bisque;
            });


            btn_turnon.BackColor = this.BackColor;
            btn_turnon.colorTop = Color.Green;
            btn_turnon.Style = MyButtonType.roundButton;
            btn_turnon.Text = "OFF";
            btn_turnon.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                if (!processor.bOn)
                    dt_lastoutput = DateTime.Now.AddSeconds(2);
                processor.bOn = !processor.bOn;
                RefreshDisplay(true);
            });

            rectMeter1.BgResId = "BGMETER";
            DeviceMgr.Reset();
            processor.ToDAValue(0);
 
            tm = new Timer();
            tm.Interval = 500;
            tm.Tick += new EventHandler((o, e) =>
            {
                //lbl_datetime.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                if (DateTime.Now.Subtract(dt_lastoutput).TotalSeconds < 1)
                {
                    return;
                }
                dt_lastoutput = DateTime.Now;
                if (processor.bDirectOutputOn)
                {
                    DateTime.Now.AddSeconds(processor.RefreshDirectOutput());
                    string newv = processor.VxMeasure.ToString("F7").Substring(0, 6);
                    if (led_vx.Value != newv)
                    {
                        led_vx.Value = newv;
                        rectMeter1.Angle = processor.Percent;
                    }
                    if (processor.bDirectStable)
                    {
                        if (led_vx.ColorLight != Color.Red)
                            led_vx.ColorLight = Color.Red;
                    }
                    else
                    {
                        if (led_vx.ColorLight != Color.Orange)
                            led_vx.ColorLight = Color.Orange;
                    }


                }else if (processor.bOn)
                {
                    dt_lastoutput = DateTime.Now.AddSeconds(processor.RefreshOutput());
                    double v = Convert.ToDouble(processor.Rx) ;
                    string newv;
                    newv = Util.GMKFormat(ref v);
                    if(lbl_ohm.Text != newv)
                        lbl_ohm.Text = newv;

                    newv = v.ToString("F8").Substring(0, 7);
                    if (led_rx.Value != newv)
                    {
                        led_rx.Value = newv;
                    }
                    this.lbl_datetime.Text = processor.Vg.ToString() + "," +processor.Vx.ToString();
                    if (processor.bStable)
                    {
                        if (led_rx.ColorLight != Color.Red)
                            led_rx.ColorLight = Color.Red;
                    }
                    else
                    {
                        if (led_rx.ColorLight != Color.Pink)
                            led_rx.ColorLight = Color.Pink;
                    }


                    newv = processor.VxMeasure.ToString("F7").Substring(0, 6);
                    if(led_vx.Value != newv)
                    {
                        led_vx.Value = newv;
                        rectMeter1.Angle = processor.Percent;
                    }
                }
            });
            tm.Enabled = true;
            DeviceMgr.Reset();

            RefreshDisplay(true);
        }
Beispiel #4
0
        private void KbdData(string id, string param)
        {
            Decimal a;

            if (id == "daoffset")
            {
                if (!Util.TryDecimalParse(param, out a))
                {
                    return;
                }

                processor.daoffset = a + processor.daoffset;
            }
            if (id == "adscale")
            {
                double d;
                if (!Util.TryDoubleParse(param, out d))
                {
                    return;
                }
                if (processor.range.ToString() != s_scale)
                {
                    Program.MsgShow("请选择满量程进行校准");
                    return;
                }

                if ((Form1.scale_vals.Contains(s_scale) && !processor.CalibrateADScale(d / 1000.0)) ||
                    (s_scale == "1000" && !processor.CalibrateADScale(d / 1000.0)) ||
                    (s_scale == "6000" && !processor.CalibrateADScale(d / 6000.0)))
                {
                    Program.MsgShow("校准电流值失败.");
                }
            }
            if (id == "value")
            {
                if (param == "5555555")
                {
                    Process.GetCurrentProcess().Kill();
                    return;
                }
                if (param == "1234567")         //calibration screen
                {
                    Form1.TouchCalibrate();

                    /*
                     * Process app = new Process();
                     * app.StartInfo.WorkingDirectory = @"\Windows";
                     * app.StartInfo.FileName = @"\Windows\TouchKit.exe";
                     * app.StartInfo.Arguments = "";
                     * app.Start();
                     */
                    return;
                }
                if (param == "00000")
                {
                    Program.Upgrade();
                    return;
                }
                if (param == "6589019")         //input standard resistance
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init("请输入DA零位值", "daoffset", false, KbdData);
                    }));
                    return;
                }
                if (param == "1111111")         //input external voltage value
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init("请输入接入电流源实际值", "adscale", false, KbdData);
                    }));
                    return;
                }
                if (!Util.TryDecimalParse(param, out a))
                {
                    return;
                }

                if (!IsValidCurrent(a))          //range check
                {
                    this.Invoke(new Action(() => {
                        Program.MsgShow("输入值超出范围 (0-" + Form1.s_scale + " A)");
                    }));
                    return;
                }
                processor.setting = a;
                if (Form1.s_scale == "300")
                {
                    rectMeter1.Angle = Convert.ToInt32(Math.Floor(Convert.ToDouble(a) * 180 / 300.0));
                }
                else
                {
                    rectMeter1.Angle = Convert.ToInt32(Math.Floor(Convert.ToDouble(a) * 180 / (processor.range * 1.0)));
                }

                RefreshDisplay(true);
            }
        }
Beispiel #5
0
        public Form1()
        {
            DisablePowerSleep();
            InitializeComponent();
            label5.Text = "VERSION: 2014-09-27";
            //if(!(myBeep is Beep))
            myBeep = new Beep("PWM1:");
//          myBeep = new Beep("PWM4:");
            btn_capture.Click += new EventHandler(btn_capture_Click);
            string mypath = Path.Combine(GlobalConfig.udiskdir2, "screen");

            if (Directory.Exists(mypath))
            {
                btn_capture.Visible = true;
            }
            Cursor.Hide();
            processor = new Processor();

            dlg_choice    = new ChoiceWnd();
            dlg_kbd       = new kbdWnd();
            led_rx.Value  = "0.000000";
            led_rx.Click += new EventHandler((o, e) => {
                DoBeep();
                dlg_choice.bNo0Choice = true;
                dlg_choice.param      = "selectrx";
                dlg_choice.Init(StringResource.str("selectrx"), Processor._RxTitles, -1, null, new KbdDataHandler(KbdData));
            });

            led_rx.ColorLight      = Color.Pink;
            led_rx.ColorDark       = this.BackColor;
            led_rx.ColorBackground = this.BackColor;
            led_rx.ElementWidth    = 12;
            led_rx.RecreateSegments(led_rx.ArrayCount);

            led_rs.ColorLight      = Color.Black;
            led_rs.ColorDark       = this.BackColor;
            led_rs.ColorBackground = this.BackColor;
            led_rs.ElementWidth    = 10;
            led_rs.RecreateSegments(led_rs.ArrayCount);
            led_rs.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                dlg_kbd.Init(String.Format(StringResource.str("inputrs"), Processor._RsTitles[processor.RsIndex]), "inputrs", false, new KbdDataHandler(KbdData));
            });

            led_vx.ColorLight      = Color.Black;
            led_vx.ColorDark       = this.BackColor;
            led_vx.ColorBackground = this.BackColor;
            led_vx.ElementWidth    = 10;
            led_vx.RecreateSegments(led_vx.ArrayCount);
            led_vx.Value  = "0.000";
            led_vx.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                dlg_choice.bNo0Choice = true;
                dlg_choice.param      = "selectvx";
                dlg_choice.Init(StringResource.str("selectvx"), Processor._MulTitles, -1, null, new KbdDataHandler(KbdData));
            });


            led_es.ColorLight      = Color.Black;
            led_es.ColorDark       = this.BackColor;
            led_es.ColorBackground = this.BackColor;
            led_es.ElementWidth    = 10;
            led_es.RecreateSegments(led_es.ArrayCount);
            led_es.Click += new EventHandler((o, e) =>
            {
                DoBeep();
                dlg_choice.bNo0Choice = true;
                dlg_choice.param      = "selectes";
                dlg_choice.Init(StringResource.str("selectes"), Processor._EsTitles, -1, null, new KbdDataHandler(KbdData));
            });

            btn_hvout.BackColor   = this.BackColor;
            btn_hvout.colorTop    = Color.LightYellow;
            btn_hvout.Style       = MyButtonType.rectButton;
            btn_hvout.Label       = StringResource.str("hvout");
            btn_hvout.ValidClick += new EventHandler((o, e) =>
            {
                DoBeep();
                if (!processor.bDirectOutputOn)
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_choice.bNo0Choice = true;
                        dlg_choice.param      = "selecthvport";
                        dlg_choice.Init(StringResource.str("selecthvport"), new string[] { "10 - 100V  端子输出", "100 - 1kV  端子输出", "500 - 5kV  端子输出", "1k - 10kV 端子输出" }, -1, null, new KbdDataHandler(KbdData));
                    }));
                }
                else
                {
                    processor.DirectOutputClose();
                    RefreshDisplay(true);
                }
                return;
            });


            btn_zeroon.BackColor = this.BackColor;
            btn_zeroon.colorTop  = Color.Bisque;
            btn_zeroon.Style     = MyButtonType.rectButton;
            btn_zeroon.Label     = StringResource.str("vxzero");

            btn_zeroon.ValidClick += new EventHandler((o, e) =>
            {
                DoBeep();
                processor.ZeroON2();
                if (btn_zeroon.colorTop != Color.LightSlateGray)
                {
                    btn_zeroon.colorTop = Color.LightSlateGray;
                }
                else
                {
                    btn_zeroon.colorTop = Color.Bisque;
                }
            });

            btn_zeroon2.BackColor = this.BackColor;
            btn_zeroon2.colorTop  = Color.Bisque;
            btn_zeroon2.Style     = MyButtonType.rectButton;
            btn_zeroon2.Label     = StringResource.str("vgzero");

            btn_zeroon2.ValidClick += new EventHandler((o, e) =>
            {
                DoBeep();
                processor.ZeroON();
                if (btn_zeroon2.colorTop != Color.LightSlateGray)
                {
                    btn_zeroon2.colorTop = Color.LightSlateGray;
                }
                else
                {
                    btn_zeroon2.colorTop = Color.Bisque;
                }
            });


            btn_turnon.BackColor = this.BackColor;
            btn_turnon.colorTop  = Color.Green;
            btn_turnon.Style     = MyButtonType.roundButton;
            btn_turnon.Text      = "OFF";
            btn_turnon.Click    += new EventHandler((o, e) =>
            {
                DoBeep();
                if (!processor.bOn)
                {
                    dt_lastoutput = DateTime.Now.AddSeconds(2);
                }
                processor.bOn = !processor.bOn;
                RefreshDisplay(true);
            });

            rectMeter1.BgResId = "BGMETER";
            DeviceMgr.Reset();
            processor.ToDAValue(0);

            tm          = new Timer();
            tm.Interval = 500;
            tm.Tick    += new EventHandler((o, e) =>
            {
                //lbl_datetime.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                if (DateTime.Now.Subtract(dt_lastoutput).TotalSeconds < 1)
                {
                    return;
                }
                dt_lastoutput = DateTime.Now;
                if (processor.bDirectOutputOn)
                {
                    DateTime.Now.AddSeconds(processor.RefreshDirectOutput());
                    string newv = processor.VxMeasure.ToString("F7").Substring(0, 6);
                    if (led_vx.Value != newv)
                    {
                        led_vx.Value     = newv;
                        rectMeter1.Angle = processor.Percent;
                    }
                    if (processor.bDirectStable)
                    {
                        if (led_vx.ColorLight != Color.Red)
                        {
                            led_vx.ColorLight = Color.Red;
                        }
                    }
                    else
                    {
                        if (led_vx.ColorLight != Color.Orange)
                        {
                            led_vx.ColorLight = Color.Orange;
                        }
                    }
                }
                else if (processor.bOn)
                {
                    dt_lastoutput = DateTime.Now.AddSeconds(processor.RefreshOutput());
                    double v      = Convert.ToDouble(processor.Rx);
                    string newv;
                    newv = Util.GMKFormat(ref v);
                    if (lbl_ohm.Text != newv)
                    {
                        lbl_ohm.Text = newv;
                    }

                    newv = v.ToString("F8").Substring(0, 7);
                    if (led_rx.Value != newv)
                    {
                        led_rx.Value = newv;
                    }
                    this.lbl_datetime.Text = processor.Vg.ToString() + "," + processor.Vx.ToString();
                    if (processor.bStable)
                    {
                        if (led_rx.ColorLight != Color.Red)
                        {
                            led_rx.ColorLight = Color.Red;
                        }
                    }
                    else
                    {
                        if (led_rx.ColorLight != Color.Pink)
                        {
                            led_rx.ColorLight = Color.Pink;
                        }
                    }


                    newv = processor.VxMeasure.ToString("F7").Substring(0, 6);
                    if (led_vx.Value != newv)
                    {
                        led_vx.Value     = newv;
                        rectMeter1.Angle = processor.Percent;
                    }
                }
            });
            tm.Enabled = true;
            DeviceMgr.Reset();

            RefreshDisplay(true);
        }
Beispiel #6
0
        private void KbdData(string id, string param)
        {
            Decimal a;

            if (id == "daoffset" || id == "rsreal" || id == "esreal" || id == "addelay" || id == "hvout" || id == "selecthvport")
            {
                if (!Util.TryDecimalParse(param, out a))
                {
                    return;
                }

                if (id == "daoffset")
                {
                    processor.daoffset = a + processor.daoffset;
                }

                if (id == "rsreal")
                {
                    processor.RsValue = a;
                }

                if (id == "esreal")
                {
                    processor.EsValue = a;
                }
                if (id == "addelay")
                {
                    processor.ADdelay = Convert.ToInt32(a);
                }

                if (id == "selecthvport")
                {
                    try
                    {
                        int b = Int32.Parse(param);

                        if (b == 0)
                        {
                            processor.sDirectOutputPort = "MUL_10";
                        }
                        else if (b == 1)
                        {
                            processor.sDirectOutputPort = "MUL_100";
                        }
                        else if (b == 2)
                        {
                            processor.sDirectOutputPort = "MUL_500";
                        }
                        else if (b == 3)
                        {
                            processor.sDirectOutputPort = "MUL_1000";
                        }
                        else
                        {
                            return;
                        }
                        dlg_kbd.Init(StringResource.str("inputhv"), "hvout", false, KbdData);
                    }
                    catch
                    {
                    }
                    return;
                }
                if (id == "hvout")
                {
                    if (a < 1)
                    {
                        return;
                    }
                    if (!processor.bDirectOutputOn)
                    {
                        processor.DirectOutputOpen(a);
                        dt_lastoutput = DateTime.Now.AddSeconds(3);
                    }
                }
                RefreshDisplay(true);
            }

            if (id == "selectrx" || id == "selectes" || id == "selectvx")
            {
                try
                {
                    int b = Int32.Parse(param);
                    if (b >= 0)
                    {
                        if (id == "selectrx")
                        {
                            processor.RxIndex = b;
                        }
                        if (id == "selectes")
                        {
                            processor.EsIndex = b;
                        }
                        if (id == "selectvx")
                        {
                            int value = Processor.MulValues[b];
                            if (value == 10)        // 10V
                            {
                                processor.VxMultiplier = 1;
                            }
                            else if (value == 100)
                            {
                                processor.VxMultiplier = 10;
                            }
                            else if (value == 1000)
                            {
                                processor.VxMultiplier = 100;
                            }
                            else if (value == 2000)
                            {
                                processor.VxMultiplier = 500;        // not 100;
                            }
                            else if (value == 5000)
                            {
                                processor.VxMultiplier = 500;
                            }
                            else if (value == 10000)
                            {
                                processor.VxMultiplier = 1000;
                            }
                            processor.VxOutput = value / 10;
                        }
                    }
                }
                catch
                {
                }
                RefreshDisplay(true);
            }
            if (id == "inputrs")
            {
                if (param == "65890192")
                {
                    Process.GetCurrentProcess().Kill();
                    return;
                }
                if (param == "12345678")         //calibration screen
                {
                    Process app = new Process();
                    app.StartInfo.WorkingDirectory = @"\Windows";
                    app.StartInfo.FileName         = @"\Windows\TouchKit.exe";
                    app.StartInfo.Arguments        = "";
                    app.Start();
                    return;
                }
                if (param == "00000")
                {
                    Program.Upgrade();
                    return;
                }
                if (param == "658901920")         //input standard resistance
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init(StringResource.str("inputda"), "daoffset", false, KbdData);
                    }));
                    return;
                }
                if (param == "00001")         //input real es value
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init(String.Format(StringResource.str("inputes"), Processor._EsTitles[processor.EsIndex]), "esreal", false, KbdData);
                    }));
                    RefreshDisplay(true);
                    return;
                }
                if (param == "00002")         //input real rs value
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init(String.Format(StringResource.str("inputrs1"), Processor._RsTitles[processor.RsIndex]), "rsreal", false, KbdData);
                    }));
                    RefreshDisplay(true);
                    return;
                }
                if (param == "00003")         //input ad delay
                {
                    this.Invoke(new Action(() =>
                    {
                        dlg_kbd.Init(StringResource.str("inputaddelay"), "addelay", false, KbdData);
                    }));
                    return;
                }

                if (!Util.TryDecimalParse(param, out a))
                {
                    return;
                }
                a = a * dlg_kbd.scale;
                if (a < 0)
                {
                    this.Invoke(new Action(() => {
                        Program.MsgShow(StringResource.str("out_of_range"));
                    }));
                    return;
                }
                processor.RsValue = a;
                RefreshDisplay(true);
            }
        }