當前位置: 首頁>>代碼示例>>C#>>正文


C# Item.Load方法代碼示例

本文整理匯總了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);

		}
開發者ID:melkor54248,項目名稱:dungeoneye,代碼行數:29,代碼來源:ItemForm.cs

示例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);
        }
開發者ID:EmausWP,項目名稱:SharpInterwiki,代碼行數:18,代碼來源:MovedPages.cs

示例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);
                }
            }
        }
開發者ID:EmausWP,項目名稱:SharpInterwiki,代碼行數:101,代碼來源:MultilingualPage.cs


注:本文中的System.Item.Load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。