Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ResistanceCalculation _resistanceCalculation = new ResistanceCalculation(_textBoxList, _elementType);

            _iMathCount = _resistanceCalculation.ResistanceCalculator();
            if (_iMathCount != null)
            {
                Delegate.DelegateInnerFunc(_iMathCount);
            }
        }
        public IMathCount ResistanceCalculator()
        {
            try
            {
                int      i         = 0;
                double[] parametrs = new double[3];
                foreach (var textbox in _textBoxList)
                {
                    //InspectionParametrs.Parametr(textbox.Text, textbox.Name);
                    parametrs[i] = InspectionParametrs.Parametr(textbox.Text, textbox.Name);
                    i++;
                }


                switch (_elementType)
                {
                case 0:
                {
                    _iMathCount = new CapacityResCalc
                    {
                        CapacityValue  = parametrs[0],
                        FrequencyValue = parametrs[1]
                    };
                    break;
                }

                case 1:
                {
                    _iMathCount = new InductResCalc
                    {
                        InductanceValue = parametrs[0],
                        FrequencyValue  = parametrs[1]
                    };
                    break;
                }

                case 2:
                {
                    _iMathCount = new ResistanceResCalc
                    {
                        ResistanceValue = parametrs[0]
                    };
                    break;
                }

                default: break;
                }
                parametrs = null;
                return(_iMathCount);
            }
            catch (Exception) { return(null); }
        }
Exemple #3
0
        private void AddObject_Click(object sender, EventArgs e)
        {
            AddElementForm AddForm = new AddElementForm();

            AddForm.Delegate = this;
            AddForm.Closed  += (obj, arg) =>
            {
                if (_figure != null)
                {
                    ListElement.Add(_figure);
                    _figure = null;
                }
                WriteInGrid();     // запись в грид
            };

            AddForm.ShowDialog();
        }
Exemple #4
0
 /// <summary>
 /// Коструктор для делигата
 /// </summary>
 /// <param name="figure"></param>
 public void DelegateInnerFunc(IMathCount figure)
 {
     _figure = figure;
 }