/// <summary> /// OnChange event is fired when an item is added or removed from the gallery /// </summary> /// <param name="arg"></param> private void OnChanged(GalleryItemsChangedEvent.Args arg) { if (arg.GalleryItem == null) { return; } else { if ((this.ID == "Reviewer_BatchJob_Gallery_Advanced" && arg.GalleryItem.TypeId == "file_datareviewer_batchjob") || (this.ID == "Reviewer_Sessions_Gallery_Advanced" && arg.GalleryItem.TypeId == "SessionResources")) { if (arg.Adding) { if (!ItemCollection.Any(p => (p as GalleryItem).Path == arg.GalleryItem.Path)) { Add(arg.GalleryItem); } } else { GalleryItem itemToRemove = ItemCollection.Where(p => (p as GalleryItem).Path == arg.GalleryItem.Path).FirstOrDefault() as GalleryItem; if (null != itemToRemove) { Remove(itemToRemove); } } } } }
public void Test_add_new_item() { var items = new ItemCollection<ActivityMonitorComponent.WorkItem>(); Assert.AreEqual(0, items.Count); var data = new WorkItemData {Identifier = 1}; var manager = new ActivityMonitorComponent.WorkItemUpdateManager(items, NoFilter, () => {}); manager.Update(new[] { new ActivityMonitorComponent.WorkItem(data) }, NopComparison); Assert.AreEqual(1, items.Count); Assert.IsTrue(items.Any(item => item.Id == 1)); }
public string GetNewSectionName() { var counter = 1; var section = "Section " + counter.ToString(); while (ItemCollection.Any(_ => _.SectionName == section)) { counter++; section = "Section " + counter.ToString(); } return(section); }
public void Test_add_new_item() { var items = new ItemCollection <ActivityMonitorComponent.WorkItem>(); Assert.AreEqual(0, items.Count); var data = new WorkItemData { Identifier = 1 }; var manager = new ActivityMonitorComponent.WorkItemUpdateManager(items, NoFilter, () => {}); manager.Update(new[] { new ActivityMonitorComponent.WorkItem(data) }, NopComparison); Assert.AreEqual(1, items.Count); Assert.IsTrue(items.Any(item => item.Id == 1)); }
private void AfterDeserialization() { if (!classificationSolutions.Any()) { foreach (var model in Model.Models) { IClassificationProblemData problemData = (IClassificationProblemData)ProblemData.Clone(); problemData.TrainingPartition.Start = trainingPartitions[model].Start; problemData.TrainingPartition.End = trainingPartitions[model].End; problemData.TestPartition.Start = testPartitions[model].Start; problemData.TestPartition.End = testPartitions[model].End; classificationSolutions.Add(model.CreateClassificationSolution(problemData)); } } RegisterClassificationSolutionsEventHandler(); }