public ScenarioForm(ScenarioComponent targetComponent, Form parentWindow) { InitializeComponent(); MdiParent = parentWindow; Tag = targetComponent; hComponent = targetComponent; Text = hComponent.ScenarioName + " (Scenario)"; _mManager = new MementoManager((IMForm)MdiParent); RefreshValues(); }
public object Clone() { // Returns a deep (value-wise) copy of the object ScenarioComponent copy = new ScenarioComponent(); copy._scenarioName = _scenarioName; copy.SimParams.SimEnd = SimParams.SimEnd; copy.SimParams.SimStart = SimParams.SimStart; copy.SimParams.SimStartJD = SimParams.SimStartJD; copy.SchParams = SchParams; return(copy); }
public void Clone(object value) { // Writes a deep (value-wise) copy onto the object from value if (value.GetType() == typeof(ScenarioComponent)) { ScenarioComponent v = (ScenarioComponent)value; _scenarioName = v._scenarioName; SimParams.SimEnd = v.SimParams.SimEnd; SimParams.SimStart = v.SimParams.SimStart; SimParams.SimStartJD = v.SimParams.SimStartJD; SchParams = v.SchParams; } }
private void MaxSchedulesControl_TextChanged(object sender, EventArgs e) { try { ScenarioComponent before = (ScenarioComponent)hComponent.Clone(); hComponent.SchParams.MaxSchedules = Convert.ToInt32(MaxSchedulesControl.Text); _mManager.RegisterEvent(before, hComponent, hComponent, "Reference Time Change"); } catch (FormatException) { // Text box value not a double; ignore change MessageBox.Show("Text box value not in correct format"); } }