private void buttonSave_Click(object sender, EventArgs e) { if (dialogSaveModel.ShowDialog() == DialogResult.OK) { int filterIndex = dialogSaveModel.FilterIndex; try { switch (filterIndex) { // OPT model case 2: Model optModel = ModelsConverter.ConvertToOptimization(ModelStorage.Instance.Model); XmlModelProvider.Save(optModel, dialogSaveModel.FileName); break; // OPT.ID model case 1: default: XmlIdentificationModelProvider.Save(ModelStorage.Instance.Model, dialogSaveModel.FileName); break; } } catch (Exception ex) { MessageBoxHelper.ShowError(ex.Message); } dialogSaveModel.FileName = string.Empty; } }
private void WriteExchangeFile(string exchangeFilePath) { XmlIdentificationModelProvider.Save(ModelStorage.Instance.Model, exchangeFilePath); while (!File.Exists(exchangeFilePath)) { Thread.Sleep(500); } }
public void Save() { if (model == null) { throw new InvalidOperationException("Model is null"); } XmlIdentificationModelProvider.Save(model, modelFile); }
public void ProcessModel(object data) { CancellationToken cancellationToken; if (data == null) { cancellationToken = new CancellationToken(false); } else { cancellationToken = (CancellationToken)data; } if (cancellationToken.IsCancellationRequested) { OnProcessingComplete(new EventArgs()); return; } model = XmlIdentificationModelProvider.Open(optFile); if (cancellationToken.IsCancellationRequested) { OnProcessingComplete(new EventArgs()); return; } int maxProgress = model.IdentificationExperiments.Count; OnProgressChanged(new ProgressChangedEventArgs(0, maxProgress, 0, "Initialized")); int exp = 0; foreach (IdentificationExperiment experiment in model.IdentificationExperiments.Values) { if (cancellationToken.IsCancellationRequested) { break; } ProcessExperiment(experiment); OnProgressChanged(new ProgressChangedEventArgs(0, maxProgress, ++exp, "Processed experiment #" + experiment.Number.ToString())); } if (cancellationToken.IsCancellationRequested) { OnProcessingComplete(new EventArgs()); return; } XmlIdentificationModelProvider.Save(model, optFile); OnProcessingComplete(new EventArgs()); }
private void buttonSave_Click(object sender, EventArgs e) { if (dialogSaveModel.ShowDialog() == DialogResult.OK) { try { XmlIdentificationModelProvider.Save(ModelStorage.Instance.Model, dialogSaveModel.FileName); } catch (Exception ex) { MessageBoxHelper.ShowError(ex.Message); } dialogSaveModel.FileName = string.Empty; } }