本文整理汇总了C#中ItemList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ItemList.Add方法的具体用法?C# ItemList.Add怎么用?C# ItemList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChildren
private IEnumerable<ContentItem> GetChildren(bool getPages)
{
var items = new ItemList();
foreach (var parent in gateway.FindTranslations(Selection.SelectedItem))
{
if (getPages)
{
foreach (ContentItem child in parent.GetChildPagesUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
if (!items.ContainsAny(gateway.FindTranslations(child)))
items.Add(child);
}
else
{
foreach (ContentItem child in parent.GetChildPartsUnfiltered().Where(Engine.EditManager.GetEditorFilter(User)))
if (!items.ContainsAny(gateway.FindTranslations(child)))
items.Add(child);
}
}
items.Sort();
foreach (ContentItem item in items)
{
if (item is ILanguage)
continue;
if (item.IsPage == getPages)
yield return item;
}
}
示例2: CreateList
protected ItemList CreateList()
{
ItemList list = new ItemList();
list.Add(CreateOneItem<FirstItem>(1, "one", null));
list.Add(CreateOneItem<SecondItem>(2, "two", null));
list.Add(CreateOneItem<NonPageItem>(3, "three", null));
return list;
}
示例3: CanRemoveTwoDuplicatesWithStaticMethod
public void CanRemoveTwoDuplicatesWithStaticMethod()
{
ContentItem item = CreateOneItem<FirstItem>(1, "one", null);
ItemList list = new ItemList();
list.Add(item);
list.Add(item);
DuplicateFilter.FilterDuplicates(list);
Assert.AreEqual(1, list.Count);
}
示例4: CanCastItemList
public void CanCastItemList()
{
ItemList items = new ItemList();
items.Add(CreateOneItem<FirstItem>(1, "one", null));
items.Add(CreateOneItem<SecondItem>(1, "two", null));
ItemList<FirstItem> firsts = items.Cast<FirstItem>();
Assert.That(firsts.Count, Is.EqualTo(1));
}
示例5: CanRemoveTwoDuplicatesWithWithFilterInstance
public void CanRemoveTwoDuplicatesWithWithFilterInstance()
{
ContentItem item = CreateOneItem<FirstItem>(1, "one", null);
ItemList list = new ItemList();
list.Add(item);
list.Add(item);
DuplicateFilter filter = new DuplicateFilter();
((ItemFilter)filter).Filter(list);
Assert.AreEqual(1, list.Count);
}
示例6: SetUp
public override void SetUp()
{
base.SetUp();
list = new ItemList();
list.Add(item1 = CreateOneItem<FirstItem>(1, "one", null));
list.Add(item2 = CreateOneItem<SecondItem>(2, "two", item1));
list.Add(item3 = CreateOneItem<NonPageItem>(3, "three", item2));
item1.Published = N2.Utility.CurrentTime().AddSeconds(10);
}
示例7: ProcessShow
public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
{
//If we have XBMC New style images being downloaded then we want to check that 3 files exist
//for the series:
//http://wiki.xbmc.org/index.php?title=XBMC_v12_(Frodo)_FAQ#Local_images
//poster
//banner
//fanart
if (TVSettings.Instance.XBMCImages)
{
ItemList TheActionList = new ItemList();
// base folder:
if (!string.IsNullOrEmpty(si.AutoAdd_FolderBase) && (si.AllFolderLocations(false).Count > 0))
{
FileInfo posterJPG = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "poster.jpg");
FileInfo bannerJPG = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "banner.jpg");
FileInfo fanartJPG = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "fanart.jpg");
if ((forceRefresh || (!posterJPG.Exists)) && (!donePosterJPG.Contains(si.AutoAdd_FolderBase)))
{
string path = si.TheSeries().GetItem("poster");
if (!string.IsNullOrEmpty(path))
{
TheActionList.Add(new ActionDownload(si, null, posterJPG, path, false));
donePosterJPG.Add(si.AutoAdd_FolderBase);
}
}
if ((forceRefresh || (!bannerJPG.Exists)) && (!doneBannerJPG.Contains(si.AutoAdd_FolderBase)))
{
string path = si.TheSeries().GetItem("banner");
if (!string.IsNullOrEmpty(path))
{
TheActionList.Add(new ActionDownload(si, null, bannerJPG, path, false));
doneBannerJPG.Add(si.AutoAdd_FolderBase);
}
}
if ((forceRefresh || (!fanartJPG.Exists)) && (!doneFanartJPG.Contains(si.AutoAdd_FolderBase)))
{
string path = si.TheSeries().GetItem("fanart");
if (!string.IsNullOrEmpty(path))
{
TheActionList.Add(new ActionDownload(si, null, fanartJPG, path));
doneFanartJPG.Add(si.AutoAdd_FolderBase);
}
}
}
return TheActionList;
}
return base.ProcessShow(si, forceRefresh);
}
示例8: GetConflictSetForTask
public static ItemList<Task> GetConflictSetForTask(Task conflictedTask, ItemList<Task> earliestTasksList, ItemList<Job> jobData, Schedule schedule) {
ItemList<Task> result = new ItemList<Task>();
double conflictedCompletionTime = ComputeEarliestCompletionTime(conflictedTask, schedule);
result.Add(conflictedTask);
foreach (Task t in earliestTasksList) {
if (t.ResourceNr == conflictedTask.ResourceNr) {
if (ComputeEarliestStartTime(t, schedule) < conflictedCompletionTime)
result.Add(t);
}
}
return result;
}
示例9: ApplyTest
public void ApplyTest() {
IRandom random = new TestRandom(new int[] { 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }, null);
JSMEncoding individual = TestUtils.CreateTestJSM1();
JSMShiftChangeManipulator.Apply(random, individual);
JSMEncoding expected = new JSMEncoding();
ItemList<Permutation> jsm = new ItemList<Permutation>();
for (int i = 0; i < 3; i++) {
jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 2, 4, 5 }));
jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 4, 2, 5 }));
}
expected.JobSequenceMatrix = jsm;
Assert.IsTrue(TestUtils.JSMEncodingEquals(expected, individual));
}
示例10: CanClearDuplicateFilter
public void CanClearDuplicateFilter()
{
ContentItem item = CreateOneItem<FirstItem>(1, "one", null);
ItemList list = new ItemList();
list.Add(item);
list.Add(item);
list.Add(item);
DuplicateFilter filter = new DuplicateFilter();
filter.Filter(list);
Assert.AreEqual(1, list.Count);
filter.Clear();
filter.Filter(list);
Assert.AreEqual(1, list.Count);
}
示例11: ProcessShow
public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
{
// for each tv show, optionally write a tvshow.nfo file
if (TVSettings.Instance.NFOs)
{
ItemList TheActionList = new ItemList();
FileInfo tvshownfo = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "tvshow.nfo");
bool needUpdate = !tvshownfo.Exists ||
(si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshownfo.LastWriteTime)) ||
// was it written before we fixed the bug in <episodeguideurl> ?
(tvshownfo.LastWriteTime.ToUniversalTime().CompareTo(new DateTime(2009, 9, 13, 7, 30, 0, 0, DateTimeKind.Utc)) < 0);
bool alreadyOnTheList = DownloadXBMCMetaData.doneNFO.Contains(tvshownfo.FullName);
if ((forceRefresh || needUpdate) && !alreadyOnTheList)
{
TheActionList.Add(new ActionNFO(tvshownfo, si));
DownloadXBMCMetaData.doneNFO.Add(tvshownfo.FullName);
}
return TheActionList;
}
return base.ProcessShow(si, forceRefresh);
}
示例12: Add
public void Add(Item itm)
{
ItemList data = new ItemList();
data.Add(itm);
Request request = new Request(ItemAction.Add, data);
request.SendPackage(_sck);
}
示例13: Schedule
public Schedule(int nrOfResources) {
Resources = new ItemList<Resource>();
for (int i = 0; i < nrOfResources; i++) {
Resources.Add(new Resource(i));
}
lastScheduledTaskOfJob = new Dictionary<int, ScheduledTask>();
}
示例14: ProcessShow
public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
{
if (TVSettings.Instance.FolderJpg)
{
ItemList TheActionList = new ItemList();
FileInfo fi = FileHelper.FileInFolder(si.AutoAdd_FolderBase, defaultFileName);
bool fileDoesntExist = !doneFolderJPG.Contains(fi.FullName) && !fi.Exists;
if (forceRefresh || fileDoesntExist)
{
//default to poster when we want season posters for the season specific folders;
string itemToGet = (TVSettings.Instance.SeasonSpecificFolderJPG()) ? "poster" : TVSettings.Instance.ItemForFolderJpg();
string bannerPath = bannerPath = si.TheSeries().GetItem(itemToGet);
if (!string.IsNullOrEmpty(bannerPath))
TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, false));
doneFolderJPG.Add(fi.FullName);
}
return TheActionList;
}
return null;
}
示例15: ProcessSeason
public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
{
if (TVSettings.Instance.FolderJpg)
{
// season folders JPGs
ItemList TheActionList = new ItemList();
FileInfo fi = FileHelper.FileInFolder(folder, defaultFileName);
if (!doneFolderJPG.Contains(fi.FullName) && (!fi.Exists|| forceRefresh))
// some folders may come up multiple times
{
string bannerPath = "";
if (TVSettings.Instance.SeasonSpecificFolderJPG())
{
//We are getting a Series Level image
bannerPath = si.TheSeries().GetSeasonBannerPath(snum);
}
else
{
//We are getting a Show Level image
bannerPath = si.TheSeries().GetItem(TVSettings.Instance.ItemForFolderJpg());
}
if (!string.IsNullOrEmpty(bannerPath))
TheActionList.Add(new ActionDownload(si, null, fi, bannerPath,
TVSettings.Instance.ShrinkLargeMede8erImages));
doneFolderJPG.Add(fi.FullName);
}
return TheActionList;
}
return base.ProcessSeason(si,folder,snum,forceRefresh);
}