• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IItem的典型用法代码示例。如果您正苦于以下问题:C# IItem类的具体用法?C# IItem怎么用?C# IItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IItem类属于命名空间,在下文中一共展示了IItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Configure

        /// <summary>
        /// Configures the files included in the template for VSIX packaging,
        /// and returns the Uri for the template.
        /// </summary>
        public IVsTemplate Configure(IItem templateItem, string displayName, string description, string path)
        {
            Guard.NotNull(() => templateItem, templateItem);

            // Calculate the new Identifier
            var unicySeed = Guid.NewGuid().ToString(@"N");
            var unicyIdentifier = unicySeed.Substring(unicySeed.Length - MaxUnicyLength);
            var remainingNamedLength = MaxTemplateIdLength - MaxUnicyLength - 1;
            var namedIdentifier = path.Substring(path.Length <= remainingNamedLength ? 0 : (path.Length - remainingNamedLength));
            var templateId = string.Format(CultureInfo.InvariantCulture, @"{0}-{1}", unicyIdentifier, namedIdentifier);

            // Update the vstemplate
            var template = VsTemplateFile.Read(templateItem.PhysicalPath);
            template.SetTemplateId(templateId);
            template.SetDefaultName(SanitizeName(displayName));
            template.SetName(displayName);
            template.SetDescription(description);
            VsHelper.CheckOut(template.PhysicalPath);
            VsTemplateFile.Write(template);

            UpdateDirectoryProperties(templateItem);

            // Set VS attributes on the vstemplate file
            if (template.Type == VsTemplateType.Item)
            {
                templateItem.Data.ItemType = @"ItemTemplate";
            }
            else
            {
                templateItem.Data.ItemType = @"ProjectTemplate";
            }

            return template;
        }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:38,代码来源:VsTemplateConfigurator.cs


示例2: Add

 public void Add(IItem item)
 {
     if (!itens.Contains(item)) {
         item.ApplyEffect(player);
         this.itens.Add(item);
     }
 }
开发者ID:pennajessica,项目名称:GodChallenge,代码行数:7,代码来源:Inventario.cs


示例3: Rent

 public Rent(IItem item, DateTime rentDate, DateTime deadline)
 {
     this.Item = item;
     this.RentDate = rentDate;
     this.Deadline = deadline;
     this.RentState = RentState.Pending;
 }
开发者ID:borko9696,项目名称:SoftwareUniversity,代码行数:7,代码来源:Rent.cs


示例4: InitializeContext

            public void InitializeContext()
            {
                this.textTemplateFile = this.solution.Find<IItem>().First();

                this.store.TransactionManager.DoWithinTransaction(() =>
                {
                    var patternModel = this.store.ElementFactory.CreateElement<PatternModelSchema>();
                    var pattern = patternModel.Create<PatternSchema>();
                    var view = pattern.CreateViewSchema();
                    var parent = view.CreateElementSchema();
                    this.element = parent.CreateAutomationSettingsSchema() as AutomationSettingsSchema;
                    this.settings = element.AddExtension<CommandSettings>();

                    this.settings.TypeId = typeof(GenerateModelingCodeCommand).Name;
                    ((ICommandSettings)this.settings).Properties.Add(new PropertyBindingSettings { Name = Reflector<GenerateModelingCodeCommand>.GetPropertyName(u => u.TargetFileName) });
                    ((ICommandSettings)this.settings).Properties.Add(new PropertyBindingSettings { Name = Reflector<GenerateModelingCodeCommand>.GetPropertyName(u => u.TargetPath) });
                    ((ICommandSettings)this.settings).Properties.Add(new PropertyBindingSettings { Name = Reflector<GenerateModelingCodeCommand>.GetPropertyName(u => u.TemplateAuthoringUri) });
                    ((ICommandSettings)this.settings).Properties.Add(new PropertyBindingSettings { Name = Reflector<GenerateModelingCodeCommand>.GetPropertyName(u => u.TemplateUri) });

                });

                this.serviceProvider = new Mock<IServiceProvider>();
                this.uriService = new Mock<IUriReferenceService>();
                this.serviceProvider.Setup(sp => sp.GetService(typeof(IUriReferenceService))).Returns(this.uriService.Object);
                this.validation = new GenerateModelingCodeCommandValidation
                {
                    serviceProvider = this.serviceProvider.Object,
                };

                this.validationContext = new ValidationContext(ValidationCategories.Custom, this.settings);
            }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:31,代码来源:GenerateModelingCodeCommandValidationSpec.cs


示例5: AddComponent

        public void AddComponent(IItem equipment)
        {
            //If this item is stackable, then rather than adding it to the
            //collection, will just increase the stacked number
            if (equipment.IsStackable)
            {
                bool found = false;

                //Loop through each item in the collection
                foreach (IItem item in Components.Keys)
                {
                    //If we find a match
                    if (item == equipment)
                    {
                        //Increase the value of the stack
                        //but don't add it to the collection
                        Components[item]++;
                        found = true;
                        break;
                    }
                }

                //If we did not find an existing item, add it to the
                //collecton
                if (!found)
                    Components.Add(equipment, 1);
            }
                //if it's not stackable, then add this single item to
                //the collection.
            else
                Components.Add(equipment, 1);
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:32,代码来源:StarterBag.cs


示例6: Hold

    public void Hold(IItem holdable)
    {
        if (holdable == null)
        {
            return;
        }

        if (currentHeldObject != null)
        {
            Drop(holdable);
        }

        currentHeldObject = holdable;

        CollisionIgnoreManager collisionIgnore = holdable.gameObject.GetComponent<CollisionIgnoreManager>();
        if (collisionIgnore)
        {
            collisionIgnore.otherGameObject = anchorRigidbody.transform.parent.gameObject;
            collisionIgnore.Ignore();
        }

        //holdable.gameObject.transform.SetParent(transform, false);
        holdable.gameObject.transform.position = transform.position;
        holdable.gameObject.transform.rotation = transform.rotation;

        FixedJoint joint = gameObject.AddComponent<FixedJoint>();
        joint.connectedBody = holdable.gameObject.GetComponent<Rigidbody>();

        holdable.OnHold(this);
    }
开发者ID:KurtLoeffler,项目名称:Retrograde,代码行数:30,代码来源:Hand.cs


示例7: EquipItem

        public bool EquipItem(IItem item, IInventory inventory) {
            bool result = false;

            IWeapon weaponItem = item as IWeapon;
            if (weaponItem != null && weaponItem.IsWieldable) {
                //can't equip a wieldable weapon
            }
            else {
                if (!equipped.ContainsKey(item.WornOn)) {
                    equipped.Add(item.WornOn, item);
                    if (inventory.inventory.Any(i => i.Id == item.Id)) {//in case we are adding it from a load and not moving it from the inventory
                        inventory.inventory.RemoveWhere(i => i.Id == item.Id); //we moved the item over to equipped so we need it out of inventory
                    }
                    result = true;
                }
                else if (item.WornOn == Wearable.WIELD_LEFT || item.WornOn == Wearable.WIELD_RIGHT) { //this item can go in the free hand
                    Wearable freeHand = Wearable.WIELD_LEFT; //we default to right hand for weapons
                    if (equipped.ContainsKey(freeHand)) freeHand = Wearable.WIELD_RIGHT; //maybe this perosn is left handed
                    if (!equipped.ContainsKey(freeHand)) { //ok let's equip this
                        item.WornOn = freeHand;
                        item.Save();
                        equipped.Add(freeHand, item);
                        if (inventory.inventory.Any(i => i.Id == item.Id)) {//in case we are adding it from a load and not moving it from the inventory
                            inventory.inventory.RemoveWhere(i => i.Id == item.Id); //we moved the item over to equipped so we need it out of inventory
                        }
                        result = true;
                    }
                }
            }

            return result;
        }
开发者ID:jandar78,项目名称:Novus,代码行数:32,代码来源:Equipment.cs


示例8: Initialize

 public void Initialize()
 {
     this.item1 = this.solution.Find<IItem>().First();
     this.item2 = this.solution.Find<IItem>().Last();
     this.serviceProvider = new Mock<IServiceProvider>();
     this.serviceProvider.Setup(s => s.GetService(typeof(IUriReferenceService))).Returns(UriReferenceServiceFactory.CreateService(new[] { new SolutionUriProvider() }));
 }
开发者ID:StevenVanDijk,项目名称:NuPattern,代码行数:7,代码来源:PackUriProviderSpec.cs


示例9: GetField

        /// <summary>
        /// This method will eventually defer to the ISitecoreRepository to render the field value.
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public string GetField(string fieldName, IItem item, Dictionary<string, string> parameters)
        {
            if (item != null)
            {
                if (!String.IsNullOrEmpty(fieldName))
                {
                    // Get the ISitecoreRepository to check if the field actually exists.
                    if (_sitecoreRepository.FieldExists(fieldName, item))
                    {
                        // Helper to return field parameters for this particular field (the dictionary contains all fields + their parameters)
                        string fieldParameters = GetFieldParameters(fieldName, parameters);

                        if (!String.IsNullOrEmpty(fieldParameters))
                        {
                            // Get field value from Sitecore, having already checked for null/empty, and whether or not the field actually exists.
                            return _sitecoreRepository.GetFieldValue(fieldName, item, fieldParameters);
                        }
                        else
                        {
                            return _sitecoreRepository.GetFieldValue(fieldName, item);
                        }
                    }
                }
            }

            return String.Empty;
        }
开发者ID:JawadS,项目名称:sample-sitecore-mvc,代码行数:33,代码来源:LocationDomain.cs


示例10: Perform

		public override IItem[] Perform (IItem[] items, IItem[] modifierItems)
		{
				foreach (RipItem item in items ) {
					Util.Environment.Open (item.URL);
				}
			return null;
		}
开发者ID:mordaroso,项目名称:movierok.do,代码行数:7,代码来源:RemoteAction.cs


示例11: Run

        public static void Run(IItem[] items)
        {
            var book = items[0];

            // 1. serialize a single book to a JSON string
            Console.WriteLine(JsonConvert.SerializeObject(book));

            // 2. ... with nicer formatting
            Console.WriteLine(JsonConvert.SerializeObject(book, Formatting.Indented));

            // 3. serialize all items
            // ... include type, so we can deserialize sub-classes to interface type
            var settings = new JsonSerializerSettings() { Formatting = Formatting.Indented, TypeNameHandling = TypeNameHandling.Auto };
            Console.WriteLine(JsonConvert.SerializeObject(items, settings));

            // 4. store json string to file "items.json" on your Desktop
            var text = JsonConvert.SerializeObject(items, settings);
            var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            var filename = Path.Combine(desktop, "items.json");
            File.WriteAllText(filename, text);

            // 5. deserialize items from "items.json"
            // ... and print Description and Price of deserialized items
            var textFromFile = File.ReadAllText(filename);
            var itemsFromFile = JsonConvert.DeserializeObject<IItem[]>(textFromFile, settings);
            var currency = Currency.EUR;
            foreach (var x in itemsFromFile) Console.WriteLine($"{x.Description.Truncate(50),-50} {x.Price.ConvertTo(currency).Amount,8:0.00} {currency}");
        }
开发者ID:rkerschbaumer,项目名称:oom,代码行数:28,代码来源:SerializationExample.cs


示例12: AddItemToBuilder

 public void AddItemToBuilder(IItem item, string name, SolutionMessage.Builder builder) {
   IStringConvertibleValue value = (item as IStringConvertibleValue);
   if (value != null) {
     SolutionMessage.Types.StringVariable.Builder var = SolutionMessage.Types.StringVariable.CreateBuilder();
     var.SetName(name).SetData(value.GetValue());
     builder.AddStringVars(var.Build());
   } else {
     IStringConvertibleArray array = (item as IStringConvertibleArray);
     if (array != null) {
       SolutionMessage.Types.StringArrayVariable.Builder var = SolutionMessage.Types.StringArrayVariable.CreateBuilder();
       var.SetName(name).SetLength(array.Length);
       for (int i = 0; i < array.Length; i++)
         var.AddData(array.GetValue(i));
       builder.AddStringArrayVars(var.Build());
     } else {
       IStringConvertibleMatrix matrix = (item as IStringConvertibleMatrix);
       if (matrix != null) {
         SolutionMessage.Types.StringArrayVariable.Builder var = SolutionMessage.Types.StringArrayVariable.CreateBuilder();
         var.SetName(name).SetLength(matrix.Columns);
         for (int i = 0; i < matrix.Rows; i++)
           for (int j = 0; j < matrix.Columns; j++)
             var.AddData(matrix.GetValue(i, j));
         builder.AddStringArrayVars(var.Build());
       } else {
         throw new ArgumentException(ItemName + ": Item is not of a supported type.", "item");
       }
     }
   }
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:29,代码来源:StringConverter.cs


示例13: Template

        public Template(IItem item, IList<IItem> items)
        {
            Assert.IsTrue(new ID(item.TemplateID).Equals(Sitecore.TemplateIDs.Template), "item must be template");

            _item = item;
            _items = items;
        }
开发者ID:herskinduk,项目名称:Usergroup.Serialization,代码行数:7,代码来源:Template.cs


示例14: ItemClick

        public override void ItemClick(IItem item)
        {
            try
            {
                if (item != null)
                {
                    var model = item.Model;
                    var obj = (WcfService.Dto.ReportJobDto)model;
                    var tipo = UtilityValidation.GetStringND(obj.Tipo);
                    var viewModel = (ReportJob.ReportJobViewModel)ViewModel;
                    ISpace space = null;
                    if (tipo == Tipi.TipoReport.Fornitore.ToString())
                        space = viewModel.GetModel<ReportJobFornitoreModel>(model);
                    else if (tipo == Tipi.TipoReport.Fornitori.ToString())
                        space = viewModel.GetModel<ReportJobFornitoriModel>(model);
                    else if (tipo == Tipi.TipoReport.Committente.ToString())
                        space = viewModel.GetModel<ReportJobCommittenteModel>(model);
                    else if (tipo == Tipi.TipoReport.Committenti.ToString())
                        space = viewModel.GetModel<ReportJobCommittentiModel>(model);

                    AddSpace(space);
                }
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            } 
        }
开发者ID:es-dev,项目名称:cantieri,代码行数:28,代码来源:ReportJobItem.cs


示例15: Apply

    public static ItemArray<IItem> Apply(IItem initiator, IItem guide, IntValue k, PercentValue n) {
      if (!(initiator is RealVector) || !(guide is RealVector))
        throw new ArgumentException("Cannot relink path because one of the provided solutions or both have the wrong type.");
      if (n.Value <= 0.0)
        throw new ArgumentException("RelinkingAccuracy must be greater than 0.");

      RealVector v1 = initiator.Clone() as RealVector;
      RealVector v2 = guide as RealVector;

      if (v1.Length != v2.Length)
        throw new ArgumentException("The solutions are of different length.");

      IList<RealVector> solutions = new List<RealVector>();
      for (int i = 0; i < k.Value; i++) {
        RealVector solution = v1.Clone() as RealVector;
        for (int j = 0; j < solution.Length; j++)
          solution[j] = v1[j] + 1 / (k.Value - i) * (v2[j] - v1[j]);
        solutions.Add(solution);
      }

      IList<IItem> selection = new List<IItem>();
      if (solutions.Count > 0) {
        int noSol = (int)(solutions.Count * n.Value);
        if (noSol <= 0) noSol++;
        double stepSize = (double)solutions.Count / (double)noSol;
        for (int i = 0; i < noSol; i++)
          selection.Add(solutions.ElementAt((int)((i + 1) * stepSize - stepSize * 0.5)));
      }

      return new ItemArray<IItem>(selection);
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:31,代码来源:SingleObjectiveTestFunctionPathRelinker.cs


示例16: ItemSprite

 public ItemSprite(IItem item, Texture2D sprite)
     : base(sprite)
 {
     this.mItem = item;
     ItemDescription = new StringBuilder();
     ShowItemDescription();
 }
开发者ID:Stanimir-b,项目名称:Youkai,代码行数:7,代码来源:ItemSprite.cs


示例17: Search

        private void Search(IItem rootItem, string sFind)
        {
            foreach (IItem item in rootItem.GetChildren())
            {
                if (_bStop)
                    return;

                tbSearchingIn.Text = item.Path;
                foreach (IField field in item.Fields)
                {
                    if (field.Content.ToLower().IndexOf(sFind.ToLower()) > -1)
                    {
                        lbSearchResult.Items.Add(item.Path);
                        lock (_itemsFound)
                        {
                            _itemsFound.Add(item.Path, item);
                        }
                        break;
                    }
                }
                Application.DoEvents();
                _myExpandNode(item);

                Application.DoEvents();
                if (item.HasChildren())
                {
                    Search(item, sFind);
                }
            }
        }
开发者ID:Cabana,项目名称:CMSConverter,代码行数:30,代码来源:SearchReplaceForm.cs


示例18: AddItem

 public void AddItem(IItem item)
 {
     if (!HasItem(item.ItemName))
     {
         _items.Add(item);                
     }
 }
开发者ID:JadeHub,项目名称:Jade,代码行数:7,代码来源:Folder.cs


示例19: CheckCheckBox

        public bool CheckCheckBox(IItem sourceItem, IItem destinationParentItem, IItem destinationItem)
        {
            IItem mainTemplateItem = GetMainTemplateItem(destinationItem);

            if (mainTemplateItem != null && mainTemplateItem.Key.Equals("fff.departmentitem") && destinationItem.Key.Equals("publishingmode"))
            {
                if (destinationParentItem != null && destinationParentItem.Key.Equals("crm synkronisering"))
                {
                    IField destinationField = destinationItem.Fields.Last<IField>(currentField => (currentField.Key.Equals("source")));
                    destinationField.Content = "Modified by Phong";
                }

            }

            //Get Field that matches our FieldName. FieldName is assumed unique.
            //IField foundField = null;
            //try
            //{
            //    foundField = sourceItem.Fields.Last<IField>(currentField => (currentField.Key.Equals("__never publish")));
            //}
            //catch { }

            //Store the converted field into destination Field. FieldName is assumed unique.
            //IField destinationField = destinationItem.Fields.Last<IField>(currentField => (currentField.Key.Equals("__never publish")));

            //            destinationItem.Template.Fields

            //Sitecore6xItem itm = Sitecore6xItem.GetItem(destinationItem.Path,
            //if (destinationField != null)
            //    destinationField.Content = "1";

            return true;
        }
开发者ID:Cabana,项目名称:CMSConverter,代码行数:33,代码来源:CustomConverterPlugin.cs


示例20: CanEquip

 private bool CanEquip(IItem item)
 {
     var weapon = item as IWeapon;
     if (weapon != null) {
         switch (weapon.Class) {
             case WeaponClass.Simple:
                 return _character.Features.Any(x => x == Feature.SimpleWeaponProficiency);
             case WeaponClass.Martial:
                 return _character.Features.Any(x => x == Feature.MartialWeaponProficiency);
             case WeaponClass.Exotic:
                 return _character.Features.Any(x => x == Feature.ExoticWeaponProficiency);
             default:
                 break;
         }
     }
     var armor = item as IArmor;
     if (armor != null) {
         switch (armor.Class) {
             case ArmorClass.Light:
                 return _character.Features.Any(x => x == Feature.LightArmorProficiency);
             case ArmorClass.Medium:
                 return _character.Features.Any(x => x == Feature.MediumArmorProficiency);
             case ArmorClass.Heavy:
                 return _character.Features.Any(x => x == Feature.HeavyArmorProficiency);
             case ArmorClass.Shield:
                 return _character.Features.Any(x => x == Feature.ShieldProficiency);
             default:
                 break;
         }
     }
     return false;
 }
开发者ID:RogaDanar,项目名称:Dnd,代码行数:32,代码来源:Equipment.cs



注:本文中的IItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IItemData类代码示例发布时间:2022-05-24
下一篇:
C# IIsoManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap