Ejemplo n.º 1
0
        private void _deleteAdatawriter(object obj)
        {
            // Delete step
            DataWriterViewModel stepRemove = (DataWriterViewModel)obj;

            if (MessageBox.Show("Delete data writer " + stepRemove.StepCounter.ToString() + "?", "Warning!", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                // Try to delete current step
                try
                {
                    DataWriters.Remove(stepRemove);
                    foreach (var step in DataWriters)
                    {
                        if (step.StepCounter > stepRemove.StepCounter)
                        {
                            step.StepCounter -= 1;
                        }
                    }
                    Model.DataWriters.Remove(stepRemove.Model);
                }
                catch (Exception)
                {
                    MessageBox.Show("Error deleting a data writer");
                }
                // Select a different step?
                if (SelectedStep != null)
                {
                    SelectedStep.IsSelected = false;
                    SelectedStep            = null;
                }
            }
        }
Ejemplo n.º 2
0
        private void _addDataWriter(object obj)
        {
            var newWriter = new DataWriterViewModel();

            newWriter.StepCounter = DataWriters.Count + 1;
            newWriter.ThisStepInputsGroupedByType = new SignalTree("Step " + newWriter.StepCounter.ToString() + " _ " + newWriter.Name);
            newWriter.ThisStepOutputsGroupedByPMU = new SignalTree("Step " + newWriter.StepCounter.ToString() + " _ " + newWriter.Name);
            SampleDataMngr.GroupedSignalByDataWriterStepsInput.Add(newWriter.ThisStepInputsGroupedByType);
            DataWriters.Add(newWriter);
            Model.DataWriters.Add(newWriter.Model);
            _dataWriterSelected(newWriter);
        }