예제 #1
0
        private CalcDictTO openCalcForm(CalcTO inputData)
        {
            // bool isFormOpened = false;
            FormCollection fc = Application.OpenForms;
            //b_start_calc.Enabled = false;

            //await Task.Run(() =>
            //{
            //    foreach (Form frm in fc)
            //    {
            //        if (frm.Name == "calc")
            //        {
            //            isFormOpened = true;
            //        }
            //    }
            //});

            //if (!isFormOpened)
            //{
            //    calc cl = new calc();
            //    cl.ShowDialog();
            //}

            calc c1 = new calc(inputData);

            c1.ShowDialog();

            var outputData = c1.getDictTO();

            return(outputData);
        }
예제 #2
0
        public calc(CalcTO inputData)
        {
            InitializeComponent();

            xmin = inputData.Xmin;
            xmax = inputData.Xmax;
            dx   = inputData.Dx;
        }
예제 #3
0
        public CalcTO getData()
        {
            CalcTO data = new CalcTO();

            data.Xmin = Xmin;
            data.Xmax = Xmax;
            data.Dx   = Dx;
            return(data);
        }
예제 #4
0
        private void b_start_calc_Click(object sender, EventArgs e)
        {
            l_firstFuncText.Items.Clear();
            l_secFuncText.Items.Clear();

            CalcTO dataTO = new CalcTO();

            try
            {
                dataTO.Xmax = Convert.ToDouble(t_xmax.Text);
                dataTO.Xmin = Convert.ToDouble(t_xmin.Text);
                dataTO.Dx   = Convert.ToDouble(t_dx.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                b_start_calc.Focus();
            }

            data.setData(dataTO);

            data.setDict(openCalcForm(dataTO));

            if (!isResazed)
            {
                Size      = new System.Drawing.Size(648, 305);
                isResazed = true;
            }

            l_firstFuncText.Visible      = true;
            l_secFuncText.Visible        = true;
            b_showFirstFuncGraph.Visible = true;
            b_showSecFuncGraph.Visible   = true;
            p_f1.Visible = true;
            p_f2.Visible = true;

            //for (int countf = 0, counts = 0; countf < CalcData.FirstExprArr.Length & counts < CalcData.SecExprArr.Length; countf++)
            //{
            //    if (!Double.IsNaN(CalcData.FirstExprArr[j]) || !Double.IsInfinity(CalcData.FirstExprArr[j]))
            //    {
            //        l_firstFuncText.Items.Add($"f(x) = {CalcData.FirstExprArr[countf]}");
            //    }
            //    else
            //    {
            //        l_firstFuncText.Items.Add($"f(x) can't be calculated");
            //    }

            //}

            //for (int counts = 0; counts < CalcData.SecExprArr.Length; counts++)
            //{
            //    if (!Double.IsNaN(CalcData.FirstExprArr[counts]) || !Double.IsInfinity(CalcData.FirstExprArr[counts]))
            //    {
            //        l_firstFuncText.Items.Add($"f(x) = {CalcData.FirstExprArr[counts]}");
            //    }
            //    else
            //    {
            //        l_firstFuncText.Items.Add($"f(x) can't be calculated");
            //    }
            //}

            //var firstExpr = CalcData.FirstExpr;
            //var secExpr = CalcData.SecExpr;

            foreach (KeyValuePair <double, double> keyValue in data.FirstExpr)
            {
                l_firstFuncText.Items.Add(String.Format("x = {0:f2}, f(x) = {1:f2}", keyValue.Key, keyValue.Value));
            }

            foreach (KeyValuePair <double, double> keyValue in data.SecExpr)
            {
                l_secFuncText.Items.Add(String.Format("x = {0:f2}, f(x) = {1:f2}", keyValue.Key, keyValue.Value));
            }
        }
예제 #5
0
 public void setData(CalcTO data)
 {
     Xmin = data.Xmin;
     Xmax = data.Xmax;
     Dx   = data.Dx;
 }