本文整理汇总了C#中System.Item.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Item.Load方法的具体用法?C# Item.Load怎么用?C# Item.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Item
的用法示例。
在下文中一共展示了Item.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemForm
/// <summary>
/// Constructor
/// </summary>
/// <param name="node">node to edit</param>
public ItemForm(XmlNode node)
{
InitializeComponent();
// TileSetNameBox
TileSetNameBox.BeginUpdate();
foreach (string name in ResourceManager.GetAssets<TileSet>())
{
TileSetNameBox.Items.Add(name);
}
TileSetNameBox.EndUpdate();
TypeBox.BeginUpdate();
TypeBox.Items.Clear();
foreach(string name in Enum.GetNames(typeof(ItemType)))
TypeBox.Items.Add(name);
TypeBox.EndUpdate();
Item = new Item();
Item.Load(node);
}
示例2: UpdateWikidataLink
private void UpdateWikidataLink(string code, string project, string wdTitle, string oldTitle, string newTitle,
string mark)
{
var wdItem = new Item(_wikidataSite, wdTitle);
wdItem.Load();
if (mark.Length > 0)
mark = string.Format("({0}) ", mark);
var projectIwCode = _wikiCodes.ToProjectCode(code);
var comment = mark + MakeSummary(code, project, oldTitle, newTitle);
wdItem.setSiteLink(projectIwCode, newTitle, comment);
var logstring =
string.Format("Updated interwiki om item Q{0}: {1} ",
wdItem.id,
comment);
_actionlog.LogData(logstring, 3);
}
示例3: ProcessPortion
//.........这里部分代码省略.........
uncheckedIw.Title);
}
}
}
var mlpConflicts = mlpl.Where(mlp => mlp.HasConflict).ToList();
var mlpUpdates = mlpl.Where(mlp => !mlp.HasConflict && mlp.IsOnWikiData).ToList();
var mlpCreates = mlpl.Where(mlp => !mlp.HasConflict && !mlp.IsOnWikiData && mlp.Interwikis.Count > 1).ToList();
if (mlpCreates.Count > 0)
{
_commonlog.LogData("Proposed creations:", mlpCreates.Count.ToString(), 1);
if (onlyupdate)
_commonlog.LogData("Creation prohibited", 1);
}
if (mlpUpdates.Count > 0)
{
_commonlog.LogData("Proposed updates:", mlpUpdates.Count.ToString(), 1);
}
if (mlpConflicts.Count > 0)
{
_commonlog.LogData("Conflicts:", mlpConflicts.Count.ToString(), 1);
foreach (var mlp in mlpConflicts)
{
_conflictlog.LogData(mlp.ConflictDescription, 2);
}
}
foreach (var mlpCreate in mlpCreates)
{
if (projectcode != "wikipedia" || onlyupdate)
continue;
var iwList = mlpCreate
.Interwikis
.Where(iw => !iw.IsRedirect && !iw.IsExcluded && !iw.IsToSection)
.ToDictionary(iw => iw.Code, iw => iw.Title);
if (iwList.Count < _botConfiguration.MinInterwikiNumber)
{
Console.WriteLine("Page {0}:{1} has not sufficient number of interwikis. Skipping...",
iwList.ElementAt(0).Key, iwList.ElementAt(0).Value);
continue;
}
Item wdItem = new Item(_wikidataSite);
iwList = ReorderInterwiki(iwList);
var projectIwList = _wikiCodes.ToProjectCodes(iwList);
try
{
wdItem.createItem(projectIwList, MakeCreationSummary(iwList, projectcode));
logstring = MakeActionLogString(iwList, projectcode);
_actionlog.LogData(logstring, 3);
}
catch (Exception e)
{
if (iwList.ContainsKey(langcode))
{
logstring = string.Format("Problem when page {0} creation", iwList[langcode]);
_actionlog.LogData(logstring, 3);
}
_actionlog.LogData(e.ToString(), 3);
}
}
foreach (var mlpUpdate in mlpUpdates)
{
var properIws = mlpUpdate
.Interwikis
.Where(iw => !iw.IsRedirect && !iw.IsExcluded && !iw.IsToSection);
if (properIws.All(iw => iw.IsOnWd))
{
Console.WriteLine("Page {0}:{1} has not sufficient additional of interwikis. Skipping...",
properIws.ElementAt(0).Code, properIws.ElementAt(0).Title);
continue;
}
var iwList =
ReorderInterwiki(properIws
.ToDictionary(iw => iw.Code, iw => iw.Title));
Item wdItem = new Item(_wikidataSite, mlpUpdate.WikiDataItem);
wdItem.Load();
_wikiCodes.SetProjectCode(projectcode);
var oldIwList = _wikiCodes.ToLanguageCodes(wdItem.links);
var projectIwList = _wikiCodes.ToProjectCodes(iwList);
var addList = _wikiCodes.MakeAddList(oldIwList, iwList);
var updateList = _wikiCodes.MakeReplaceList(oldIwList, iwList);
try
{
wdItem.setSiteLink(projectIwList, MakeSummary(addList, updateList, projectcode, false));
logstring = MakeActionLogString(addList, updateList, projectcode, false);
_actionlog.LogData(logstring, 3);
}
catch (Exception e)
{
if (iwList.ContainsKey(langcode))
{
logstring = string.Format("Problem when link {0} adding", iwList[langcode]);
_actionlog.LogData(logstring, 3);
}
_actionlog.LogData(e.ToString(), 3);
}
}
}