SecureDelete.Schedule.HistoryManager.Add C# (CSharp) Method

Add() public method

public Add ( HistoryItem item ) : bool
item HistoryItem
return bool
        public bool Add(HistoryItem item)
        {
            if(item == null) {
                throw new ArgumentNullException("item");
            }

            HistoryCategory category = null;

            if(_categories.ContainsKey(item.SessionGuid)) {
                category = _categories[item.SessionGuid];
            }
            else {
                // create new category
                category = new HistoryCategory();
                category.Guid = item.SessionGuid;
                _categories.Add(category.Guid, category);
            }

            // add the item to the category
            try {
                category.Items.Add(item.StartTime, item);
            }
            catch(Exception e) {
                Debug.ReportError("Error while adding history item to category. Exception {0}", e.Message);
                return false;
            }

            return true;
        }