private void Add(TimeLineItemViewModel timeLineItem) { // Add to list TimeLineItems.Add(timeLineItem); // Serialize added item timeLineItem.SerializationDirectory = _serializationDir; timeLineItem.ShouldAutoSerialize = true; timeLineItem.SerializeConfigurations(null, null); }
private void Delete(TimeLineItemViewModel timeLineItem) { // Remove from memory TimeLineItems.Remove(timeLineItem); // Remove from disk var pathToRemove = Path.Combine(_serializationDir, timeLineItem.Name + ".xml"); if (File.Exists(pathToRemove)) { File.Delete(pathToRemove); } }
public void AddTimeLineItem(string comment) { var newItem = new TimeLineItemViewModel() { Comment = comment, ProductType = ApplicationViewModel.Instance.CurrentProductType, StartTime = DateTime.Now }; Add(newItem); // Delete outdated timelines DeleteOutdatedItems(); ShouldDialogOpen = false; }