Base Data Type Object Class for the representation of an Event
        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 void UpdateEventRecord(EventDTO existingEvent)
 {
     _emotionalAppraisalAsset.UpdateEventRecord(existingEvent);
     Events.DataSource = _emotionalAppraisalAsset.EventRecords.ToList();
     Events.Refresh();
     _mainForm.SetModified();
 }
 public void AddEventRecord(EventDTO newEvent)
 {
     _emotionalAppraisalAsset.AddEventRecord(newEvent);
     Events.DataSource = _emotionalAppraisalAsset.EventRecords.ToList();
     Events.Refresh();
     _mainForm.SetModified();
 }
Esempio n. 4
0
        private Name BuildEventNameFromDTO(EventDTO evt)
        {
            var actionEvent = evt as ActionEventDTO;
            if (actionEvent != null)
            {
                var state = (actionEvent.ActionState == ActionState.Start) ? "Action-Start" : "Action-Finished";
                return Name.BuildName(
                    (Name)"Event",
                    (Name)state,
                    (Name)actionEvent.Subject,
                    (Name)actionEvent.Action,
                    (Name)actionEvent.Target);
            }

            var pcEvent = evt as PropertyChangeEventDTO;
            if (pcEvent != null)
            {
                return Name.BuildName(
                (Name)"Event",
                (Name)"Property-Change",
                (Name)pcEvent.Subject,
                (Name)pcEvent.Property,
                (Name)pcEvent.NewValue);
            }

            throw new Exception("Unknown Event DTO");
        }
Esempio n. 5
0
 public IBaseEvent UpdateEvent(EventDTO dto)
 {
     var evtName = BuildEventNameFromDTO(dto);
     return UpdateEvent(dto.Id, evtName, dto.Time);
 }
Esempio n. 6
0
 public IBaseEvent RecordEvent(EventDTO dto)
 {
     return RecordEvent(BuildEventNameFromDTO(dto), dto.Time);
 }