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 MMMeasuringReMeasuring_Click(object sender, EventArgs e) { try { string bpath = Common.Db.GetFoladerPath(Common.DbNameProbSort) + "\\условия.bin"; if (File.Exists(bpath) == false) { MMMeasuringExp_Click(sender, e); } if (File.Exists(bpath) == false) { return; } SpectrCondition cond; FileStream fs = new FileStream(bpath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); cond = new SpectrCondition(br); br.Close(); if (tvDirView.SelectedNode == null) { return; } string base_path = (string)(tvDirView.SelectedNode.Tag); int ind = base_path.IndexOf(".ss"); if (ind < 0) { MessageBox.Show(MainForm.MForm, "Выбранный элемент не является спектром. Перемерить невозможно", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } else { base_path = base_path.Substring(0, ind); } Spectr.RemoveSpectr(base_path); MeasuringFile = base_path; Dev.MeasuringResultFinalCall final_call = new Dev.MeasuringResultFinalCall(btMeasuringNewSpectr_Click_Final); Common.Dev.Measuring(cond, final_call); } catch (Exception ex) { Common.Log(ex); } }
private void MMMeasuringAddBase_Click(object sender, EventArgs e) { try { string bpath = Common.Db.GetFoladerPath(Common.DbNameProbSort) + "\\условия.bin"; if (File.Exists(bpath) == false) { MMMeasuringExp_Click(sender, e); } if (File.Exists(bpath) == false) { return; } SpectrCondition cond; FileStream fs = new FileStream(bpath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); cond = new SpectrCondition(br); br.Close(); if (tvDirView.SelectedNode == null) { return; } string base_path = (string)(tvDirView.SelectedNode.Tag); if (base_path.IndexOf(".ss") > 0) { base_path = (string)(tvDirView.SelectedNode.Parent.Tag); } string str = "base"; MeasuringFile = base_path + "\\" + str; Dev.MeasuringResultFinalCall final_call = new Dev.MeasuringResultFinalCall(btMeasuringNewSpectr_Click_Final); Common.Dev.Measuring(cond, final_call); } catch (Exception ex) { Common.Log(ex); } }
private void MMMeasuringAddMeasuring_Click(object sender, EventArgs e) { try { string bpath = Common.Db.GetFoladerPath(Common.DbNameProbSort) + "\\условия.bin"; if (File.Exists(bpath) == false) { MMMeasuringExp_Click(sender, e); } if (File.Exists(bpath) == false) { return; } SpectrCondition cond; FileStream fs = new FileStream(bpath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); cond = new SpectrCondition(br); br.Close(); if (tvDirView.SelectedNode == null) { return; } string base_path = (string)(tvDirView.SelectedNode.Tag); if (base_path.IndexOf(".ss") > 0) { base_path = (string)(tvDirView.SelectedNode.Parent.Tag); } if (base_path[base_path.Length - 1] != 'p' || base_path[base_path.Length - 2] != '.') { MessageBox.Show(MainForm.MForm, "Это не проба. Выберите пробу", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DateTime now = new DateTime(DateTime.Now.Ticks); string def_name = "" + (now.Year - 2000); int tmp = now.Month; if (tmp < 10) { def_name += "0"; } def_name += tmp; tmp = now.Day; if (tmp < 10) { def_name += "0"; } def_name += tmp; def_name += " "; tmp = now.Hour; if (tmp < 10) { def_name += "0"; } def_name += tmp + "."; tmp = now.Minute; if (tmp < 10) { def_name += "0"; } def_name += tmp + "."; tmp = now.Second; if (tmp < 10) { def_name += "0"; } def_name += tmp; string def_path = base_path + "\\" + def_name + ".ss"; if (File.Exists(def_path) == true) { int at = 0; while (File.Exists(def_path) == true) { at++; def_path = base_path + "\\" + def_name + "_" + at + ".ss"; } def_name += "_" + at; } string str = StringDialog.GetString(MainForm.MForm, Common.MLS.Get(MLSConst, "Введите имя пробы"), Common.MLS.Get(MLSConst, "Создание пробы"), def_name, true); if (str == null) { return; } MeasuringFile = base_path + "\\" + str; Dev.MeasuringResultFinalCall final_call = new Dev.MeasuringResultFinalCall(btMeasuringNewSpectr_Click_Final); Common.Dev.Measuring(cond, final_call); } catch (Exception ex) { Common.Log(ex); } }
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); } }