예제 #1
0
        private void MMMeasuringExp_Click(object sender, EventArgs e)
        {
            try
            {
                string          bpath = Common.Db.GetFoladerPath(Common.DbNameProbSort) + "\\условия.bin";
                FileStream      fs;
                SpectrCondition cond;
                if (File.Exists(bpath))
                {
                    fs = new FileStream(bpath, FileMode.Open, FileAccess.Read);
                    BinaryReader br = new BinaryReader(fs);
                    cond = new SpectrCondition(br);
                    br.Close();
                }
                else
                {
                    cond = null;
                }
                cond = SpectrCondEditor.GetCond(MainForm.MForm, cond);
                if (cond == null)
                {
                    return;
                }

                fs = new FileStream(bpath, FileMode.Create, FileAccess.Write);
                BinaryWriter bw = new BinaryWriter(fs);
                cond.Save(bw);
                bw.Flush();
                bw.Close();
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }
        }
예제 #2
0
        public void btReMeasuringSpectr_Click(object sender, EventArgs e)
        {
            try
            {
                if (Selected == null)
                {
                    MessageBox.Show(MainForm.MForm,
                                    Common.MLS.Get(MLSConst, "Выберите спектр который нужно перемерить"),
                                    Common.MLS.Get(MLSConst, "Предупреждение"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning
                                    );
                    return;
                }

                //LastName = (string)Selected.Text;
                LastPath = SelectedTag.GetPath();
                //LastName

                DialogResult dr = MessageBox.Show(MainForm.MForm,
                                                  Common.MLS.Get(MLSConst, "Вы действительно хотите перемерить спектр: ") + LastPath,
                                                  Common.MLS.Get(MLSConst, "Осторожно!!!"),
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Warning);

                if (dr == DialogResult.No)
                {
                    return;
                }

                CurSp = new Spectr(LastPath);//(Folder, LastName);

                SpectrCondition cond;
                if (DefaultCondition == null)
                {
                    SpectrCondition spc = CurSp.GetMeasuringCondition();
                    cond = SpectrCondEditor.GetCond(MainForm.MForm, spc);
                    if (cond == null)
                    {
                        return;
                    }
                }
                else
                {
                    cond = DefaultCondition;
                }

                Dev.MeasuringResultFinalCall final_call = new Dev.MeasuringResultFinalCall(btReMeasuringSpectr_Click_Final);
                Common.Dev.Measuring(cond, final_call);
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }
        }
        private void btCycleMeasuring_Click(object sender, EventArgs e)
        {
            try
            {
                if (CycleThread == null && sender != null)
                {
                    Spectr sp = Control.GetSelectedSpectrCT();
                    if (sp == null)
                    {
                        return;
                    }

                    SpectrCondition spc = sp.GetMeasuringCondition();
                    CCond = SpectrCondEditor.GetCond(MainForm.MForm, spc);
                    if (CCond == null)
                    {
                        return;
                    }

                    CycleThread = new Thread(btCycleMeasuring_Thread);
                    CycleThread.Start();
                    PrevName = btCycleMeasuring.Text;
                    btCycleMeasuring.Text = Common.MLS.Get(MLSConst, "Остановить");

                    MainForm.MForm.EnableToolExit(false, null);
                    btCycleMeasuring.Enabled = true;
                }
                else
                {
                    CycleThread           = null;
                    btCycleMeasuring.Text = PrevName;
                    MainForm.MForm.EnableToolExit(true, null);
                    if (chbGenOn.Checked)
                    {
                        chbGenOn.Checked = false;
                    }
                    if (chbFillLight.Checked)
                    {
                        chbFillLight.Checked = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }
        }
예제 #4
0
        public void btMeasuringNewSpectr_Click(object sender, EventArgs e)
        {
            try
            {
                string          name = null;
                SpectrCondition spc;
                if (FirstFileName != null && clSpList.Nodes[0].Nodes.Count == 0)
                {
                    name = FirstFileName;
                    spc  = null;
                }
                else
                {
                    name = util.StringDialog.GetString(MainForm.MForm,
                                                       Common.MLS.Get(MLSConst, "Создание пробы"),
                                                       Common.MLS.Get(MLSConst, "Введите имя новой пробы"),
                                                       "", true);
                }

                if (name == null)
                {
                    return;
                }

                //DbFolder dbf;
                //CSTreeNodeTag selected;
                if (Selected == null)
                {
                    CurTag = new CSTreeNodeTag(Folder, name);
                }
                else
                {
                    CurTag = new CSTreeNodeTag(((CSTreeNodeTag)(Selected.Tag)).Folder, name);
                }
                //List<TreeNode> items = GetItemsList();
                //for (int i = 0; i < clSpList.Items.Count;i++ )
                if (CurTag.IsSpectrExists(name))//clSpList.Items[i].Equals(name))
                {
                    MessageBox.Show(MainForm.MForm,
                                    Common.MLS.Get(MLSConst, "Проба с таким именнем уже сужествует."),
                                    Common.MLS.Get(MLSConst, "Предупреждение"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                LastPath = CurTag.GetPath();

                if (FirstFileName != null && clSpList.Nodes[0].Nodes.Count != 0)
                {
                    //string path = selected.Folder.CreateRecordPath(name);
                    Spectr sp = new Spectr(CurTag.Folder, FirstFileName);
                    spc = sp.GetMeasuringCondition();
                }
                else
                {
                    spc = null;
                }

                SpectrCondition cond;
                if (DefaultCondition == null)
                {
                    cond = SpectrCondEditor.GetCond(MainForm.MForm, spc);
                    if (cond == null)
                    {
                        return;
                    }
                }
                else
                {
                    cond = DefaultCondition;
                }

                //Spectr sp = new Spectr(cond,Common.Env.DefaultDisp,Common.Env.DefaultOpticFk);
                Dev.MeasuringResultFinalCall final_call = new Dev.MeasuringResultFinalCall(btMeasuringNewSpectr_Click_Final);
                Common.Dev.Measuring(cond, final_call);
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }
        }