Пример #1
0
        private void OnGo(object sender, EventArgs e)
        {
            try
            {
                CalculateOptimalConstant calculator = new CalculateOptimalConstant(MinConstant, MaxConstant, Step);
                calculator.UpdateObserverEvent += UpdateMessage;

                object obj = _comboBoxVariableToUse.SelectedItem;

                if (null != obj)
                {

                    ComboBoxItem it = (ComboBoxItem)obj;

                    calculator.GetValue = it.GetValueMethod;

                    int i = calculator.Calculate();
                    _txtboxoptimalConstant.Text = i.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Failed to Calculate Constant");
            }
        }