本文整理汇总了C#中ItemCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ItemCollection.Add方法的具体用法?C# ItemCollection.Add怎么用?C# ItemCollection.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemCollection
的用法示例。
在下文中一共展示了ItemCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValues
public ItemCollection GetValues()
{
ItemCollection sizes = new ItemCollection();
sizes.Add(Smile.INNERBRACE,"Inner");
sizes.Add(Smile.OUTERBRACE, "Outer");
return sizes;
}
示例2: AddItemOfSameType
public void AddItemOfSameType()
{
var collection = new ItemCollection();
collection.Add(Item());
collection.Add(Item(quantity:2));
Assert.That(collection.ItemCount, Is.EqualTo(3));
}
示例3: ListViewCombos
public ListViewCombos()
{
ListView list = new ListView ();
var indexField = new DataField<int> ();
var indexField2 = new DataField<int> ();
var itemsField = new DataField<ItemCollection> ();
ListStore store = new ListStore (indexField, indexField2, itemsField);
list.DataSource = store;
list.GridLinesVisible = GridLines.Horizontal;
var comboCellView = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField };
comboCellView.Items.Add (1, "one");
comboCellView.Items.Add (2, "two");
comboCellView.Items.Add (3, "three");
list.Columns.Add (new ListViewColumn ("List 1", comboCellView));
var comboCellView2 = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField2, ItemsField = itemsField };
list.Columns.Add (new ListViewColumn ("List 2", comboCellView2));
int p = 0;
for (int n = 0; n < 10; n++) {
var r = store.AddRow ();
store.SetValue (r, indexField, n % 3);
var col = new ItemCollection ();
for (int i = 0; i < 3; i++) {
col.Add (p, "p" + p);
p++;
}
store.SetValues (r, indexField2, n % 3, itemsField, col);
}
PackStart (list, true);
}
示例4: Initialize
public override void Initialize (OptionsDialog dialog, object dataObject)
{
base.Initialize (dialog, dataObject);
config = (SolutionRunConfigInfo)dataObject;
store = new ListStore (selectedField, projectNameField, projectField, runConfigField, projectRunConfigsField);
listView = new ListView (store);
var col1 = new ListViewColumn (GettextCatalog.GetString ("Solution Item"));
var cb = new CheckBoxCellView (selectedField);
cb.Toggled += SelectionChanged;
cb.Editable = true;
col1.Views.Add (cb);
col1.Views.Add (new TextCellView (projectNameField));
listView.Columns.Add (col1);
var configSelView = new ComboBoxCellView (runConfigField);
configSelView.Editable = true;
configSelView.ItemsField = projectRunConfigsField;
var col2 = new ListViewColumn (GettextCatalog.GetString ("Run Configuration"), configSelView);
listView.Columns.Add (col2);
foreach (var it in config.Solution.GetAllSolutionItems ().Where (si => si.SupportsExecute ()).OrderBy (si => si.Name)) {
var row = store.AddRow ();
var si = config.EditedConfig.Items.FirstOrDefault (i => i.SolutionItem == it);
var sc = si?.RunConfiguration?.Name ?? it.GetDefaultRunConfiguration ()?.Name;
var configs = new ItemCollection ();
foreach (var pc in it.GetRunConfigurations ())
configs.Add (pc.Name);
store.SetValues (row, selectedField, si != null, projectNameField, it.Name, projectField, it, runConfigField, sc, projectRunConfigsField, configs);
}
}
示例5: AddItem
public void AddItem()
{
var collection = new ItemCollection();
collection.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));
Assert.That(collection.Count, Is.EqualTo(1));
}
示例6: GetValues
public ItemCollection GetValues()
{
ItemCollection sizes = new ItemCollection();
for(var i = 1; i < 33; i++){
sizes.Add(""+i);
}
return sizes;
}
示例7: GetValues
public ItemCollection GetValues()
{
var items = new ItemCollection();
foreach (var s in Enumerator.GetNames<ProxyTypes>())
items.Add(s);
return items;
}
示例8: AddItemGetOwner
public void AddItemGetOwner()
{
var collection = new ItemCollection(_owner);
collection.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));
Assert.That(collection.Count, Is.EqualTo(1));
var item = collection.First();
Assert.That(item.Owner, Is.EqualTo(_owner));
}
示例9: AddSubItemWithLocation
public void AddSubItemWithLocation()
{
var collection = new ItemCollection(_owner);
var hangar = new ItemCollection(collection, location:_manufactory);
hangar.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));
var item = hangar.First();
Assert.That(item.Location, Is.EqualTo(_manufactory));
}
示例10: AddSubItemGetOwner
public void AddSubItemGetOwner()
{
var collection = new ItemCollection(_owner);
var hangar = new ItemCollection(collection);
hangar.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));
var item = hangar.First();
Assert.That(item.Owner, Is.EqualTo(_owner));
}
示例11: GetValues
public ItemCollection GetValues()
{
var items = new ItemCollection();
foreach (var s in Enum.GetNames(typeof (ProxyTypes)))
{
items.Add(s);
}
return items;
}
示例12: GetValues
public ItemCollection GetValues()
{
var items = new ItemCollection();
foreach (SqlDbType sqlType in Enum.GetValues(typeof(SqlDbType)))
{
items.Add(sqlType.ToString());
}
return items;
}
示例13: RemoveFromLocalRemoveFromParent
public void RemoveFromLocalRemoveFromParent()
{
var global = new ItemCollection();
var local = new ItemCollection(global);
local.Add(Item());
local.Remove(Item());
Assert.That(local, Is.Empty);
Assert.That(global, Is.Empty);
}
示例14: LocalizableCompoment
/// <summary>
/// Creates an instance of the class as root component
/// </summary>
/// <param name="parent">parent language</param>
/// <param name="name">name of the component</param>
/// <param name="controlType">component type to create an instance from</param>
internal LocalizableCompoment(ToolLanguage parent, string name, Type controlType)
{
Parent = parent;
_value = name;
_controlType = controlType;
ControlRessources = new ItemCollection();
string[] names = RessourceTableAttribute.GetRessourceNames(controlType);
Dictionary<string, string> values = RessourceTableAttribute.GetRessourceValues(Design, parent.LCID);
foreach (var resName in names)
{
string resValue ="";
values.TryGetValue(resName, out resValue);
Control ctrl = Translator.TryGetControl(Design, resName);
Controls.Text.AdvRichTextBox advrichText = ctrl as Controls.Text.AdvRichTextBox;
if (null != advrichText)
{
ControlRessources.Add(new LocalizableWideString(resName, resValue));
}
else
{
RichTextBox richBox = ctrl as RichTextBox;
if (null != richBox)
{
ControlRessources.Add(new LocalizableRTFString(resName, resValue));
}
else
{
TextBox textBox = ctrl as TextBox;
if (null != textBox && textBox.Multiline)
ControlRessources.Add(new LocalizableWideString(resName, resValue));
else
ControlRessources.Add(new LocalizableString(resName, resValue));
}
}
}
}
示例15: OnPopup
protected override void OnPopup(ItemCollection items)
{
ESRI.ArcGIS.Carto.IMap map = ArcMap.Document.FocusMap;
for (int i = 0; i < map.LayerCount; i++)
{
ESRI.ArcGIS.Carto.ILayer layer = map.get_Layer(i);
Item item = new Item();
item.Caption = layer.Name;
item.Enabled = layer.Visible;
item.Message = layer.Name;
item.Tag = layer;
items.Add(item);
}
}