private void AddStartHistoryItem() { historyItem = new HistoryItem(_taskId, DateTime.Now); if(_historyManager.Add(historyItem) == false) { Debug.ReportError("Failed to add history item for task {0}", _name); } if(_historyManager.SaveHistory(SecureDeleteLocations.GetScheduleHistoryFile()) == false) { Debug.ReportError("Failed to save history items"); } }
public static bool IsWithErrors(HistoryItem item) { return item._endTime.HasValue && item._failed == true; }
public static bool IsOk(HistoryItem item) { return item._endTime.HasValue && item._failed == false; }
public static bool IsFailed(HistoryItem item) { return item._endTime.HasValue == false; }
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; }
public void Remove(HistoryItem item) { if(_categories.ContainsKey(item.SessionGuid)) { HistoryCategory category = _categories[item.SessionGuid]; if(category.Items.ContainsKey(item.StartTime)) { category.Items.Remove(item.StartTime); } } }