private bool Set_EventProperties() { if (!(Txt_EventName.Text.Equals(""))) { oRecordEvent.Name = Txt_EventName.Text; } else { MessageBox.Show("Name of the record event cannot be empty !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } oRecordEvent.StartingDate = DP_EventDate.Value; oRecordEvent.Comment = rTxt_EventComment.Text; //User infos oRecordEvent.UserInfos = Ctrl_UserInfo.Get_UserInformations(); //Record session created in the event on the fly //Update application event list if new event string AppEventsFile = CANStreamTools.CsDataPath + "\\RecordEvents.xml"; CS_RecordEventsCollection oAppEvents = new CS_RecordEventsCollection(); if (File.Exists(AppEventsFile)) { oAppEvents.Read_EventsCollectionFile(AppEventsFile); } if (bNewEvent) { oAppEvents.Events.Insert(0, oRecordEvent); } else { int EventId = oAppEvents.Get_RecordEventIndex(OriginalEventName, OriginalEventDate); if (EventId != -1) { oAppEvents.Events[EventId] = oRecordEvent; } else { oAppEvents.Events.Insert(0, oRecordEvent); } } oAppEvents.Write_EventsCollectionFile(AppEventsFile); return(true); }
private void Set_ActiveEvent() { if (!(LV_Sessions.SelectedItems.Count == 0)) { int iEvent = oEventCollection.Get_RecordEventIndex(LV_Sessions.SelectedItems[0].Text, DateTime.Parse(LV_Sessions.SelectedItems[0].SubItems[1].Text)); if (iEvent != -1) { ((MainForm)FrmCaller).Set_ActiveRecordEvent(oEventCollection.Events[iEvent]); } this.Close(); } else { MessageBox.Show("No record event selected !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Update_RecordEventsFile() { CS_RecordEventsCollection oAppEvents = new CS_RecordEventsCollection(); string AppEventsFile = CANStreamTools.CsDataPath + "\\RecordEvents.xml"; if (File.Exists(AppEventsFile)) { if (oAppEvents.Read_EventsCollectionFile(AppEventsFile)) { int CurrentEventIndex = oAppEvents.Get_RecordEventIndex(oEventParent.Name, oEventParent.StartingDate); if (!(CurrentEventIndex == -1)) { oAppEvents.Events[CurrentEventIndex] = oEventParent; oAppEvents.Write_EventsCollectionFile(AppEventsFile); } } } }