示例#1
0
        private void Operation_Perf(object sender, EventArgs e)
        {
            if (!_infinityCheck)
            {
                Button output = (Button)sender;

                if (_resultValue != 0)
                {
                    Equal.PerformClick();
                    _operatorPerf    = output.Text;
                    Label_Show.Text  = $"{_firstValue} {_operatorPerf}";
                    _boloperatorPerf = true;
                }
                else if (TxtBox.Text.Length <= 0)
                {
                    TxtBox.Text  = Constants.ZeroValue;
                    _resultValue = 0;
                }
                else
                {
                    _operatorPerf    = output.Text;
                    _firstValue      = double.Parse(TxtBox.Text);
                    Label_Show.Text  = $"{_firstValue} {_operatorPerf}";
                    _boloperatorPerf = true;
                }
            }
            else
            {
                Global_Clr.PerformClick();
            }
        }
示例#2
0
        private void Button_Click(object sender, EventArgs e)
        {
            if (!_infinityCheck)
            {
                if ((TxtBox.Text == Constants.ZeroValue) || (_boloperatorPerf))
                {
                    TxtBox.Clear();
                }
                _boloperatorPerf = false;
                Button output = (Button)sender;

                if (output.Text == Constants.BulletOperator)
                {
                    if (!TxtBox.Text.Contains(Constants.BulletOperator))
                    {
                        TxtBox.Text = TxtBox.Text + output.Text;
                    }
                }
                else if (_equalclick)
                {
                    Global_Clr.PerformClick();
                    _resultValue    = 0;
                    _firstValue     = 0;
                    Label_Show.Text = string.Empty;
                    TxtBox.Text     = output.Text;
                    _equalclick     = false;
                }
                else if (_equalclick && _resultValue <= 0 && _resultValue >= 0)
                {
                    _resultValue    = _firstValue;
                    _firstValue     = double.Parse(TxtBox.Text);
                    TxtBox.Text     = output.Text;
                    Label_Show.Text = $"{_firstValue} {_operatorPerf}";
                    TxtBox.Text     = output.Text;
                    _equalclick     = false;
                }
                else
                {
                    TxtBox.Text = TxtBox.Text + output.Text;
                }
            }
            else
            {
                Global_Clr.PerformClick();
            }
        }