コード例 #1
0
        public void ShowSearchDlg(TaskMethodSimple tms, MethodSimpleElementFormula formula,
                                  MethodSimple method, SpectrView spv, string element_name, int el_index, int sel_col)
        {
            ElementIndex = el_index;
            ElementName  = element_name;
            TMS          = tms;
            Method       = method;
            Formula      = formula;
            Spv          = spv;
            SelectedCol  = sel_col;
            Sp           = spv.GetSpectr(0);
            if (Sp == null)
            {
                MessageBox.Show(MainForm.MForm, Common.MLS.Get(MLSConst, "Необходимо выбрать спектры по котором будет производится привязка к профилю..."),
                                Common.MLS.Get(MLSConst, "Предупреждение"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            btSearchStart.Text = Common.MLS.Get(MLSConst, MLSStartButtonText);
            Saved = new MemoryStream();
            BinaryWriter bw = new BinaryWriter(Saved);

            try
            {
                Formula.Save(bw);
            }
            catch (Exception ex)
            {
                Common.LogNoMsg(ex);
                MessageBox.Show(MainForm.MForm, Common.MLS.Get(MLSConst, "Нельзя подбирать линии для незаконченной формулы..."),
                                Common.MLS.Get(MLSConst, "Предупреждение"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (Formula.Formula.SeachBuffer != null)
            {
                MemoryStream ms  = new MemoryStream(Formula.Formula.SeachBuffer);
                BinaryReader br  = new BinaryReader(ms);
                int          ver = br.ReadInt32();
                if (ver == 1)
                {
                    int size = br.ReadInt32();
                    for (int i = 0; i < size; i++)
                    {
                        Results.Add(new CalcResult(br));
                    }
                    br.Close();
                    ReloadResultList();
                }
            }

            this.ShowDialog(MainForm.MForm);
        }