public AddOrEditAutobiographicalEventForm(AutobiographicalMemoryVM amVM, EventDTO eventToEdit = null) { InitializeComponent(); _autobiographicalMemoryVm = amVM; _eventToEdit = eventToEdit; comboBoxEventType.DataSource = _autobiographicalMemoryVm.EventTypes; if (eventToEdit != null) { this.Text = Resources.EditAutobiographicalEventFormTitle; this.addOrEditButton.Text = Resources.UpdateButtonLabel; _eventToEdit = _autobiographicalMemoryVm.RetrieveEventRecord(_eventToEdit.Id); var propertyEvent = _eventToEdit as PropertyChangeEventDTO; if (propertyEvent != null) { comboBoxEventType.Text = Constants.PROPERTY_CHANGE_EVENT.ToString(); textBoxSubject.Text = propertyEvent.Subject; textBoxObject.Text = propertyEvent.Property; textBoxTarget.Text = propertyEvent.NewValue; textBoxTime.Text = propertyEvent.Time.ToString(); } var actionEvent = _eventToEdit as ActionEventDTO; if (actionEvent != null) { textBoxSubject.Text = actionEvent.Subject; textBoxObject.Text = actionEvent.Action; textBoxTarget.Text = actionEvent.Target; textBoxTime.Text = actionEvent.Time.ToString(); } } }
public AddOrEditAutobiographicalEventForm(AutobiographicalMemoryVM amVM, EventDTO eventToEdit = null) { InitializeComponent(); textBoxSubject.Value = amVM.CharName; //Restrictions textBoxSubject.AllowNil = false; textBoxSubject.AllowUniversal = false; textBoxSubject.AllowVariable = false; textBoxTarget.AllowUniversal = false; textBoxTarget.AllowVariable = false; textBoxObject.AllowVariable = false; textBoxObject.AllowUniversal = false; textBoxObject.AllowNil = false; _autobiographicalMemoryVm = amVM; _eventToEdit = eventToEdit; textBoxObject.Value = WellFormedNames.Name.BuildName("A(P1)"); comboBoxEventType.DataSource = AutobiographicalMemoryVM.EventTypes; if (eventToEdit != null) { this.Text = "Edit Event Record"; this.addOrEditButton.Text = "Update"; _eventToEdit = _autobiographicalMemoryVm.RetrieveEventRecord(_eventToEdit.Id); var propertyEvent = _eventToEdit as PropertyChangeEventDTO; if (propertyEvent != null) { comboBoxEventType.Text = AMConsts.PROPERTY_CHANGE.ToString(); textBoxSubject.Value = (WellFormedNames.Name)propertyEvent.Subject; textBoxObject.Value = (WellFormedNames.Name)propertyEvent.Property; textBoxTarget.Value = (WellFormedNames.Name)propertyEvent.NewValue; textBoxTime.Value = (int)propertyEvent.Time; } var actionEvent = _eventToEdit as ActionEventDTO; if (actionEvent != null) { textBoxSubject.Value = (WellFormedNames.Name)actionEvent.Subject; textBoxObject.Value = (WellFormedNames.Name)actionEvent.Action; textBoxTarget.Value = (WellFormedNames.Name)actionEvent.Target; textBoxTime.Value = (int)actionEvent.Time; } } }