private void ItemIdComboBox_Leave(object sender, EventArgs e) { // save new item id to DB only when user selects OK, save to in-memory list for transient use ItemId Cur = NC.App.DB.ItemIds.Get(d => String.Compare(d.item, ItemIdComboBox.Text, false) == 0); if (Cur == null) { // new items need the isotopics specified UpdateIsotopics(straight: false); //Add the item id if not found in DB. Use the current values on the dialog for the item id content ah.ItemIdComboBox_Leave(sender, e); // put the new id on the acq helper Cur = ah.ap.ItemId; // the dlg and acq parms are the same, use the ItemId helper to construct. Create a new object if there is no match. ah.ap.mass = 0; Cur.declaredMass = 0; Cur.modified = true; Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item NC.App.DB.ItemIds.GetList().Add(Cur); // add only to in-memory, save to DB on user OK/exit FieldFillerOnItemId(); // refresh the dialog ItemIdComboBox.Items.Add(ItemIdComboBox.Text); // rebuild combo box and select the new time ItemIdComboBox.Items.Clear(); foreach (ItemId id in NC.App.DB.ItemIds.GetList()) { ItemIdComboBox.Items.Add(id.item); } } }
private void CompositeIsotopicsBtn_Click(object sender, EventArgs e) { IDDCompositeIsotopics f = new IDDCompositeIsotopics(ah.ap.comp_isotopics_id); DialogResult dlg = f.ShowDialog(); if (dlg != DialogResult.OK) { return; } ah.RefreshParams(); CompositeIsotopics selected = f.GetSelectedIsotopics; if (ah.ap.isotopics_id != selected.id) /* They changed the isotopics id. Isotopics already saved to DB in IDDIsotopics*/ { ah.ap.isotopics_id = selected.id; ah.ap.comp_isotopics_id = selected.id; // NEXT: do new item id stuff right after this } else { // isotopic settings will be loaded from DB prior to running measurement // change the isotopics setting on the current item id state ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); if (Cur == null) // blank or unspecified somehow { return; } Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item NC.App.DB.ItemIds.Set(Cur); NC.App.DB.ItemIds.Refresh(); // save and update the list of items } }
void UpdateIsotopics(bool straight) // straight means from iso button { IDDIsotopics f = new IDDIsotopics(ah.ap.isotopics_id); DialogResult dlg = f.ShowDialog(); if (dlg != DialogResult.OK) { return; } ah.RefreshParams(); Isotopics selected = f.GetSelectedIsotopics; if (ah.ap.isotopics_id != selected.id) /* They changed the isotopics id. Isotopics already saved to DB in IDDIsotopics*/ { ah.ap.isotopics_id = selected.id; } // change the isotopics setting on the current item id state ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); if (Cur == null) // blank or unspecified somehow { return; } Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item Cur.modified = true; }
private void OKBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(ItemIdComboBox.Text)) { MessageBox.Show("You must enter an item id for this assay.", "ERROR"); } else { // save/update item id changes only when user selects OK ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item NC.App.DB.ItemIds.Set(); // writes any new or modified item ids to the DB NC.App.DB.ItemIds.Refresh(); // save and update the in-memory item list bool ocntinue = GetAdditionalParameters(); if (ocntinue && (ah.OKButton_Click(sender, e) == DialogResult.OK)) { Visible = false; // Add strata update to measurement object. HN 9.23.2015 UIIntegration.Controller.SetAssay(); // tell the controller to do an assay operation using the current measurement state UIIntegration.Controller.Perform(); // start the measurement file or DAQ thread Close(); } } }
void UpdateIsotopics(bool straight) // straight means from iso button { IDDIsotopics f = new IDDIsotopics(ah.ap.isotopics_id); DialogResult dlg = f.ShowDialog(); if (dlg != DialogResult.OK) { return; } ah.RefreshParams(); Isotopics selected = f.GetSelectedIsotopics; if (ah.ap.isotopics_id != selected.id) /* They changed the isotopics id. Isotopics already saved to DB in IDDIsotopics*/ { ah.ap.isotopics_id = selected.id; // NEXT: do new item id stuff right after this } else if (straight) // same iso name from iso selector but params might have changed, new item id application update occurs elsewhere { // isotopic settings will be loaded from DB prior to running measurement // change the isotopics setting on the current item id state ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); if (Cur == null) // blank or unspecified somehow { return; } Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item Cur.modified = true; } }
private void OKBtn_Click(object sender, EventArgs e) { AnalysisMethods am = Integ.GetMethodSelections(ah.ap); if (am != null) { bool isCollar = Integ.GetMethodSelections(Integ.GetCurrentAcquireParams()).Has(AnalysisMethod.CollarAmLi) || Integ.GetMethodSelections(Integ.GetCurrentAcquireParams()).Has(AnalysisMethod.CollarCf); if (string.IsNullOrEmpty(ItemIdComboBox.Text)) { MessageBox.Show("You must enter an item id for this assay.", "ERROR"); DialogResult = DialogResult.Abort; } else if (!isCollar) { // save/update item id changes only when user selects OK ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item NC.App.DB.ItemIds.Set(); // writes any new or modified item ids to the DB NC.App.DB.ItemIds.Refresh(); // save and update the in-memory item list bool ocntinue = GetAdditionalParameters(); if (ocntinue && (ah.OKButton_Click(sender, e) == DialogResult.OK)) { Visible = false; // Add strata update to measurement object. HN 9.23.2015 UIIntegration.Controller.SetAssay(); // tell the controller to do an assay operation using the current measurement state UIIntegration.Controller.Perform(); // start the measurement file or DAQ thread Close(); } DialogResult = DialogResult.None; } else { //Collar // save/update item id changes only when user selects OK ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item NC.App.DB.ItemIds.Set(); // writes any new or modified item ids to the DB NC.App.DB.ItemIds.Refresh(); // save and update the in-memory item list DialogResult = DialogResult.OK; Close(); } } else { MessageBox.Show(string.Format("No analysis methods specified for detector {0} and material {1}", ah.ap.detector_id, ah.ap.item_type), "Verification", MessageBoxButtons.OK); } }
private void CancelBtn_Click(object sender, EventArgs e) { //Store any changes before exiting? //NEXT: Should we warn no changes stored instead? HN 08-04-2016 if (!string.IsNullOrEmpty(ah.ap.item_id)) { ItemId Cur = NC.App.DB.ItemIds.Get(ah.ap.item_id); if (Cur != null) { Cur.IsoApply(NC.App.DB.Isotopics.Get(ah.ap.isotopics_id)); // apply the iso dates to the item } NC.App.DB.ItemIds.Set(); // writes any new or modified item ids to the DB NC.App.DB.ItemIds.Refresh(); // save and update the in-memory item list } Close(); }
private void OKBtn_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; //If they didn't load a passive measurement from the DB, so measure it. if (passive == null) { ItemId Cur = NC.App.DB.ItemIds.Get(ap.item_id); Cur.IsoApply(NC.App.DB.Isotopics.Get(ap.isotopics_id)); // apply the iso dates to the item NC.App.DB.ItemIds.Set(); // writes any new or modified item ids to the DB NC.App.DB.ItemIds.Refresh(); // save and update the in-memory item list if (DialogResult == DialogResult.OK) { Visible = false; // Add strata update to measurement object. HN 9.23.2015 UIIntegration.Controller.SetAssay(); // tell the controller to do an assay operation using the current measurement state UIIntegration.Controller.Perform(); // start the measurement file or DAQ thread } DialogResult = DialogResult.None; passive = NCC.CentralizedState.App.Opstate.Measurement; } else // We've got the passive data, go ahead and get the active cycles { Visible = false; INCCAnalysisParams.collar_combined_rec ka = (INCCAnalysisParams.collar_combined_rec)am.GetMethodParameters(AnalysisMethod.CollarAmLi); Integ.BuildMeasurement(ap, Integ.GetCurrentAcquireDetector(), AssaySelector.MeasurementOption.verification); Integ.PersistDetectorAndAssociations(Integ.GetCurrentAcquireDetector()); //active = new Measurement(AssaySelector.MeasurementOption.verification, NC.App.Loggers.DataLogger); //active.InitializeResultsSummarizers(); //active.InitializeContext(true); //active.Persist(); // Add strata update to measurement object. HN 9.23.2015 UIIntegration.Controller.SetAssay(); // tell the controller to do an assay operation using the current measurement state UIIntegration.Controller.Perform(); // start the measurement file or DAQ thread Close(); } }