private void _deleteDataConfigStep(object obj) { // Delete step PreProcessStepViewModel stepRemove = (PreProcessStepViewModel)obj; if (MessageBox.Show("Delete step " + stepRemove.StepCounter.ToString() + " in Data Configuration: " + stepRemove.Name + "?", "Warning!", MessageBoxButtons.OKCancel) == DialogResult.OK) { // Try to delete current step try { foreach (var step in PreProcessSteps) { if (step.StepCounter > stepRemove.StepCounter) { step.StepCounter -= 1; } } PreProcessSteps.Remove(stepRemove); } catch (Exception) { MessageBox.Show("Error deleting step"); } // Select a different step? if (SelectedStep != null) { SelectedStep.IsSelected = false; } //OnPropertyChanged(); } }
private void _dataConfigStepAdded(object obj) { string stepName = (string)obj; PreProcessStepViewModel newStep = new PreProcessStepViewModel(stepName); newStep.StepCounter = PreProcessSteps.Count + 1; newStep.ThisStepInputsGroupedByType = new SignalTree("Step " + newStep.StepCounter.ToString() + " _ " + newStep.Name); newStep.ThisStepOutputsGroupedByPMU = new SignalTree("Step " + newStep.StepCounter.ToString() + " _ " + newStep.Name); PreProcessSteps.Add(newStep); SampleDataMngr.GroupedSignalByPreProcessStepsInput.Add(newStep.ThisStepInputsGroupedByType); if (newStep.Model is Customization) { SampleDataMngr.GroupedSignalByPreProcessStepsOutput.Add(newStep.ThisStepOutputsGroupedByPMU); } // Set step to edit _stepSelectedToEdit(newStep); //OnPropertyChanged(); }