public SourceTemplateold(CreateApertureForm form)
        {
            Distribution = form.comboBoxDistribution.SelectedItem.ToString();
            Lable        = form.textBoxApertureTitle.Text;
            if (Distribution == "Загрузить из файла")
            {
                //I = form.icurInfo;
                //M = form.mcurInfo;
            }
            else
            {
                Complex Ix = new Complex(Convert.ToDouble(form.textBoxAppertureIxRe.Text), Convert.ToDouble(form.textBoxAppertureIxIm.Text));
                Complex Iy = new Complex(Convert.ToDouble(form.textBoxAppertureIyRe.Text), Convert.ToDouble(form.textBoxAppertureIyIm.Text));
                Complex Iz = new Complex(Convert.ToDouble(form.textBoxAppertureIzRe.Text), Convert.ToDouble(form.textBoxAppertureIzIm.Text));
                Complex Mx = new Complex(Convert.ToDouble(form.textBoxAppertureMxRe.Text), Convert.ToDouble(form.textBoxAppertureMxIm.Text));
                Complex My = new Complex(Convert.ToDouble(form.textBoxAppertureMyRe.Text), Convert.ToDouble(form.textBoxAppertureMyIm.Text));
                Complex Mz = new Complex(Convert.ToDouble(form.textBoxAppertureMzRe.Text), Convert.ToDouble(form.textBoxAppertureMzIm.Text));

                I = new CVector[1];
                M = new CVector[1];

                for (int i = 0; i < 1; i++)
                {
                    I[i] = new CVector(Ix, Iy, Iz);
                    M[i] = new CVector(Mx, My, Mz);
                }
            }


            //Polarization = form.comboBoxPolarization.SelectedIndex;


            if (form.radioButtonChannel1.Checked)
            {
                DifferenceChanel = false;
            }
            else
            {
                DifferenceChanel = true;
            }
            DifferenceAxis          = form.comboBoxDiffAxis.SelectedItem.ToString();
            Scanning                = form.comboBoxScanning.SelectedIndex;
            SystemOfCoordinatesScan = form.comboBoxSysOfCoordScan.SelectedIndex;
            ThetaScanEStart         = Convert.ToDouble(form.textBoxScanThetaStart.Text);
            ThetaScanEFinish        = Convert.ToDouble(form.textBoxScanThetaFinish.Text);
            ThetaScanEStep          = Convert.ToDouble(form.textBoxScanThetaStep.Text);

            PhiScanEStart  = Convert.ToDouble(form.textBoxScanPhiStart.Text);
            PhiScanEFinish = Convert.ToDouble(form.textBoxScanPhiFinish.Text);
            PhiScanEStep   = Convert.ToDouble(form.textBoxScanPhiStep.Text);

            axis1x1 = Convert.ToDouble(form.textBoxRotAxis1X1.Text);
            axis1y1 = Convert.ToDouble(form.textBoxRotAxis1Y1.Text);
            axis1z1 = Convert.ToDouble(form.textBoxRotAxis1Z1.Text);

            axis1x2 = Convert.ToDouble(form.textBoxRotAxis1X2.Text);
            axis1y2 = Convert.ToDouble(form.textBoxRotAxis1Y2.Text);
            axis1z2 = Convert.ToDouble(form.textBoxRotAxis1Z2.Text);

            axis2x1 = Convert.ToDouble(form.textBoxRotAxis2X1.Text);
            axis2y1 = Convert.ToDouble(form.textBoxRotAxis2Y1.Text);
            axis2z1 = Convert.ToDouble(form.textBoxRotAxis2Z1.Text);

            axis2x2 = Convert.ToDouble(form.textBoxRotAxis2X2.Text);
            axis2y2 = Convert.ToDouble(form.textBoxRotAxis2Y2.Text);
            axis2z2 = Convert.ToDouble(form.textBoxRotAxis2Z2.Text);

            PhiScanMStart  = Convert.ToDouble(form.textBoxMAngle2Start.Text);
            PhiScanMFinish = Convert.ToDouble(form.textBoxMAngle2Finish.Text);
            PhiScanMStep   = Convert.ToDouble(form.textBoxMAngle2Step.Text);

            ThetaScanMStart  = Convert.ToDouble(form.textBoxMAngle1Start.Text);
            ThetaScanMFinish = Convert.ToDouble(form.textBoxMAngle1Finish.Text);
            ThetaScanMStep   = Convert.ToDouble(form.textBoxMAngle1Step.Text);
        }
        public static void SetStaticSourceParameters(CreateApertureForm form)
        {
            string distribution = form.comboBoxDistribution.SelectedItem.ToString();
            string lable        = form.textBoxApertureTitle.Text;

            CVector[] picur = new CVector[DictionaryLibrary.PolarizationNames.Count];
            CVector[] pmcur = new CVector[DictionaryLibrary.PolarizationNames.Count];

            //foreach (var pol in DictionaryLibrary.PolarizationNames)
            //{
            //    string name = pol.Value;
            //    if (form.comboBoxDistribution.SelectedIndex == 0 || form.comboBoxDistribution.SelectedIndex == 1)    //постоянное поле или спадающий косинус
            //    {

            //    }
            //    else if (form.comboBoxDistribution.SelectedIndex == 2)   //загрузка из файла
            //    {

            //    }
            //}

            //Polarization = form.comboBoxPolarization.SelectedIndex;

            bool difference = true;

            if (form.radioButtonChannel1.Checked)
            {
                difference = false;
            }

            Dictionary <string, bool> polariz = new Dictionary <string, bool>();   //new bool[form.checkedListBoxPolarization.Items.Count];

            for (int i = 0; i < form.checkedListBoxPolarization.Items.Count; i++)
            {
                polariz.Add(form.checkedListBoxPolarization.Items[i].ToString(), form.checkedListBoxPolarization.GetItemChecked(i));
            }

            string axis = form.comboBoxDiffAxis.SelectedItem.ToString();
            int    scan = form.comboBoxScanning.SelectedIndex;
            int    systemOfCoordScan = form.comboBoxSysOfCoordScan.SelectedIndex;
            double scanThetaStart    = Convert.ToDouble(form.textBoxScanThetaStart.Text);
            double scanThetaFinish   = Convert.ToDouble(form.textBoxScanThetaFinish.Text);
            double scanThetaStep     = Convert.ToDouble(form.textBoxScanThetaStep.Text);

            double phiScanEStart  = Convert.ToDouble(form.textBoxScanPhiStart.Text);
            double phiScanEFinish = Convert.ToDouble(form.textBoxScanPhiFinish.Text);
            double phiScanEStep   = Convert.ToDouble(form.textBoxScanPhiStep.Text);

            bool includeAxis1 = false;

            if (form.comboBoxAxis1.SelectedIndex == 1)
            {
                includeAxis1 = true;
            }

            double axis1x1 = Convert.ToDouble(form.textBoxRotAxis1X1.Text);
            double axis1y1 = Convert.ToDouble(form.textBoxRotAxis1Y1.Text);
            double axis1z1 = Convert.ToDouble(form.textBoxRotAxis1Z1.Text);

            bool includeAxis2 = false;

            if (form.comboBoxAxis2.SelectedIndex == 1)
            {
                includeAxis2 = true;
            }
            double axis1x2 = Convert.ToDouble(form.textBoxRotAxis1X2.Text);
            double axis1y2 = Convert.ToDouble(form.textBoxRotAxis1Y2.Text);
            double axis1z2 = Convert.ToDouble(form.textBoxRotAxis1Z2.Text);

            double axis2x1 = Convert.ToDouble(form.textBoxRotAxis2X1.Text);
            double axis2y1 = Convert.ToDouble(form.textBoxRotAxis2Y1.Text);
            double axis2z1 = Convert.ToDouble(form.textBoxRotAxis2Z1.Text);

            double axis2x2 = Convert.ToDouble(form.textBoxRotAxis2X2.Text);
            double axis2y2 = Convert.ToDouble(form.textBoxRotAxis2Y2.Text);
            double axis2z2 = Convert.ToDouble(form.textBoxRotAxis2Z2.Text);

            double phiScanMStart  = Convert.ToDouble(form.textBoxMAngle2Start.Text);
            double phiScanMFinish = Convert.ToDouble(form.textBoxMAngle2Finish.Text);
            double phiScanMStep   = Convert.ToDouble(form.textBoxMAngle2Step.Text);

            double thetaScanMStart  = Convert.ToDouble(form.textBoxMAngle1Start.Text);
            double thetaScanMFinish = Convert.ToDouble(form.textBoxMAngle1Finish.Text);
            double thetaScanMStep   = Convert.ToDouble(form.textBoxMAngle1Step.Text);


            SetStaticSourceParameters(lable, form.I, form.M, polariz, distribution, difference, axis, scan, systemOfCoordScan, scanThetaStart, scanThetaFinish, scanThetaStep, phiScanEStart, phiScanEFinish, phiScanEStep, includeAxis1, axis1x1, axis1y1, axis1z1, axis1x2, axis1y2, axis1z2, includeAxis2, axis2x1, axis2y1, axis2z1, axis2x2, axis2y2, axis2z2, phiScanMStart, phiScanMFinish, phiScanMStep, thetaScanMStart, thetaScanMFinish, thetaScanMStep);
        }