Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
 public static bool IsWithErrors(HistoryItem item)
 {
     return item._endTime.HasValue && item._failed == true;
 }
Exemplo n.º 3
0
 public static bool IsOk(HistoryItem item)
 {
     return item._endTime.HasValue && item._failed == false;
 }
Exemplo n.º 4
0
 public static bool IsFailed(HistoryItem item)
 {
     return item._endTime.HasValue == false;
 }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        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);
                }
            }
        }